bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: NEWS entry for perform-replace is incorrect


From: Gerd Moellmann
Subject: Re: NEWS entry for perform-replace is incorrect
Date: 24 Oct 2001 14:41:26 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

Hannu Koivisto <azure@iki.fi> writes:

> That is, START and END are not optional.  This also means that this
> is an incompatible Lisp change 

Yes, that's an inadvertent incompatibility, and thus I think a bug.
This patch below should fix it.  Thanks, Hannu.

*** replace.el  2001/10/24 12:23:33     1.120
--- replace.el  2001/10/24 12:27:00
***************
*** 95,101 ****
  
  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 start end t nil delimited))
  
  (define-key esc-map "%" 'query-replace)
  
--- 95,101 ----
  
  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)
  
***************
*** 122,128 ****
  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 start end t t delimited))
  (define-key esc-map [?\C-%] 'query-replace-regexp)
  
  (defun query-replace-regexp-eval (regexp to-expr &optional delimited start 
end)
--- 122,128 ----
  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)
  
  (defun query-replace-regexp-eval (regexp to-expr &optional delimited start 
end)
***************
*** 172,178 ****
       (replace-match-string-symbols to)
       (list from (car to) current-prefix-arg start end)))
    (perform-replace regexp (cons 'replace-eval-replacement to-expr)
!                  start end t t delimited))
  
  (defun map-query-replace-regexp (regexp to-strings &optional n start end)
    "Replace some matches for REGEXP with various strings, in rotation.
--- 172,178 ----
       (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))
  
  (defun map-query-replace-regexp (regexp to-strings &optional n start end)
    "Replace some matches for REGEXP with various strings, in rotation.
***************
*** 223,229 ****
                                       (1+ (string-match " " to-strings))))
          (setq replacements (append replacements (list to-strings))
                to-strings ""))))
!     (perform-replace regexp replacements start end t t nil n)))
  
  (defun replace-string (from-string to-string &optional delimited start end)
    "Replace occurrences of FROM-STRING with TO-STRING.
--- 223,229 ----
                                       (1+ (string-match " " to-strings))))
          (setq replacements (append replacements (list to-strings))
                to-strings ""))))
!     (perform-replace regexp replacements t t nil n nil start end)))
  
  (defun replace-string (from-string to-string &optional delimited start end)
    "Replace occurrences of FROM-STRING with TO-STRING.
***************
*** 251,257 ****
  \(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 start end nil nil delimited))
  
  (defun replace-regexp (regexp to-string &optional delimited start end)
    "Replace things after point matching REGEXP with TO-STRING.
--- 251,257 ----
  \(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)
    "Replace things after point matching REGEXP with TO-STRING.
***************
*** 278,284 ****
      (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 start end nil t delimited))
  
  
  (defvar regexp-history nil
--- 278,284 ----
      (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))
  
  
  (defvar regexp-history nil
***************
*** 870,878 ****
            (aset data 2 (if (consp next) next (aref data 3))))))
    (car (aref data 2)))
  
! (defun perform-replace (from-string replacements start end
                        query-flag regexp-flag delimited-flag
!                       &optional repeat-count map)
    "Subroutine of `query-replace'.  Its complexity handles interactive queries.
  Don't use this in your own program unless you want to query and set the mark
  just as `query-replace' does.  Instead, write a simple loop like this:
--- 870,878 ----
            (aset data 2 (if (consp next) next (aref data 3))))))
    (car (aref data 2)))
  
! (defun perform-replace (from-string replacements 
                        query-flag regexp-flag delimited-flag
!                       &optional repeat-count map start end)
    "Subroutine of `query-replace'.  Its complexity handles interactive queries.
  Don't use this in your own program unless you want to query and set the mark
  just as `query-replace' does.  Instead, write a simple loop like this:
Index: etags.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/etags.el,v
retrieving revision 1.155
diff -c -c -r1.155 etags.el
*** etags.el    2001/05/31 14:33:15     1.155
--- etags.el    2001/10/24 12:31:55
***************
*** 1743,1749 ****
                                   ;; will see it.
                                   '(goto-char (match-beginning 0))))
        tags-loop-operate (list 'perform-replace
!                               (list 'quote from) (list 'quote to) nil nil
                                t t (list 'quote delimited)))
    (tags-loop-continue (or file-list-form t)))
  
--- 1743,1749 ----
                                   ;; will see it.
                                   '(goto-char (match-beginning 0))))
        tags-loop-operate (list 'perform-replace
!                               (list 'quote from) (list 'quote to)
                                t t (list 'quote delimited)))
    (tags-loop-continue (or file-list-form t)))
  
*** ebrowse.el  2001/10/24 12:28:15     1.10
--- ebrowse.el  2001/10/24 12:28:58
***************
*** 3818,3824 ****
    (setq ebrowse-tags-loop-form
        (list 'and (list 'save-excursion
                         (list 're-search-forward from nil t))
!             (list 'not (list 'perform-replace from to nil nil t t nil))))
    (ebrowse-tags-loop-continue 'first-time))
  
  
--- 3818,3824 ----
    (setq ebrowse-tags-loop-form
        (list 'and (list 'save-excursion
                         (list 're-search-forward from nil t))
!             (list 'not (list 'perform-replace from to t t nil))))
    (ebrowse-tags-loop-continue 'first-time))
  
  



reply via email to

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