GNU bug report logs - #4312
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:07 UTC

Severity: normal

Merged with 4313, 4314

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4312 in the body.
You can then email your comments to 4312 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4312; Package emacs. (Wed, 02 Sep 2009 10:15:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to RSridhar <rsridar50 <at> dataone.in>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Wed, 02 Sep 2009 10:15:07 GMT) Full text and rfc822 format available.

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

From: RSridhar <rsridar50 <at> dataone.in>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1;  save-excursion and goto-char fail
Date: Wed, 02 Sep 2009 15:33:05 +0530
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:
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <menu-bar> 
<help-menu> <send-emacs-bug-report>

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 <rsridar50 <at> dataone.in>






Merged 4312 4313 4314. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 02 Sep 2009 23:50:08 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4312; Package emacs. (Thu, 03 Sep 2009 15:35:17 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 03 Sep 2009 15:35:18 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: RSridhar <rsridar50 <at> dataone.in>
Cc: 4312 <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org
Subject: Re: bug#4312: 23.1;  save-excursion and goto-char fail
Date: Thu, 03 Sep 2009 09:51:04 -0400
> 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





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4312; Package emacs. (Thu, 03 Sep 2009 15:35:25 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 03 Sep 2009 15:35:26 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4312; Package emacs. (Thu, 03 Sep 2009 16:40:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 03 Sep 2009 16:40:06 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4312 <at> debbugs.gnu.org, RSridhar <rsridar50 <at> dataone.in>,
        bug-gnu-emacs <at> gnu.org
Subject: Re: bug#4312: 23.1;  save-excursion and goto-char fail
Date: Thu, 03 Sep 2009 18:33:01 +0200
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.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4312; Package emacs. (Thu, 03 Sep 2009 16:40:10 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andreas Schwab <schwab <at> linux-m68k.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 03 Sep 2009 16:40:11 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to RSridhar <rsridar50 <at> dataone.in> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 13 Sep 2009 01:55:06 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 21 Oct 2009 14:24:11 GMT) Full text and rfc822 format available.

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.