From c7d2f2cc466edb01728256900b6cf92b5e6906e5 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 3 Jul 2005 22:49:00 +0000 Subject: [PATCH] (occur-hook): Doc fix. (occur-1): Don't call `occur-hook' if there are no matches. --- lisp/replace.el | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lisp/replace.el b/lisp/replace.el index 7e3dd984150..3b93761a0cc 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -719,7 +719,7 @@ See `occur-revert-function'.") :group 'matching) (defcustom occur-hook nil - "Hook run when `occur' is called." + "Hook run by Occur when there are any matches." :type 'hook :group 'matching) @@ -1042,14 +1042,13 @@ See also `multi-occur'." (if (= count 1) "" "es") regexp)) (setq occur-revert-arguments (list regexp nlines bufs)) - (if (> count 0) - (progn - (display-buffer occur-buf) - (setq next-error-last-buffer occur-buf) - (setq buffer-read-only t) - (set-buffer-modified-p nil)) - (kill-buffer occur-buf))) - (run-hooks 'occur-hook))))) + (if (= count 0) + (kill-buffer occur-buf) + (display-buffer occur-buf) + (setq next-error-last-buffer occur-buf) + (setq buffer-read-only t) + (set-buffer-modified-p nil) + (run-hooks 'occur-hook))))))) (defun occur-engine-add-prefix (lines) (mapcar -- 2.39.2