From unknown Mon Aug 18 08:52:55 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#4312 <4312@debbugs.gnu.org> To: bug#4312 <4312@debbugs.gnu.org> Subject: Status: 23.1; save-excursion and goto-char fail Reply-To: bug#4312 <4312@debbugs.gnu.org> Date: Mon, 18 Aug 2025 15:52:55 +0000 retitle 4312 23.1; save-excursion and goto-char fail reassign 4312 emacs submitter 4312 RSridhar severity 4312 normal thanks From rsridar50@dataone.in Wed Sep 2 03:07:23 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 2 Sep 2009 10:07:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: *** X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=3.1 required=4.0 tests=FOURLA,RCVD_IN_SBLXBL, RCVD_IN_SBLXBL_CBL autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n82A7Lt7012803 for ; Wed, 2 Sep 2009 03:07:23 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MimkK-0000bd-IL for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 06:07:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MimkF-0000X5-DC for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 06:07:20 -0400 Received: from [199.232.76.173] (port=51255 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MimkF-0000Wh-36 for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 06:07:15 -0400 Received: from ndabbmr1-a-fixed.dataone.in ([218.248.240.99]:47529 helo=ndabbmr1.dataone.in) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MimkC-0005HE-MG for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 06:07:13 -0400 Disposition-notification-to: rsridar50@dataone.in 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 <0KPC009018KRTE00@ndabbmr1.dataone.in> (original mail from rsridar50@dataone.in) for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 15:36:43 +0530 (IST) Received: from [192.168.1.2] ([59.92.2.245]) by ndabbmr1.dataone.in (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0KPC00GG39DI7BM0@ndabbmr1.dataone.in> for bug-gnu-emacs@gnu.org; Wed, 02 Sep 2009 15:36:10 +0530 (IST) Date: Wed, 02 Sep 2009 15:33:05 +0530 From: RSridhar Subject: 23.1; save-excursion and goto-char fail To: bug-gnu-emacs@gnu.org Message-id: <1251885785.3373.3.camel@www.x-shriman.com> MIME-version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Content-type: text/plain Content-transfer-encoding: 7BIT X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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. So I tr ied 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. 2. The file manipulated contains utf-8 chars. Every now and then octal values di splay as language text but most of the time only octal utf-8 chars are displayed . Also the devanaagari font that is displayed incorrectly when it is displayed.. . The (itrans) short i is to be to the left of the consonant but gets associated with the right consonant. 3. re-search-forward function fails regular expression with octal code In GNU Emacs 23.1.1 (i386-redhat-linux-gnu, GTK+ Version 2.16.5) of 2009-08-26 on x86-2.fedora.phx.redhat.com Windowing system distributor `The X.Org Foundation', version 11.0.10602000 configured using `configure '--build=i386-redhat-linux-gnu' '--host=i386-redhat-linux-gnu' '--target=i586-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/var/lib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--with-dbus' '--with-gif' '--with-jpeg' '--with-png' '--with-rsvg' '--with-tiff' '--with-xft' '--with-xpm' '--with-x-toolkit=gtk' 'build_alias=i386-redhat-linux-gnu' 'host_alias=i386-redhat-linux-gnu' 'target_alias=i586-redhat-linux-gnu' 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables'' Important settings: value of $LC_ALL: C value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: nil default-enable-multibyte-characters: t Major mode: Lisp Interaction Minor modes in effect: show-paren-mode: t cua-mode: t tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: Recent messages: Loading /usr/share/emacs/site-lisp/site-start.d/focus-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/nxml-init.el (source)... Loading /usr/share/emacs/site-lisp/nxml-mode/rng-auto.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/nxml-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/php-mode-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/po-mode-init.el (source)...done Loading /usr/share/emacs/site-lisp/site-start.d/rpm-spec-mode-init.el (source)...done Loading cua-base...done Loading paren...done For information about GNU Emacs and the GNU system, type C-h C-a. -- RSridhar From rgm@gnu.org Wed Sep 2 16:35:02 2009 Received: (at control) by emacsbugs.donarmstrong.com; 2 Sep 2009 23:35:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.2 required=4.0 tests=AWL,ONEWORD autolearn=no version=3.2.5-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n82NZ1Pr016941 for ; Wed, 2 Sep 2009 16:35:02 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1MizLu-0003oR-S9; Wed, 02 Sep 2009 19:34:58 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19103.290.742312.708692@fencepost.gnu.org> Date: Wed, 2 Sep 2009 19:34:58 -0400 From: Glenn Morris To: control Subject: control merge 4312 4313 4314 reassign 4311 spam reassign 4315 spam reassign 4316 spam reassign 4317 spam reassign 4319 spam reassign 4322 notemacs From monnier@iro.umontreal.ca Thu Sep 3 08:28:48 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 3 Sep 2009 15:28:48 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.6 required=4.0 tests=AWL,FOURLA,HAS_BUG_NUMBER autolearn=unavailable version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n83DpJU6022461 for ; Thu, 3 Sep 2009 06:51:20 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjCic-0006Xc-V4 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 09:51:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjCiY-0006Wk-3C for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 09:51:18 -0400 Received: from [199.232.76.173] (port=50075 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjCiY-0006Vt-04 for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 09:51:14 -0400 Received: from mx20.gnu.org ([199.232.41.8]:34617) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MjCiW-0008U9-Ef for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 09:51:12 -0400 Received: from ironport2-out.pppoe.ca ([206.248.154.182] helo=ironport2-out.teksavvy.com) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjCiV-0005I7-GH for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 09:51:11 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoYFACBnn0rO+KL0/2dsb2JhbACBU9kbhBsFh3Q X-IronPort-AV: E=Sophos;i="4.44,325,1249272000"; d="scan'208";a="45078532" Received: from 206-248-162-244.dsl.teksavvy.com (HELO pastel.home) ([206.248.162.244]) by ironport2-out.teksavvy.com with ESMTP; 03 Sep 2009 09:49:52 -0400 Received: by pastel.home (Postfix, from userid 20848) id 5FB197F45; Thu, 3 Sep 2009 09:51:04 -0400 (EDT) From: Stefan Monnier To: RSridhar Cc: 4312@debbugs.gnu.org, bug-gnu-emacs@gnu.org Subject: Re: bug#4312: 23.1; save-excursion and goto-char fail Message-ID: References: <1251885785.3373.3.camel@www.x-shriman.com> Date: Thu, 03 Sep 2009 09:51:04 -0400 In-Reply-To: <1251885785.3373.3.camel@www.x-shriman.com> (RSridhar's message of "Wed, 02 Sep 2009 15:33:05 +0530") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Detected-Operating-System: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) > 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 From schwab@linux-m68k.org Thu Sep 3 09:33:34 2009 Received: (at submit) by emacsbugs.donarmstrong.com; 3 Sep 2009 16:33:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-3.0 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n83GXW99022004 for ; Thu, 3 Sep 2009 09:33:33 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MjFFc-0004EW-0S for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 12:33:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MjFFX-0004BT-Bv for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 12:33:31 -0400 Received: from [199.232.76.173] (port=50739 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MjFFX-0004BH-4K for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 12:33:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6994) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MjFFW-0006SX-0L for bug-gnu-emacs@gnu.org; Thu, 03 Sep 2009 12:33:26 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n83GX5Xe000858; Thu, 3 Sep 2009 12:33:05 -0400 Received: from hase.home (vpn-10-8.str.redhat.com [10.32.10.8]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n83GX2BC006284; Thu, 3 Sep 2009 12:33:03 -0400 From: Andreas Schwab To: Stefan Monnier Cc: 4312@debbugs.gnu.org, RSridhar , bug-gnu-emacs@gnu.org Subject: Re: bug#4312: 23.1; save-excursion and goto-char fail References: <1251885785.3373.3.camel@www.x-shriman.com> X-Yow: Sign my PETITION. Date: Thu, 03 Sep 2009 18:33:01 +0200 In-Reply-To: (Stefan Monnier's message of "Thu, 03 Sep 2009 09:51:04 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. 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. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From cyd@stupidchicken.com Sat Sep 12 18:50:16 2009 Received: (at control) by emacsbugs.donarmstrong.com; 13 Sep 2009 01:50:17 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.6 required=4.0 tests=AWL autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8D1oFvN001075 for ; Sat, 12 Sep 2009 18:50:16 -0700 Received: by cyd.mit.edu (Postfix, from userid 1000) id 8950057E259; Sat, 12 Sep 2009 21:51:41 -0400 (EDT) From: Chong Yidong To: control@debbugs.gnu.org Subject: close 4312 Date: Sat, 12 Sep 2009 21:51:41 -0400 Message-ID: <87ws43boia.fsf@cyd.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii close 4312 thanks From unknown Mon Aug 18 08:52:55 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 21 Oct 2009 14:24:11 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A long time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator