[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bookmark.el patch for 1) other window and 2) C-x p instead of C-x r
From: |
Drew Adams |
Subject: |
bookmark.el patch for 1) other window and 2) C-x p instead of C-x r |
Date: |
Fri, 13 Jul 2007 09:30:52 -0700 |
Here is a bookmark.el patch with a minor enhancement to let you use another
window.
It also replaces use of `C-x r' for bookmark commands by use of `C-x p'. I
think that's better, because:
1. It reserves all of `C-x r' for register and rectangle commands. (Even
those should be split, IMO.)
2. It lets you reuse the standard bookmark keys with `C-x p', instead of
having, for instance, `j' mean jump in the bookmark-map, but `b' mean jump
when used with `C-x r'. Nothing new to remember this way: just add `C-x p'
in front of all bookmark-map keys.
----------------8<--------------------------------
*** bookmark-CVS-2007-07-13.el Fri Jul 13 09:09:08 2007
--- bookmark-CVS-patched-2007-07-13.el Fri Jul 13 09:23:58 2007
***************
*** 224,232 ****
;; Set up these bindings dumping time *only*;
;; if the user alters them, don't override the user when loading
bookmark.el.
! ;;;###autoload (define-key ctl-x-map "rb" 'bookmark-jump)
! ;;;###autoload (define-key ctl-x-map "rm" 'bookmark-set)
! ;;;###autoload (define-key ctl-x-map "rl" 'bookmark-bmenu-list)
;;;###autoload
(defvar bookmark-map nil
--- 224,230 ----
;; Set up these bindings dumping time *only*;
;; if the user alters them, don't override the user when loading
bookmark.el.
! ;;;###autoload (define-key ctl-x-map "p" bookmark-map)
;;;###autoload
(defvar bookmark-map nil
***************
*** 243,248 ****
--- 241,248 ----
;;;###autoload (define-key bookmark-map "m" 'bookmark-set) ; "m" for
"mark"
;;;###autoload (define-key bookmark-map "j" 'bookmark-jump)
;;;###autoload (define-key bookmark-map "g" 'bookmark-jump) ; "g" for "go"
+ ;;;###autoload (define-key bookmark-map "o" 'bookmark-jump-other-window)
+ ;;;###autoload (define-key bookmark-map "q" 'bookmark-jump-other-window)
;;;###autoload (define-key bookmark-map "i" 'bookmark-insert)
;;;###autoload (define-key bookmark-map "e" 'edit-bookmarks)
;;;###autoload (define-key bookmark-map "f" 'bookmark-insert-location) ;
"f" for "find"
***************
*** 1082,1087 ****
--- 1082,1106 ----
;; show it in a buffer.
(bookmark-show-annotation bookmark)))))
+ ;;;###autoload
+ (defun bookmark-jump-other-window (bookmark)
+ "Jump to BOOKMARK (a point in some file) in another window.
+ See `bookmark-jump'."
+ (interactive
+ (let ((bkm (bookmark-completing-read "Jump to bookmark (in another
window)"
+ bookmark-current-bookmark)))
+ (if (> emacs-major-version 21)
+ (list bkm) bkm)))
+ (when bookmark
+ (bookmark-maybe-historicize-string bookmark)
+ (let ((cell (bookmark-jump-noselect bookmark)))
+ (and cell
+ (switch-to-buffer-other-window (car cell))
+ (goto-char (cdr cell))
+ (if bookmark-automatically-show-annotations
+ ;; if there is an annotation for this bookmark,
+ ;; show it in a buffer.
+ (bookmark-show-annotation bookmark))))))
(defun bookmark-file-or-variation-thereof (file)
"Return FILE (a string) if it exists, or return a reasonable
- bookmark.el patch for 1) other window and 2) C-x p instead of C-x r,
Drew Adams <=