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