diff options
author | Carsten Dominik <dominik@science.uva.nl> | 2008-01-23 10:49:31 +0000 |
---|---|---|
committer | Carsten Dominik <dominik@science.uva.nl> | 2008-01-23 10:49:31 +0000 |
commit | 8e62d5e855c245b2d576b7e1ce7aa11e94061cbd (patch) | |
tree | f4a9333b0be675271ae18fec473dbb9d9fceddc8 /lisp/replace.el | |
parent | 5deae9b3b1d19a5fa885e023cf221c1ffb06adc8 (diff) | |
download | emacs-8e62d5e855c245b2d576b7e1ce7aa11e94061cbd.tar.gz |
* replace.el (occur-mode-find-occurrence-hook): New hook that can
be used to reveal or highlight the location of a match.
(occur-mode-goto-occurrence)
(occur-mode-goto-occurrence-other-window)
(occur-mode-display-occurrence): Run
`occur-mode-find-occurrence-hook'.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 0217e73e44c..3680d574e8c 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -789,6 +789,13 @@ See `occur-revert-function'.") :type 'hook :group 'matching) +(defcustom occur-mode-find-occurrence-hook nil + "Hook run by Occur after locating an occurrence. +This will be called with the cursor position at the occurrence. An application +for this is to reveal context in an outline-mode when the occurrence is hidden." + :type 'hook + :group 'matching) + (put 'occur-mode 'mode-class 'special) (defun occur-mode () "Major mode for output from \\[occur]. @@ -837,14 +844,16 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it. same-window-buffer-names same-window-regexps) (pop-to-buffer (marker-buffer pos)) - (goto-char pos))) + (goto-char pos) + (run-hooks 'occur-mode-find-occurrence-hook))) (defun occur-mode-goto-occurrence-other-window () "Go to the occurrence the current line describes, in another window." (interactive) (let ((pos (occur-mode-find-occurrence))) (switch-to-buffer-other-window (marker-buffer pos)) - (goto-char pos))) + (goto-char pos) + (run-hooks 'occur-mode-find-occurrence-hook))) (defun occur-mode-display-occurrence () "Display in another window the occurrence the current line describes." @@ -858,7 +867,8 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it. ;; This is the way to set point in the proper window. (save-selected-window (select-window window) - (goto-char pos)))) + (goto-char pos) + (run-hooks 'occur-mode-find-occurrence-hook)))) (defun occur-find-match (n search message) (if (not n) (setq n 1)) |