diff options
| author | Eli Zaretskii | 2005-05-07 13:46:42 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2005-05-07 13:46:42 +0000 |
| commit | 06df7f877bf6db98b8540636819d14114160aee6 (patch) | |
| tree | 2f1543414a7afbb89d3a86df1a4d6fc071785cb9 /lisp/replace.el | |
| parent | f3c2dbe9146caafcf968904434c70c04669ac509 (diff) | |
| download | emacs-06df7f877bf6db98b8540636819d14114160aee6.tar.gz emacs-06df7f877bf6db98b8540636819d14114160aee6.zip | |
(occur-1): Bind inhibit-read-only so that erase-buffer doesn't barf
on read-only text properties (likewise for add-text-properties in
occur-engine). Mark buffer as unmodified.
(occur-engine): Don't set buffer-read-only here.
Diffstat (limited to 'lisp/replace.el')
| -rw-r--r-- | lisp/replace.el | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lisp/replace.el b/lisp/replace.el index dc8eb131b72..1cef7ecc52a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el | |||
| @@ -977,32 +977,33 @@ See also `multi-occur'." | |||
| 977 | (setq occur-buf (get-buffer-create buf-name)) | 977 | (setq occur-buf (get-buffer-create buf-name)) |
| 978 | 978 | ||
| 979 | (with-current-buffer occur-buf | 979 | (with-current-buffer occur-buf |
| 980 | (setq buffer-read-only nil) | ||
| 981 | (occur-mode) | 980 | (occur-mode) |
| 982 | (erase-buffer) | 981 | (let ((inhibit-read-only t)) |
| 983 | (let ((count (occur-engine | 982 | (erase-buffer) |
| 984 | regexp active-bufs occur-buf | 983 | (let ((count (occur-engine |
| 985 | (or nlines list-matching-lines-default-context-lines) | 984 | regexp active-bufs occur-buf |
| 986 | (and case-fold-search | 985 | (or nlines list-matching-lines-default-context-lines) |
| 987 | (isearch-no-upper-case-p regexp t)) | 986 | (and case-fold-search |
| 988 | list-matching-lines-buffer-name-face | 987 | (isearch-no-upper-case-p regexp t)) |
| 989 | nil list-matching-lines-face t))) | 988 | list-matching-lines-buffer-name-face |
| 990 | (let* ((bufcount (length active-bufs)) | 989 | nil list-matching-lines-face t))) |
| 991 | (diff (- (length bufs) bufcount))) | 990 | (let* ((bufcount (length active-bufs)) |
| 992 | (message "Searched %d buffer%s%s; %s match%s for `%s'" | 991 | (diff (- (length bufs) bufcount))) |
| 993 | bufcount (if (= bufcount 1) "" "s") | 992 | (message "Searched %d buffer%s%s; %s match%s for `%s'" |
| 994 | (if (zerop diff) "" (format " (%d killed)" diff)) | 993 | bufcount (if (= bufcount 1) "" "s") |
| 995 | (if (zerop count) "no" (format "%d" count)) | 994 | (if (zerop diff) "" (format " (%d killed)" diff)) |
| 996 | (if (= count 1) "" "es") | 995 | (if (zerop count) "no" (format "%d" count)) |
| 997 | regexp)) | 996 | (if (= count 1) "" "es") |
| 998 | (setq occur-revert-arguments (list regexp nlines bufs) | 997 | regexp)) |
| 999 | buffer-read-only t) | 998 | (setq occur-revert-arguments (list regexp nlines bufs)) |
| 1000 | (if (> count 0) | 999 | (if (> count 0) |
| 1001 | (progn | 1000 | (progn |
| 1002 | (display-buffer occur-buf) | 1001 | (display-buffer occur-buf) |
| 1003 | (setq next-error-last-buffer occur-buf)) | 1002 | (setq next-error-last-buffer occur-buf)) |
| 1004 | (kill-buffer occur-buf))) | 1003 | (kill-buffer occur-buf))) |
| 1005 | (run-hooks 'occur-hook)))) | 1004 | (run-hooks 'occur-hook)) |
| 1005 | (setq buffer-read-only t) | ||
| 1006 | (set-buffer-modified-p nil)))) | ||
| 1006 | 1007 | ||
| 1007 | (defun occur-engine-add-prefix (lines) | 1008 | (defun occur-engine-add-prefix (lines) |
| 1008 | (mapcar | 1009 | (mapcar |
| @@ -1013,7 +1014,6 @@ See also `multi-occur'." | |||
| 1013 | (defun occur-engine (regexp buffers out-buf nlines case-fold-search | 1014 | (defun occur-engine (regexp buffers out-buf nlines case-fold-search |
| 1014 | title-face prefix-face match-face keep-props) | 1015 | title-face prefix-face match-face keep-props) |
| 1015 | (with-current-buffer out-buf | 1016 | (with-current-buffer out-buf |
| 1016 | (setq buffer-read-only nil) | ||
| 1017 | (let ((globalcount 0) | 1017 | (let ((globalcount 0) |
| 1018 | (coding nil)) | 1018 | (coding nil)) |
| 1019 | ;; Map over all the buffers | 1019 | ;; Map over all the buffers |