[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4312: 23.1; save-excursion and goto-char fail
From: |
Andreas Schwab |
Subject: |
bug#4312: 23.1; save-excursion and goto-char fail |
Date: |
Thu, 03 Sep 2009 18:33:01 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 1. I have a lisp code which saves file buffer and does some
>> manipulation on the file in shell. subsequently it is reverted.
>> However I have tried save-excursion before saving file which did not
>> restore the file position on reverting.
>
> save-excursion uses markers to remember the position. But markers only
> keep track of positions by keeping track of insertions/deletions and
> adjusting the position accordingly. When the changes happen outside
> Emacs, this doesn't work too well, because Emacs sees your revert-buffer
> as just one big delete&insert.
insert-file-contents tries to keep markers if possible, but that only
works if the marker points into the unchanged head or tail of the
replaced contents.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."