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: Mon, 24 Feb 2003 11:45:48 -0500

Index: emacs/lisp/replace.el
diff -c emacs/lisp/replace.el:1.163 emacs/lisp/replace.el:1.164
*** emacs/lisp/replace.el:1.163 Tue Feb  4 07:00:39 2003
--- emacs/lisp/replace.el       Mon Feb 24 11:45:47 2003
***************
*** 87,95 ****
      (setq to (read-from-minibuffer (format "%s %s with: " string from)
                                   nil nil nil
                                   query-replace-to-history-variable from t))
!     (if (and transient-mark-mode mark-active)
!       (list from to current-prefix-arg (region-beginning) (region-end))
!       (list from to current-prefix-arg nil nil))))
  
  (defun query-replace (from-string to-string &optional delimited start end)
    "Replace some occurrences of FROM-STRING with TO-STRING.
--- 87,93 ----
      (setq to (read-from-minibuffer (format "%s %s with: " string from)
                                   nil nil nil
                                   query-replace-to-history-variable from t))
!     (list from to current-prefix-arg)))
  
  (defun query-replace (from-string to-string &optional delimited start end)
    "Replace some occurrences of FROM-STRING with TO-STRING.
***************
*** 116,122 ****
  Fourth and fifth arg START and END specify the region to operate on.
  
  To customize possible responses, change the \"bindings\" in 
`query-replace-map'."
!   (interactive (query-replace-read-args "Query replace" nil))
    (perform-replace from-string to-string t nil delimited nil nil start end))
  
  (define-key esc-map "%" 'query-replace)
--- 114,129 ----
  Fourth and fifth arg START and END specify the region to operate on.
  
  To customize possible responses, change the \"bindings\" in 
`query-replace-map'."
!   (interactive (let ((common
!                     (query-replace-read-args "Query replace" nil)))
!                (list (nth 0 common) (nth 1 common) (nth 2 common)
!                      ;; These are done separately here
!                      ;; so that command-history will record these expressions
!                      ;; rather than the values they had this time.
!                      (if (and transient-mark-mode mark-active)
!                          (region-beginning))
!                      (if (and transient-mark-mode mark-active)
!                          (region-end)))))
    (perform-replace from-string to-string t nil delimited nil nil start end))
  
  (define-key esc-map "%" 'query-replace)
***************
*** 148,154 ****
  In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP,
  and `\\=\\N' (where N is a digit) stands for
   whatever what matched the Nth `\\(...\\)' in REGEXP."
!   (interactive (query-replace-read-args "Query replace regexp" t))
    (perform-replace regexp to-string t t delimited nil nil start end))
  (define-key esc-map [?\C-%] 'query-replace-regexp)
  
--- 155,172 ----
  In TO-STRING, `\\&' stands for whatever matched the whole of REGEXP,
  and `\\=\\N' (where N is a digit) stands for
   whatever what matched the Nth `\\(...\\)' in REGEXP."
!   (interactive
!    (let ((common
!         (query-replace-read-args "Query replace regexp" t)))
!      (list (nth 0 common) (nth 1 common) (nth 2 common)
!          ;; These are done separately here
!          ;; so that command-history will record these expressions
!          ;; rather than the values they had this time.
!          (if (and transient-mark-mode mark-active)
!              (region-beginning))
!          (if (and transient-mark-mode mark-active)
!              (region-end)))))
! 
    (perform-replace regexp to-string t t delimited nil nil start end))
  (define-key esc-map [?\C-%] 'query-replace-regexp)
  
***************
*** 181,190 ****
  only matches that are surrounded by word boundaries.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to start end)
!      (when (and transient-mark-mode mark-active)
!        (setq start (region-beginning)
!            end (region-end)))
       (if query-replace-interactive
           (setq from (car regexp-search-ring))
         (setq from (read-from-minibuffer "Query replace regexp: "
--- 199,205 ----
  only matches that are surrounded by word boundaries.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to)
       (if query-replace-interactive
           (setq from (car regexp-search-ring))
         (setq from (read-from-minibuffer "Query replace regexp: "
***************
*** 197,203 ****
       ;; We make TO a list because replace-match-string-symbols requires one,
       ;; and the user might enter a single token.
       (replace-match-string-symbols to)
!      (list from (car to) current-prefix-arg start end)))
    (perform-replace regexp (cons 'replace-eval-replacement to-expr)
                   t t delimited nil nil start end))
  
--- 212,222 ----
       ;; We make TO a list because replace-match-string-symbols requires one,
       ;; and the user might enter a single token.
       (replace-match-string-symbols to)
!      (list from (car to) current-prefix-arg
!          (if (and transient-mark-mode mark-active)
!              (region-beginning))
!          (if (and transient-mark-mode mark-active)
!              (region-end)))))
    (perform-replace regexp (cons 'replace-eval-replacement to-expr)
                   t t delimited nil nil start end))
  
***************
*** 222,231 ****
  before rotating to the next.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to start end)
!      (when (and transient-mark-mode mark-active)
!        (setq start (region-beginning)
!            end (region-end)))
       (setq from (if query-replace-interactive
                    (car regexp-search-ring)
                  (read-from-minibuffer "Map query replace (regexp): "
--- 241,247 ----
  before rotating to the next.
  Fourth and fifth arg START and END specify the region to operate on."
    (interactive
!    (let (from to)
       (setq from (if query-replace-interactive
                    (car regexp-search-ring)
                  (read-from-minibuffer "Map query replace (regexp): "
***************
*** 236,242 ****
                       from)
               nil nil nil
               'query-replace-history from t))
!      (list from to start end current-prefix-arg)))
    (let (replacements)
      (if (listp to-strings)
        (setq replacements to-strings)
--- 252,262 ----
                       from)
               nil nil nil
               'query-replace-history from t))
!      (list from to current-prefix-arg
!          (if (and transient-mark-mode mark-active)
!              (region-beginning))
!          (if (and transient-mark-mode mark-active)
!              (region-end)))))
    (let (replacements)
      (if (listp to-strings)
        (setq replacements to-strings)
***************
*** 277,283 ****
  which will run faster and will not set the mark or print anything.
  \(You may need a more complex loop if FROM-STRING can match the null string
  and TO-STRING is also null.)"
!   (interactive (query-replace-read-args "Replace string" nil))
    (perform-replace from-string to-string nil nil delimited nil nil start end))
  
  (defun replace-regexp (regexp to-string &optional delimited start end)
--- 297,310 ----
  which will run faster and will not set the mark or print anything.
  \(You may need a more complex loop if FROM-STRING can match the null string
  and TO-STRING is also null.)"
!   (interactive
!    (let ((common
!         (query-replace-read-args "Replace string" nil)))
!      (list (nth 0 common) (nth 1 common) (nth 2 common)
!          (if (and transient-mark-mode mark-active)
!              (region-beginning))
!          (if (and transient-mark-mode mark-active)
!              (region-end)))))
    (perform-replace from-string to-string nil nil delimited nil nil start end))
  
  (defun replace-regexp (regexp to-string &optional delimited start end)
***************
*** 304,310 ****
    (while (re-search-forward REGEXP nil t)
      (replace-match TO-STRING nil nil))
  which will run faster and will not set the mark or print anything."
!   (interactive (query-replace-read-args "Replace regexp" t))
    (perform-replace regexp to-string nil t delimited nil nil start end))
  
  
--- 331,344 ----
    (while (re-search-forward REGEXP nil t)
      (replace-match TO-STRING nil nil))
  which will run faster and will not set the mark or print anything."
!   (interactive
!    (let ((common
!         (query-replace-read-args "Replace regexp" t)))
!      (list (nth 0 common) (nth 1 common) (nth 2 common)
!          (if (and transient-mark-mode mark-active)
!              (region-beginning))
!          (if (and transient-mark-mode mark-active)
!              (region-end)))))
    (perform-replace regexp to-string nil t delimited nil nil start end))
  
  




reply via email to

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