GNU bug report logs -
#4312
23.1; save-excursion and goto-char fail
Previous Next
Reported by: RSridhar <rsridar50 <at> dataone.in>
Date: Wed, 2 Sep 2009 10:15:07 UTC
Severity: normal
Merged with 4313,
4314
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> 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.
> So I tried setq point to some var and after reverting restore point
> with goto-char. Thi s also did not ork in restoring previous position
> although (point) function did return the correct value from the
> goto-char function in lisp.
This should "work" in the sense that it will keep point at the same
numerical position (same distance from the beginning of the file, when
counted in chars). But it may very well not be pointing at the same
conceptual place in the file if you've added/removed content.
Maybe you should use bookmarks for that: bookmarks remember the position
together with the context (the text immediately before and after point),
so as to be able to find the "same spot" again, even if it moved in
the file.
> 3. re-search-forward function fails regular expression with octal code
IIRC, we already have a bug report about that (bug#3822). But no
I haven't had time to look at it yet.
Stefan
This bug report was last modified 15 years and 304 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.