unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* save-excursion again
@ 2010-06-18  7:42 Uday S Reddy
  2010-06-18 13:51 ` Stefan Monnier
  2010-06-18 15:04 ` Davis Herring
  0 siblings, 2 replies; 22+ messages in thread
From: Uday S Reddy @ 2010-06-18  7:42 UTC (permalink / raw)
  To: emacs-devel

I am just catching up belatedly with this issue of save-excursion getting 
defeated by set-buffer.  Here is my understanding.  Please let me know if I am 
missing anything.  If I have a piece of code like this that runs in a buffer A:

      (save-excursion
         (set-buffer B)
         ....X....
      )

then:

- if the code X has no possibility of getting back to the buffer A and moving 
point, then save-excursion can be replaced by save-current-buffer (and the byte 
compiler gives you a brownie point).

- if the code X has a possibility of getting back to the buffer A and moving 
around, then save-excursion should stay (despite getting smacked by the byte 
compiler).

So, every time we want to please the byte compiler, we need to prove a little 
theorem to the effect that the code X doesn't enter the buffer A?  (No doubt 
some of these theorems will be obvious.)

Cheers,
Uday






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

end of thread, other threads:[~2010-07-04 17:08 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-18  7:42 save-excursion again Uday S Reddy
2010-06-18 13:51 ` Stefan Monnier
2010-06-18 14:02   ` David Kastrup
2010-06-18 15:29     ` Stefan Monnier
2010-06-18 17:16   ` Uday S Reddy
2010-06-18 18:37     ` Stefan Monnier
2010-06-19 14:50     ` Stephen J. Turnbull
2010-06-19 14:56       ` Lennart Borgman
2010-06-19 14:58         ` Lennart Borgman
2010-06-19 17:23           ` Stephen J. Turnbull
2010-06-19 17:30             ` Lennart Borgman
2010-06-25 21:20             ` Stefan Monnier
2010-06-26  0:40               ` Stephen J. Turnbull
2010-07-01  0:26                 ` Stefan Monnier
2010-07-01  4:34                   ` Stephen J. Turnbull
2010-07-04 17:07                     ` Stefan Monnier
2010-06-26 11:03               ` Uday S Reddy
2010-07-01  0:30                 ` Stefan Monnier
2010-07-01  1:54                   ` Lennart Borgman
2010-07-04 17:08                     ` Stefan Monnier
2010-06-19 16:22       ` Uday S Reddy
2010-06-18 15:04 ` Davis Herring

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