emacs-devel
[Top][All Lists]
Advanced

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

address@hidden: replace-regexp at end of buffer]


From: Richard Stallman
Subject: address@hidden: replace-regexp at end of buffer]
Date: Mon, 26 Feb 2007 03:47:59 -0500

Would someone please check that this is correct,
and if so install it and ack?

------- Start of forwarded message -------
From: address@hidden (Johan =?utf-8?Q?Bockg=C3=A5rd?=)
To: address@hidden
Date: Thu, 22 Feb 2007 19:57:57 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Subject: replace-regexp at end of buffer
X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed 
        version=3.0.4


replace-regexp/perform-replace wrongly moves back a character when the
match is at end of buffer.

Run

   (perform-replace "abc" "123" nil t nil)

on a buffer that ends in "abc" (no final newline).

Point ends up between 2 and 3.

This is because point could not move too far in this case, and so the
following correction shouldn't be done [perform-replace]:

   ;; The code preventing adjacent regexp matches in the condition
   ;; of the while-loop above will haven taken us one character
   ;; beyond the last replacement.  Undo that.
   (when (and regexp-flag (not match-again) (> replace-count 0))
     (backward-char 1))


- -- 
Johan Bockgård


_______________________________________________
emacs-pretest-bug mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------




reply via email to

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