GNU bug report logs - #4313
23.1; save-excursion and goto-char fail

Previous Next

Package: emacs;

Reported by: RSridhar <rsridar50 <at> dataone.in>

Date: Wed, 2 Sep 2009 10:15:09 UTC

Severity: normal

Merged with 4312, 4314

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


Message #12 received at 4313 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: RSridhar <rsridar50 <at> dataone.in>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 4313 <at> debbugs.gnu.org
Subject: Re: bug#4312: 23.1;  save-excursion and goto-char fail
Date: Fri, 04 Sep 2009 23:08:20 +0530
[Message part 1 (text/plain, inline)]
hi ..
This code I have been using for long and worked well in previous
version.
i.e, Emacs 22..... 
and since I loaded Fedora 11 and from their repository  emacs 23.1 
many of my lisp codes malfunction.

The loaded file contains utf-8 codes of devanagari ( indian root
language).
The simplest code that failed
(defun temay()
   "Temporary script to xltn itrans files and revert buffer"
   (interactive)
   (setq pos (point))
;;or (save excursion) 
   ;;(message "point set %d" pos)
   (save-restriction
     (widen)
     (save-buffer)
     (setq localvar ( concat "xltn -f " (buffer-file-name)))
     (shell-command localvar)
     (revert-buffer nil t nil))
   ;;(message "point set %d" pos)
   ;;(message "point returned %d" (goto-char pos))
   (goto-char pos)
)

-- 
RSridhar <rsridar50 <at> dataone.in>


On Thu, 2009-09-03 at 18:33 +0200, Andreas Schwab wrote:

> Stefan Monnier <monnier <at> 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.
> 
[Message part 2 (text/html, inline)]

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.