emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/replace.el


From: Richard M . Stallman
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el
Date: Sat, 01 Jan 2005 17:51:44 -0500

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.198 emacs/lisp/replace.el:1.199
*** emacs/lisp/replace.el:1.198 Fri Dec 17 16:57:43 2004
--- emacs/lisp/replace.el       Sat Jan  1 22:29:36 2005
***************
*** 736,744 ****
    (interactive "p")
    ;; we need to run occur-find-match from within the Occur buffer
    (with-current-buffer
        (if (next-error-buffer-p (current-buffer))
          (current-buffer)
!       (next-error-find-buffer nil nil (lambda() (eq major-mode 'occur-mode))))
  
      (goto-char (cond (reset (point-min))
                     ((< argp 0) (line-beginning-position))
--- 736,747 ----
    (interactive "p")
    ;; we need to run occur-find-match from within the Occur buffer
    (with-current-buffer
+       ;; Choose the buffer and make it current.
        (if (next-error-buffer-p (current-buffer))
          (current-buffer)
!       (next-error-find-buffer nil nil
!                               (lambda ()
!                                 (eq major-mode 'occur-mode))))
  
      (goto-char (cond (reset (point-min))
                     ((< argp 0) (line-beginning-position))
***************
*** 918,934 ****
  (defun occur-1 (regexp nlines bufs &optional buf-name)
    (unless buf-name
      (setq buf-name "*Occur*"))
!   (let ((occur-buf (get-buffer-create buf-name))
!       (made-temp-buf nil)
        (active-bufs (delq nil (mapcar #'(lambda (buf)
                                           (when (buffer-live-p buf) buf))
                                       bufs))))
      ;; Handle the case where one of the buffers we're searching is the
!     ;; *Occur* buffer itself.
!     (when (memq occur-buf bufs)
!       (setq occur-buf (with-current-buffer occur-buf
!                       (clone-buffer "*Occur-temp*"))
!           made-temp-buf t))
      (with-current-buffer occur-buf
        (setq buffer-read-only nil)
        (occur-mode)
--- 921,940 ----
  (defun occur-1 (regexp nlines bufs &optional buf-name)
    (unless buf-name
      (setq buf-name "*Occur*"))
!   (let (occur-buf
        (active-bufs (delq nil (mapcar #'(lambda (buf)
                                           (when (buffer-live-p buf) buf))
                                       bufs))))
      ;; Handle the case where one of the buffers we're searching is the
!     ;; output buffer.  Just rename it.
!     (when (member buf-name (mapcar 'buffer-name active-bufs))
!       (with-current-buffer (get-buffer buf-name)
!       (rename-uniquely)))
! 
!     ;; Now find or create the output buffer.
!     ;; If we just renamed that buffer, we will make a new one here.
!     (setq occur-buf (get-buffer-create buf-name))
! 
      (with-current-buffer occur-buf
        (setq buffer-read-only nil)
        (occur-mode)
***************
*** 948,959 ****
                   (if (zerop count) "no" (format "%d" count))
                   (if (= count 1) "" "es")
                   regexp))
-       ;; If we had to make a temporary buffer, make it the *Occur*
-       ;; buffer now.
-       (when made-temp-buf
-         (with-current-buffer (get-buffer buf-name)
-           (kill-buffer (current-buffer)))
-         (rename-buffer buf-name))
        (setq occur-revert-arguments (list regexp nlines bufs)
              buffer-read-only t)
        (if (> count 0)
--- 954,959 ----
***************
*** 1258,1263 ****
--- 1258,1284 ----
    (replace-match newtext fixedcase literal)
    noedit)
  
+ (defcustom query-replace-highlight t
+   "*Non-nil means to highlight matches during query replacement."
+   :type 'boolean
+   :group 'matching)
+ 
+ (defcustom query-replace-lazy-highlight t
+   "*Controls the lazy-highlighting during query replacements.
+ When non-nil, all text in the buffer matching the current match
+ is highlighted lazily using isearch lazy highlighting (see
+ `isearch-lazy-highlight-initial-delay' and
+ `isearch-lazy-highlight-interval')."
+   :type 'boolean
+   :group 'matching
+   :version "21.4")
+ 
+ (defface query-replace
+   '((t (:inherit isearch)))
+   "Face for highlighting query replacement matches."
+   :group 'matching
+   :version "21.4")
+ 
  (defun perform-replace (from-string replacements
                        query-flag regexp-flag delimited-flag
                        &optional repeat-count map start end)
***************
*** 1601,1627 ****
                 (if (= replace-count 1) "" "s")))
      (and keep-going stack)))
  
- (defcustom query-replace-highlight t
-   "*Non-nil means to highlight matches during query replacement."
-   :type 'boolean
-   :group 'matching)
- 
- (defcustom query-replace-lazy-highlight t
-   "*Controls the lazy-highlighting during query replacements.
- When non-nil, all text in the buffer matching the current match
- is highlighted lazily using isearch lazy highlighting (see
- `isearch-lazy-highlight-initial-delay' and
- `isearch-lazy-highlight-interval')."
-   :type 'boolean
-   :group 'matching
-   :version "21.4")
- 
- (defface query-replace
-   '((t (:inherit isearch)))
-   "Face for highlighting query replacement matches."
-   :group 'matching
-   :version "21.4")
- 
  (defvar replace-overlay nil)
  
  (defun replace-highlight (beg end)
--- 1622,1627 ----
***************
*** 1638,1644 ****
    (when replace-overlay
      (delete-overlay replace-overlay))
    (when query-replace-lazy-highlight
!     (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)
      (setq isearch-lazy-highlight-last-string nil)))
  
  ;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
--- 1638,1644 ----
    (when replace-overlay
      (delete-overlay replace-overlay))
    (when query-replace-lazy-highlight
!     (isearch-lazy-highlight-cleanup lazy-highlight-cleanup)
      (setq isearch-lazy-highlight-last-string nil)))
  
  ;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]