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: Juri Linkov
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el
Date: Sun, 12 Dec 2004 17:41:23 -0500

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.193 emacs/lisp/replace.el:1.194
*** emacs/lisp/replace.el:1.193 Sun Dec 12 22:06:30 2004
--- emacs/lisp/replace.el       Sun Dec 12 22:30:41 2004
***************
*** 1281,1286 ****
--- 1281,1288 ----
        ;; (match-data); otherwise it is t if a match is possible at point.
        (match-again t)
  
+       (isearch-string isearch-string)
+       (isearch-regexp isearch-regexp)
        (message
         (if query-flag
             (substitute-command-keys
***************
*** 1313,1318 ****
--- 1315,1324 ----
                                    (if regexp-flag from-string
                                      (regexp-quote from-string))
                                    "\\b")))
+     (if (eq query-replace-highlight 'isearch)
+       (setq isearch-string search-string
+             isearch-regexp regexp-flag))
+ 
      (push-mark)
      (undo-boundary)
      (unwind-protect
***************
*** 1528,1534 ****
                         (setq unread-command-events
                               (append (listify-key-sequence key)
                                       unread-command-events))
!                        (setq done t))))
                ;; Record previous position for ^ when we move on.
                ;; Change markers to numbers in the match data
                ;; since lots of markers slow down editing.
--- 1534,1547 ----
                         (setq unread-command-events
                               (append (listify-key-sequence key)
                                       unread-command-events))
!                        (setq done t)))
!                 (when (eq query-replace-highlight 'isearch)
!                   ;; Force isearch rehighlighting
!                   (if (not (memq def '(skip backup)))
!                       (setq isearch-lazy-highlight-last-string nil))
!                   ;; Restore isearch data in case of isearching during edit
!                   (setq isearch-string search-string
!                         isearch-regexp regexp-flag)))
                ;; Record previous position for ^ when we move on.
                ;; Change markers to numbers in the match data
                ;; since lots of markers slow down editing.
***************
*** 1563,1589 ****
                 (if (= replace-count 1) "" "s")))
      (and keep-going stack)))
  
! (defcustom query-replace-highlight t
!   "*Non-nil means to highlight words during query replacement."
!   :type 'boolean
    :group 'matching)
  
  (defvar replace-overlay nil)
  
  (defun replace-dehighlight ()
!   (and replace-overlay
!        (progn
!        (delete-overlay replace-overlay)
!        (setq replace-overlay nil))))
  
  (defun replace-highlight (start end)
!   (and query-replace-highlight
!        (if replace-overlay
!          (move-overlay replace-overlay start end (current-buffer))
!        (setq replace-overlay (make-overlay start end))
!        (overlay-put replace-overlay 'face
!                     (if (facep 'query-replace)
!                         'query-replace 'region)))))
  
  ;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
  ;;; replace.el ends here
--- 1576,1613 ----
                 (if (= replace-count 1) "" "s")))
      (and keep-going stack)))
  
! (defcustom query-replace-highlight
!   (if (and search-highlight isearch-lazy-highlight) 'isearch t)
!   "*Non-nil means to highlight words during query replacement.
! If `isearch', use isearch highlighting for query replacement."
!   :type '(choice (const :tag "Highlight" t)
!                  (const :tag "No highlighting" nil)
!                  (const :tag "Isearch highlighting" 'isearch))
    :group 'matching)
  
  (defvar replace-overlay nil)
  
  (defun replace-dehighlight ()
!   (cond ((eq query-replace-highlight 'isearch)
!        (isearch-dehighlight t)
!        (isearch-lazy-highlight-cleanup isearch-lazy-highlight-cleanup)
!        (setq isearch-lazy-highlight-last-string nil))
!       (query-replace-highlight
!        (when replace-overlay
!          (delete-overlay replace-overlay)
!          (setq replace-overlay nil)))))
  
  (defun replace-highlight (start end)
!   (cond ((eq query-replace-highlight 'isearch)
!        (isearch-highlight start end)
!        (isearch-lazy-highlight-new-loop))
!       (query-replace-highlight
!        (if replace-overlay
!            (move-overlay replace-overlay start end (current-buffer))
!          (setq replace-overlay (make-overlay start end))
!          (overlay-put replace-overlay 'face
!                       (if (facep 'query-replace)
!                           'query-replace 'region))))))
  
  ;; arch-tag: 16b4cd61-fd40-497b-b86f-b667c4cf88e4
  ;;; replace.el ends here




reply via email to

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