Mercurial > emacs
comparison lisp/replace.el @ 90200:f9a65d7ebd29
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-68
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 459-473)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 86-87)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 07 Jul 2005 12:43:14 +0000 |
parents | bb71c6cf2009 6fb026ad601f |
children | fbb2bea03df9 |
comparison
equal
deleted
inserted
replaced
90199:bb71c6cf2009 | 90200:f9a65d7ebd29 |
---|---|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 ;; GNU General Public License for more details. | 18 ;; GNU General Public License for more details. |
19 | 19 |
20 ;; You should have received a copy of the GNU General Public License | 20 ;; You should have received a copy of the GNU General Public License |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
23 ;; Boston, MA 02111-1307, USA. | 23 ;; Boston, MA 02110-1301, USA. |
24 | 24 |
25 ;;; Commentary: | 25 ;;; Commentary: |
26 | 26 |
27 ;; This package supplies the string and regular-expression replace functions | 27 ;; This package supplies the string and regular-expression replace functions |
28 ;; documented in the Emacs user's manual. | 28 ;; documented in the Emacs user's manual. |
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 () |
924 (defun occur-rename-buffer (&optional unique-p) | 924 (defun occur-rename-buffer (&optional unique-p) |
925 "Rename the current *Occur* buffer to *Occur: original-buffer-name*. | 925 "Rename the current *Occur* buffer to *Occur: original-buffer-name*. |
926 Here `original-buffer-name' is the buffer name were occur was originally run. | 926 Here `original-buffer-name' is the buffer name were occur was originally run. |
927 When given the prefix argument, the renaming will not clobber the existing | 927 When given the prefix argument, the renaming will not clobber the existing |
928 buffer(s) of that name, but use `generate-new-buffer-name' instead. | 928 buffer(s) of that name, but use `generate-new-buffer-name' instead. |
929 You can add this to `occur-hook' if you always want a separate *Occur* | 929 You can add this to `occur-mode-hook' if you always want a separate *Occur* |
930 buffer for each buffer where you invoke `occur'." | 930 buffer for each buffer where you invoke `occur'." |
931 (interactive "P") | 931 (interactive "P") |
932 (with-current-buffer | 932 (with-current-buffer |
933 (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) | 933 (if (eq major-mode 'occur-mode) (current-buffer) (get-buffer "*Occur*")) |
934 (rename-buffer (concat "*Occur: " | 934 (rename-buffer (concat "*Occur: " |
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 (kill-buffer occur-buf))) | 1049 (setq buffer-read-only t) |
1050 (setq buffer-read-only t) | 1050 (set-buffer-modified-p nil) |
1051 (set-buffer-modified-p nil) | 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")) |