[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13122: save-excursion not saving point
From: |
martin rudalics |
Subject: |
bug#13122: save-excursion not saving point |
Date: |
Sat, 08 Dec 2012 12:21:08 +0100 |
> 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.
This is a limitation (or bug) in the code of `transpose-subr' and
`transpose-subr-1' due to the use of `delete-and-extract-region' (IIRC
transposing mangles `undo' as well.)
martin