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

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

bug#4313: bug#4312: 23.1; save-excursion and goto-char fail


From: RSridhar
Subject: bug#4313: bug#4312: 23.1; save-excursion and goto-char fail
Date: Fri, 04 Sep 2009 23:08:20 +0530

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@dataone.in>


On Thu, 2009-09-03 at 18:33 +0200, Andreas Schwab wrote:
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.


reply via email to

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