GNU bug report logs - #13122
transpose-subr defeats save-excursion

Previous Next

Package: emacs;

Reported by: Jyothis V <jyothisv <at> gmail.com>

Date: Sat, 8 Dec 2012 07:16:01 UTC

Severity: minor

Done: Chong Yidong <cyd <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 13122 <at> debbugs.gnu.org
Subject: bug#13122: save-excursion not saving point
Date: Sat, 27 Apr 2019 11:59:48 +0200
On Apr 27 2019, Tino Calancha <tino.calancha <at> gmail.com> wrote:

> On Sat, 27 Apr 2019, Eli Zaretskii wrote:
>
>>> From: Tino Calancha <tino.calancha <at> gmail.com>
>>> Date: Sat, 27 Apr 2019 04:53:56 +0900
>>>
>>> ;; Following expression should eval as non-nil
>>> (let ((pos 3))
>>>   (with-temp-buffer
>>>     (insert "abcdef")
>>>     (goto-char pos)
>>>     (save-excursion (transpose-chars 2))
>>>     (= pos (point))))
>>> => nil
>
> I read that warning; maybe getting `nil' is above is expected; if that's
> the case then we can close the report again.

Since the form inside save-excursion can modify the text before point,
there is never a guarantee that the numeric value of point stays the
same.  And if point points inside the modified text, it is generally
unspecified how point moves during the modification.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."




This bug report was last modified 6 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.