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

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

bug#13122: save-excursion not saving point


From: Tino Calancha
Subject: bug#13122: save-excursion not saving point
Date: Sat, 27 Apr 2019 04:53:56 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)


;; 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

In GNU Emacs 27.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2019-04-23 built on calancha-pc.dy.bbexcite.jp
Repository revision: 981470e3590534a4d2947dfe5626cae832c6502d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)


Jyothis V <address@hidden> writes:


> I wrote the following version of transpose-chars which is supposed to
> always transform the last two chars without moving the point.
> (defun gosmacs-tranpose-chars (n)
>   (interactive "p")
>   (save-excursion
>     (forward-char (- n))
>     (transpose-chars 1)))
>
> The trouble is, even though I have used save-excursion, the point does
> move 2 characters backwards when n=1! For other values of n, this seems to be 
> working fine.
>
> Regards,
> Jyothis V
>
> In GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.2)
>  of 2012-11-18 on eric
> Windowing system distributor `The X.Org Foundation', version 11.0.11300000





reply via email to

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