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 [emacs-unicode-2]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/replace.el [emacs-unicode-2]
Date: Mon, 02 Aug 2004 20:25:18 -0400

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.165.4.7 emacs/lisp/replace.el:1.165.4.8
*** emacs/lisp/replace.el:1.165.4.7     Wed Jul 28 07:05:50 2004
--- emacs/lisp/replace.el       Tue Aug  3 00:02:59 2004
***************
*** 94,100 ****
               query-replace-from-history-variable
               nil t))))
        (if (and (zerop (length from)) lastto lastfrom)
!         (cons lastfrom lastto)
        ;; Warn if user types \n or \t, but don't reject the input.
        (and regexp-flag
             (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" 
from)
--- 94,101 ----
               query-replace-from-history-variable
               nil t))))
        (if (and (zerop (length from)) lastto lastfrom)
!         (cons lastfrom
!               (query-replace-compile-replacement lastto regexp-flag))
        ;; Warn if user types \n or \t, but don't reject the input.
        (and regexp-flag
             (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\(\\\\[nt]\\)" 
from)
***************
*** 107,121 ****
               (sit-for 2)))
        from))))
  
! (defun query-replace-read-to (from string regexp-flag)
!   "Query and return the `from' argument of a query-replace operation."
!   (let ((to (save-excursion
!             (read-from-minibuffer
!              (format "%s %s with: " string (query-replace-descr from))
!              nil nil nil
!              query-replace-to-history-variable from t))))
!     (when (and regexp-flag
!              (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))
        (let (pos list char)
        (while
            (progn
--- 108,119 ----
               (sit-for 2)))
        from))))
  
! (defun query-replace-compile-replacement (to regexp-flag)
!   "Maybe convert a regexp replacement TO to Lisp.
! Returns a list suitable for `perform-replace' if necessary,
! the original string if not."
!   (if (and regexp-flag
!          (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to))
        (let (pos list char)
        (while
            (progn
***************
*** 142,155 ****
                              (cdr pos))))
                       (setq to (substring to end)))))
              (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
!       (setq to (nreverse (delete "" (cons to list)))))
!       (replace-match-string-symbols to)
!       (setq to (cons 'replace-eval-replacement
!                    (if (> (length to) 1)
!                        (cons 'concat to)
!                      (car to)))))
      to))
  
  (defun query-replace-read-args (string regexp-flag &optional noerror)
    (unless noerror
      (barf-if-buffer-read-only))
--- 140,164 ----
                              (cdr pos))))
                       (setq to (substring to end)))))
              (string-match "\\(\\`\\|[^\\]\\)\\(\\\\\\\\\\)*\\\\[,#]" to)))
!       (setq to (nreverse (delete "" (cons to list))))
!       (replace-match-string-symbols to)
!       (cons 'replace-eval-replacement
!             (if (cdr to)
!                 (cons 'concat to)
!               (car to))))
      to))
  
+ 
+ (defun query-replace-read-to (from string regexp-flag)
+   "Query and return the `to' argument of a query-replace operation."
+   (query-replace-compile-replacement
+    (save-excursion
+      (read-from-minibuffer
+       (format "%s %s with: " string (query-replace-descr from))
+       nil nil nil
+       query-replace-to-history-variable from t))
+    regexp-flag))
+ 
  (defun query-replace-read-args (string regexp-flag &optional noerror)
    (unless noerror
      (barf-if-buffer-read-only))




reply via email to

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