unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4312: 23.1;  save-excursion and goto-char fail
@ 2009-09-02 10:03 ` RSridhar
  2009-09-03 13:51   ` Stefan Monnier
       [not found]   ` <handler.4314.C.12528066171101.notifdonectrl.2@emacsbugs.donarmstrong.com>
  0 siblings, 2 replies; 7+ messages in thread
From: RSridhar @ 2009-09-02 10:03 UTC (permalink / raw)
  To: bug-gnu-emacs


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








^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#4312: 23.1;  save-excursion and goto-char fail
  2009-09-02 10:03 ` bug#4312: 23.1; save-excursion and goto-char fail RSridhar
@ 2009-09-03 13:51   ` Stefan Monnier
  2009-09-03 16:33     ` Andreas Schwab
       [not found]   ` <handler.4314.C.12528066171101.notifdonectrl.2@emacsbugs.donarmstrong.com>
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2009-09-03 13:51 UTC (permalink / raw)
  To: RSridhar; +Cc: 4312, bug-gnu-emacs

> 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






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#4312: 23.1;  save-excursion and goto-char fail
  2009-09-03 13:51   ` Stefan Monnier
@ 2009-09-03 16:33     ` Andreas Schwab
  2009-09-04 17:38       ` bug#4313: " RSridhar
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2009-09-03 16:33 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 4312, bug-gnu-emacs, RSridhar

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.

-- 
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."






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#4313: bug#4312: 23.1;  save-excursion and goto-char fail
  2009-09-03 16:33     ` Andreas Schwab
@ 2009-09-04 17:38       ` RSridhar
  0 siblings, 0 replies; 7+ messages in thread
From: RSridhar @ 2009-09-04 17:38 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 4313

[-- Attachment #1: Type: text/plain, Size: 1689 bytes --]

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.
> 

[-- Attachment #2: Type: text/html, Size: 2506 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Processed: close 4312
       [not found] <87ws43boia.fsf@cyd.mit.edu>
  2009-09-02 10:03 ` bug#4312: 23.1; save-excursion and goto-char fail RSridhar
@ 2009-09-13  1:55 ` Emacs bug Tracking System
  1 sibling, 0 replies; 7+ messages in thread
From: Emacs bug Tracking System @ 2009-09-13  1:55 UTC (permalink / raw)
  To: Chong Yidong
  Cc: bug 4313 done for {4313}, bug 4312 done for {4312}, bug 4314 done for {4314},
	Emacs Bugs

Processing commands for control@emacsbugs.donarmstrong.com:

> close 4312
bug#4312: 23.1;  save-excursion and goto-char fail
'close' is deprecated; see http://emacsbugs.donarmstrong.com/Developer.html#closing.
bug#4313: 23.1;  save-excursion and goto-char fail
bug#4314: 23.1;  save-excursion and goto-char fail
bug closed, send any further explanations to RSridhar <rsridar50@dataone.in>

> thanks
Stopping processing here.

Please contact me if you need assistance.

Don Armstrong
(administrator, Emacs bugs database)




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#4314: acknowledged by developer         (close 4312)
       [not found]   ` <handler.4314.C.12528066171101.notifdonectrl.2@emacsbugs.donarmstrong.com>
@ 2009-09-22 16:28     ` RSridhar
  2009-09-22 16:30       ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: RSridhar @ 2009-09-22 16:28 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 4314

Re the bug 
that I was expecting some communication from you 
since it is closed by you. Could you please enlighten me on the status.
 
-- 
RSridhar <rsridar50@dataone.in>


On Sat, 2009-09-12 at 18:55 -0700, Emacs bug Tracking System wrote:
> Chong Yidong <cyd@stupidchicken.com>.






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#4314: acknowledged by developer         (close 4312)
  2009-09-22 16:28     ` bug#4314: acknowledged by developer (close 4312) RSridhar
@ 2009-09-22 16:30       ` Chong Yidong
  0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2009-09-22 16:30 UTC (permalink / raw)
  To: RSridhar; +Cc: 4314

RSridhar <rsridar50@dataone.in> writes:

> Re the bug that I was expecting some communication from you since it
> is closed by you. Could you please enlighten me on the status.

Did you not get the replies at

http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4312





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-09-22 16:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87ws43boia.fsf@cyd.mit.edu>
2009-09-02 10:03 ` bug#4312: 23.1; save-excursion and goto-char fail RSridhar
2009-09-03 13:51   ` Stefan Monnier
2009-09-03 16:33     ` Andreas Schwab
2009-09-04 17:38       ` bug#4313: " RSridhar
     [not found]   ` <handler.4314.C.12528066171101.notifdonectrl.2@emacsbugs.donarmstrong.com>
2009-09-22 16:28     ` bug#4314: acknowledged by developer (close 4312) RSridhar
2009-09-22 16:30       ` Chong Yidong
2009-09-13  1:55 ` Processed: close 4312 Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).