comparison lisp/replace.el @ 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 60873cd984cd
children 6fb026ad601f
comparison
equal deleted inserted replaced
63969:4b9c4819acb4 63970:01120e702316
717 "Hook run when entering Occur mode." 717 "Hook run when entering Occur mode."
718 :type 'hook 718 :type 'hook
719 :group 'matching) 719 :group 'matching)
720 720
721 (defcustom occur-hook nil 721 (defcustom occur-hook nil
722 "Hook run when `occur' is called." 722 "Hook run by Occur when there are any matches."
723 :type 'hook 723 :type 'hook
724 :group 'matching) 724 :group 'matching)
725 725
726 (put 'occur-mode 'mode-class 'special) 726 (put 'occur-mode 'mode-class 'special)
727 (defun occur-mode () 727 (defun occur-mode ()
1040 (if (zerop diff) "" (format " (%d killed)" diff)) 1040 (if (zerop diff) "" (format " (%d killed)" diff))
1041 (if (zerop count) "no" (format "%d" count)) 1041 (if (zerop count) "no" (format "%d" count))
1042 (if (= count 1) "" "es") 1042 (if (= count 1) "" "es")
1043 regexp)) 1043 regexp))
1044 (setq occur-revert-arguments (list regexp nlines bufs)) 1044 (setq occur-revert-arguments (list regexp nlines bufs))
1045 (if (> count 0) 1045 (if (= count 0)
1046 (progn 1046 (kill-buffer occur-buf)
1047 (display-buffer occur-buf) 1047 (display-buffer occur-buf)
1048 (setq next-error-last-buffer occur-buf) 1048 (setq next-error-last-buffer occur-buf)
1049 (setq buffer-read-only t) 1049 (setq buffer-read-only t)
1050 (set-buffer-modified-p nil)) 1050 (set-buffer-modified-p nil)
1051 (kill-buffer occur-buf))) 1051 (run-hooks 'occur-hook)))))))
1052 (run-hooks 'occur-hook)))))
1053 1052
1054 (defun occur-engine-add-prefix (lines) 1053 (defun occur-engine-add-prefix (lines)
1055 (mapcar 1054 (mapcar
1056 #'(lambda (line) 1055 #'(lambda (line)
1057 (concat " :" line "\n")) 1056 (concat " :" line "\n"))