# HG changeset patch # User Juanma Barranquero # Date 1120430940 0 # Node ID 01120e7023163ccce540b141c61b5a791c312639 # Parent 4b9c4819acb4a6c58b65c1f4c3d27e4f12272140 (occur-hook): Doc fix. (occur-1): Don't call `occur-hook' if there are no matches. diff -r 4b9c4819acb4 -r 01120e702316 lisp/replace.el --- 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