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


Message #33 received at 13122 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 13122 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#13122: save-excursion not saving point
Date: Sat, 27 Apr 2019 16:44:52 +0900 (JST)

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.

The reason why I shared the above snippet is because Chong applied a patch
(commit: aa26f345096166bd8c135876dbab9b671ae232e3)
to fix the original recipe:
a call to `traspose-chars' inside a `save-excursion' moving the 
point if the argument is n != 1.

> Why did you think it should evaluate to non-nil?  The ELisp manual has
> a warning near the end of description of save-excursion; I think it's
> relevant to this use case.




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.