Mercurial > emacs
diff lisp/replace.el @ 58625:31d0b9422d7b
simple.el (next-error-buffer-p): allow for inclusive and
exclusive tests for finding a buffer
(next-error-find-buffer): pass the exclusive and inclusive tests
to next-error-buffer-p
replace.el (occur-next-error): switch to the Occur buffer when
appropriate, and use the exclusive filter to
next-error-find-buffer to do it. Use the absolute value of the
motion amount.
| author | Teodor Zlatanov <tzz@lifelogs.com> |
|---|---|
| date | Mon, 29 Nov 2004 18:44:29 +0000 |
| parents | 0301caf145d2 |
| children | 5ffd11b70941 |
line wrap: on
line diff
--- a/lisp/replace.el Mon Nov 29 15:58:15 2004 +0000 +++ b/lisp/replace.el Mon Nov 29 18:44:29 2004 +0000 @@ -734,17 +734,23 @@ "Move to the Nth (default 1) next match in an Occur mode buffer. Compatibility function for \\[next-error] invocations." (interactive "p") - (when reset - (occur-find-match 0 #'next-single-property-change "No first match")) - (occur-find-match - (prefix-numeric-value argp) - (if (> 0 (prefix-numeric-value argp)) - #'previous-single-property-change - #'next-single-property-change) - "No more matches") - ;; In case the *Occur* buffer is visible in a nonselected window. - (set-window-point (get-buffer-window (current-buffer)) (point)) - (occur-mode-goto-occurrence)) + ;; we need to run occur-find-match from within the Occur buffer + (with-current-buffer + (if (next-error-buffer-p (current-buffer)) + (current-buffer) + (next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode)))) + + (when reset + (goto-char (point-min))) + (occur-find-match + (abs (prefix-numeric-value argp)) + (if (> 0 (prefix-numeric-value argp)) + #'previous-single-property-change + #'next-single-property-change) + "No more matches") + ;; In case the *Occur* buffer is visible in a nonselected window. + (set-window-point (get-buffer-window (current-buffer)) (point)) + (occur-mode-goto-occurrence))) (defcustom list-matching-lines-default-context-lines 0
