diff options
author | Eli Zaretskii <eliz@gnu.org> | 2018-10-09 17:46:31 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-10-09 17:46:31 +0300 |
commit | cd7caee630f9425a1a16e4da31e892a2ec29ac09 (patch) | |
tree | 8c624e08350bcb6e11d085e11295424093d5abe4 /lisp/replace.el | |
parent | 333f0bfe766185c66952c6fbd4796c6bb97c868d (diff) | |
download | emacs-cd7caee630f9425a1a16e4da31e892a2ec29ac09.tar.gz |
Unbreak 'revert-buffer' in Occur buffers
* lisp/replace.el (occur-revert-function): Use the value of
occur-revert-function from the correct buffer. (Bug#32987)
* test/lisp/replace-tests.el (replace-occur-revert-bug32543)
(replace-occur-revert-bug32987): New tests.
Diffstat (limited to 'lisp/replace.el')
-rw-r--r-- | lisp/replace.el | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index 00b2ceee356..04e5d4273e0 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1226,14 +1226,14 @@ the user called `occur'." (pcase-let ((`(,region-start ,region-end ,orig-line ,buffer) (occur--parse-occur-buffer)) (regexp (car occur-revert-arguments))) - (with-current-buffer buffer - (when (wholenump orig-line) - (goto-char (point-min)) - (forward-line (1- orig-line))) - (save-excursion - (if (or region-start region-end) - (occur regexp nil (list (cons region-start region-end))) - (apply 'occur-1 (append occur-revert-arguments (list (buffer-name)))))))))) + (if (not (or region-start region-end)) + (apply 'occur-1 (append occur-revert-arguments (list (buffer-name)))) + (with-current-buffer buffer + (when (wholenump orig-line) + (goto-char (point-min)) + (forward-line (1- orig-line))) + (save-excursion + (occur regexp nil (list (cons region-start region-end))))))))) (defun occur-mode-find-occurrence () (let ((pos (get-text-property (point) 'occur-target))) |