aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2005-01-01 22:29:54 +0000
committerRichard M. Stallman2005-01-01 22:29:54 +0000
commitf42a241b8e49696ac5b6512a43244f1680a9ea56 (patch)
tree3c8e30118d2c73b586587665521a0fab58ffa5c4
parentc430597dfc185d8b5ac65937176e33dcdcd61d0b (diff)
downloademacs-f42a241b8e49696ac5b6512a43244f1680a9ea56.tar.gz
emacs-f42a241b8e49696ac5b6512a43244f1680a9ea56.zip
(occur-1): If the output buffer is also an input, don't kill it, rename it.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/replace.el72
2 files changed, 41 insertions, 36 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f0daa4d93db..1cdc9ba9cf5 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
12005-01-01 Richard M. Stallman <rms@gnu.org> 12005-01-01 Richard M. Stallman <rms@gnu.org>
2 2
3 * replace.el (occur-1): If the output buffer is also an input,
4 don't kill it, rename it.
5
6 * faces.el (set-face-background, set-face-foreground): Doc fix.
7
3 * cus-face.el (custom-face-attributes): Fix :help-echo strings 8 * cus-face.el (custom-face-attributes): Fix :help-echo strings
4 for :foreground and :background. 9 for :foreground and :background.
5 10
diff --git a/lisp/replace.el b/lisp/replace.el
index 775ad0ffb05..8820a768006 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -736,9 +736,12 @@ Compatibility function for \\[next-error] invocations."
736 (interactive "p") 736 (interactive "p")
737 ;; we need to run occur-find-match from within the Occur buffer 737 ;; we need to run occur-find-match from within the Occur buffer
738 (with-current-buffer 738 (with-current-buffer
739 ;; Choose the buffer and make it current.
739 (if (next-error-buffer-p (current-buffer)) 740 (if (next-error-buffer-p (current-buffer))
740 (current-buffer) 741 (current-buffer)
741 (next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode)))) 742 (next-error-find-buffer nil nil
743 (lambda ()
744 (eq major-mode 'occur-mode))))
742 745
743 (goto-char (cond (reset (point-min)) 746 (goto-char (cond (reset (point-min))
744 ((< argp 0) (line-beginning-position)) 747 ((< argp 0) (line-beginning-position))
@@ -918,17 +921,20 @@ See also `multi-occur'."
918(defun occur-1 (regexp nlines bufs &optional buf-name) 921(defun occur-1 (regexp nlines bufs &optional buf-name)
919 (unless buf-name 922 (unless buf-name
920 (setq buf-name "*Occur*")) 923 (setq buf-name "*Occur*"))
921 (let ((occur-buf (get-buffer-create buf-name)) 924 (let (occur-buf
922 (made-temp-buf nil)
923 (active-bufs (delq nil (mapcar #'(lambda (buf) 925 (active-bufs (delq nil (mapcar #'(lambda (buf)
924 (when (buffer-live-p buf) buf)) 926 (when (buffer-live-p buf) buf))
925 bufs)))) 927 bufs))))
926 ;; Handle the case where one of the buffers we're searching is the 928 ;; Handle the case where one of the buffers we're searching is the
927 ;; *Occur* buffer itself. 929 ;; output buffer. Just rename it.
928 (when (memq occur-buf bufs) 930 (when (member buf-name (mapcar 'buffer-name active-bufs))
929 (setq occur-buf (with-current-buffer occur-buf 931 (with-current-buffer (get-buffer buf-name)
930 (clone-buffer "*Occur-temp*")) 932 (rename-uniquely)))
931 made-temp-buf t)) 933
934 ;; Now find or create the output buffer.
935 ;; If we just renamed that buffer, we will make a new one here.
936 (setq occur-buf (get-buffer-create buf-name))
937
932 (with-current-buffer occur-buf 938 (with-current-buffer occur-buf
933 (setq buffer-read-only nil) 939 (setq buffer-read-only nil)
934 (occur-mode) 940 (occur-mode)
@@ -948,12 +954,6 @@ See also `multi-occur'."
948 (if (zerop count) "no" (format "%d" count)) 954 (if (zerop count) "no" (format "%d" count))
949 (if (= count 1) "" "es") 955 (if (= count 1) "" "es")
950 regexp)) 956 regexp))
951 ;; If we had to make a temporary buffer, make it the *Occur*
952 ;; buffer now.
953 (when made-temp-buf
954 (with-current-buffer (get-buffer buf-name)
955 (kill-buffer (current-buffer)))
956 (rename-buffer buf-name))
957 (setq occur-revert-arguments (list regexp nlines bufs) 957 (setq occur-revert-arguments (list regexp nlines bufs)
958 buffer-read-only t) 958 buffer-read-only t)
959 (if (> count 0) 959 (if (> count 0)
@@ -1258,6 +1258,27 @@ passed in. If LITERAL is set, no checking is done, anyway."
1258 (replace-match newtext fixedcase literal) 1258 (replace-match newtext fixedcase literal)
1259 noedit) 1259 noedit)
1260 1260
1261(defcustom query-replace-highlight t
1262 "*Non-nil means to highlight matches during query replacement."
1263 :type 'boolean
1264 :group 'matching)
1265
1266(defcustom query-replace-lazy-highlight t
1267 "*Controls the lazy-highlighting during query replacements.
1268When non-nil, all text in the buffer matching the current match
1269is highlighted lazily using isearch lazy highlighting (see
1270`isearch-lazy-highlight-initial-delay' and
1271`isearch-lazy-highlight-interval')."
1272 :type 'boolean
1273 :group 'matching
1274 :version "21.4")
1275
1276(defface query-replace
1277 '((t (:inherit isearch)))
1278 "Face for highlighting query replacement matches."
1279 :group 'matching
1280 :version "21.4")
1281
1261(defun perform-replace (from-string replacements 1282(defun perform-replace (from-string replacements
1262 query-flag regexp-flag delimited-flag 1283 query-flag regexp-flag delimited-flag
1263 &optional repeat-count map start end) 1284 &optional repeat-count map start end)
@@ -1601,27 +1622,6 @@ make, or the user didn't cancel the call."
1601 (if (= replace-count 1) "" "s"))) 1622 (if (= replace-count 1) "" "s")))
1602 (and keep-going stack))) 1623 (and keep-going stack)))
1603 1624
1604(defcustom query-replace-highlight t
1605 "*Non-nil means to highlight matches during query replacement."
1606 :type 'boolean
1607 :group 'matching)
1608
1609(defcustom query-replace-lazy-highlight t
1610 "*Controls the lazy-highlighting during query replacements.
1611When non-nil, all text in the buffer matching the current match
1612is highlighted lazily using isearch lazy highlighting (see
1613`isearch-lazy-highlight-initial-delay' and
1614`isearch-lazy-highlight-interval')."
1615 :type 'boolean
1616 :group 'matching
1617 :version "21.4")
1618
1619(defface query-replace
1620 '((t (:inherit isearch)))
1621 "Face for highlighting query replacement matches."
1622 :group 'matching
1623 :version "21.4")
1624
1625(defvar replace-overlay nil) 1625(defvar replace-overlay nil)
1626 1626
1627(defun replace-highlight (beg end) 1627(defun replace-highlight (beg end)
@@ -1638,7 +1638,7 @@ is highlighted lazily using isearch lazy highlighting (see
1638 (when replace-overlay 1638 (when replace-overlay
1639 (delete-overlay replace-overlay)) 1639 (delete-overlay replace-overlay))
1640 (when query-replace-lazy-highlight 1640 (when query-replace-lazy-highlight
1641 (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup) 1641 (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
1642 (setq isearch-lazy-highlight-last-string nil))) 1642 (setq isearch-lazy-highlight-last-string nil)))
1643 1643
1644;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4 1644;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4