changeset 63970:01120e702316

(occur-hook): Doc fix. (occur-1): Don't call `occur-hook' if there are no matches.
author Juanma Barranquero <lekktu@gmail.com>
date Sun, 03 Jul 2005 22:49:00 +0000
parents 4b9c4819acb4
children b4534bf76ba1
files lisp/replace.el
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/replace.el	Sun Jul 03 21:50:53 2005 +0000
+++ b/lisp/replace.el	Sun Jul 03 22:49:00 2005 +0000
@@ -719,7 +719,7 @@
   :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 @@
 		     (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