summaryrefslogtreecommitdiff
path: root/lisp/replace.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2001-12-24 16:27:20 +0000
committerRichard M. Stallman <rms@gnu.org>2001-12-24 16:27:20 +0000
commit365486d69e8b74325093a1e3084d5b0867c89159 (patch)
tree064ebf26118239f0b8b608a452f5f2c3a64a8995 /lisp/replace.el
parent3978dec08d45a671b25ba0530ed3d421e706522e (diff)
downloademacs-365486d69e8b74325093a1e3084d5b0867c89159.tar.gz
emacs-365486d69e8b74325093a1e3084d5b0867c89159.tar.bz2
emacs-365486d69e8b74325093a1e3084d5b0867c89159.zip
(occur-mode-display-occurrence): New function.
(occur-mode-map): Bind C-o to it.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r--lisp/replace.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/replace.el b/lisp/replace.el
index 71ec81ba44e..28e0d06f720 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -436,6 +436,7 @@ end of the buffer."
(define-key map [mouse-2] 'occur-mode-mouse-goto)
(define-key map "\C-c\C-c" 'occur-mode-goto-occurrence)
(define-key map "\C-m" 'occur-mode-goto-occurrence)
+ (define-key map "\C-o" 'occur-mode-display-occurrence)
(define-key map "\M-n" 'occur-next)
(define-key map "\M-p" 'occur-prev)
(define-key map "g" 'revert-buffer)
@@ -512,6 +513,19 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
(pop-to-buffer occur-buffer)
(goto-char (marker-position pos))))
+(defun occur-mode-display-occurrence ()
+ "Display in another window the occurrence the current line describes."
+ (interactive)
+ (let ((pos (occur-mode-find-occurrence))
+ same-window-buffer-names
+ same-window-regexps
+ window)
+ (setq window (display-buffer occur-buffer))
+ ;; This is the way to set point in the proper window.
+ (save-selected-window
+ (select-window window)
+ (goto-char (marker-position pos)))))
+
(defun occur-next (&optional n)
"Move to the Nth (default 1) next match in the *Occur* buffer."
(interactive "p")