From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: RSridhar Newsgroups: gmane.emacs.bugs Subject: bug#4313: bug#4312: 23.1; save-excursion and goto-char fail Date: Fri, 04 Sep 2009 23:08:20 +0530 Message-ID: <1252085900.3362.11.camel@www.x-shriman.com> References: <1251885785.3373.3.camel@www.x-shriman.com> Reply-To: RSridhar , 4313@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="Boundary_(ID_RB70uf5QmageHVYJx8OYGg)" X-Trace: ger.gmane.org 1252086757 24517 80.91.229.12 (4 Sep 2009 17:52:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2009 17:52:37 +0000 (UTC) Cc: 4313@emacsbugs.donarmstrong.com To: Andreas Schwab Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 04 19:52:29 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MjcxW-0002of-Et for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Sep 2009 19:52:26 +0200 Original-Received: from localhost ([127.0.0.1]:38962 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjcxV-0002pZ-RG for geb-bug-gnu-emacs@m.gmane.org; Fri, 04 Sep 2009 13:52:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjcsN-0008Mq-Oo for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 13:47:07 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjcsJ-0008Kn-BZ for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 13:47:07 -0400 Original-Received: from [199.232.76.173] (port=44129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjcsJ-0008KZ-4p for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 13:47:03 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:53008) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MjcsI-0003uQ-KL for bug-gnu-emacs@gnu.org; Fri, 04 Sep 2009 13:47:02 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n84HkwTq027210; Fri, 4 Sep 2009 10:46:59 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n84Hj4vO026792; Fri, 4 Sep 2009 10:45:04 -0700 Resent-Date: Fri, 4 Sep 2009 10:45:04 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: RSridhar Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Fri, 04 Sep 2009 17:45:04 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 4313 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 4313-submit@emacsbugs.donarmstrong.com id=B4313.125208591325677 (code B ref 4313); Fri, 04 Sep 2009 17:45:04 +0000 Original-Received: (at 4313) by emacsbugs.donarmstrong.com; 4 Sep 2009 17:38:33 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from ndabbmr1.dataone.in (ndabbmr1-a-fixed.dataone.in [218.248.240.99]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n84HcVFT025664 for <4313@emacsbugs.donarmstrong.com>; Fri, 4 Sep 2009 10:38:33 -0700 Original-Received: from conversion-daemon.ndabbmr1.dataone.in by ndabbmr1.dataone.in (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0KPG00801JDOLN00@ndabbmr1.dataone.in> (original mail from rsridar50@dataone.in) for 4313@emacsbugs.donarmstrong.com; Fri, 04 Sep 2009 23:08:20 +0530 (IST) Original-Received: from [192.168.1.2] ([59.92.26.6]) by ndabbmr1.dataone.in (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KPG00GP8JNHEQJ0@ndabbmr1.dataone.in>; Fri, 04 Sep 2009 23:08:19 +0530 (IST) In-reply-to: X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Fri, 04 Sep 2009 13:47:07 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:30801 Archived-At: --Boundary_(ID_RB70uf5QmageHVYJx8OYGg) Content-type: text/plain Content-transfer-encoding: 7BIT 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. > --Boundary_(ID_RB70uf5QmageHVYJx8OYGg) Content-type: text/html; charset=utf-8 Content-transfer-encoding: 7BIT 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.

--Boundary_(ID_RB70uf5QmageHVYJx8OYGg)--