all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* save-excursion doesn't restore point
@ 2006-01-24 17:12 Dominic Mitchell
  2006-01-26  2:47 ` Richard M. Stallman
  0 siblings, 1 reply; 2+ messages in thread
From: Dominic Mitchell @ 2006-01-24 17:12 UTC (permalink / raw)


This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.3.1 (i386--freebsd, X toolkit, Xaw3d scroll bars)
 of 2005-12-09 on ppe.happygiraffe.net
configured using `configure  --x-libraries=/usr/X11R6/lib --x-includes=/usr/X11R6/include --prefix=/usr/local i386--freebsd'
Important settings:
  value of $LC_ALL: nil
  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: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I have this bit of code in my .emacs file:

(defun perltidy ()
  "Run perltidy on the current region or buffer."
  (interactive)
  (save-excursion
    (unless mark-active (mark-defun))
    (shell-command-on-region (point) (mark) "perltidy -q" nil t)))

If I run it from inside a Perl function (in cperl-mode), then the
point ends up _above_ the Perl function, instead of remembering where
it was.

I would guess that this is because save-excursion uses markers, and
those markers then get invalidated by shell-command-on-region.  But
it's still a little weird.  Is this a bug?

Thanks,
-Dom

Recent input:
ESC ? a b u g RET ESC x r e p o r t TAB RET

Recent messages:
Loading easy-mmode...done
Loading /usr/local/libexec/emacs/21.3/i386--freebsd/fns-21.3.1.el (source)...done
Loading executable...done
Loading haskell-site-file...done
For information about the GNU Project and its goals, type C-h C-p.
Loading view...done

Loading apropos...done
Type C-x 1 to remove help window.  C-M-v to scroll the help.
Loading emacsbug...done

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

* Re: save-excursion doesn't restore point
  2006-01-24 17:12 save-excursion doesn't restore point Dominic Mitchell
@ 2006-01-26  2:47 ` Richard M. Stallman
  0 siblings, 0 replies; 2+ messages in thread
From: Richard M. Stallman @ 2006-01-26  2:47 UTC (permalink / raw)
  Cc: bug-gnu-emacs

    I would guess that this is because save-excursion uses markers, and
    those markers then get invalidated by shell-command-on-region.

I think so.

								    But
    it's still a little weird.  Is this a bug?
    
I think it is simply inevitable.  If all the text is replaced,
Emacs has no way of knowing what new position corresponds in any sense
to some old position.

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

end of thread, other threads:[~2006-01-26  2:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-24 17:12 save-excursion doesn't restore point Dominic Mitchell
2006-01-26  2:47 ` Richard M. Stallman

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.