unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* with-temp-buffer: should we set buffer-undo-list to t?
@ 2017-03-11 23:52 raman
  2017-03-12 13:38 ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: raman @ 2017-03-11 23:52 UTC (permalink / raw)
  To: emacs-devel

Would setting buffer-undo-list to t in the macro  definition of
with-temp-buffer help save some work?

At present we dont do this, and as a consequence, operations within
body of with-tem-buffer may well push entries on the undo stack that
just get thrown away.
-- 

-- 



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

* Re: with-temp-buffer: should we set buffer-undo-list to t?
  2017-03-11 23:52 with-temp-buffer: should we set buffer-undo-list to t? raman
@ 2017-03-12 13:38 ` Noam Postavsky
  2017-03-12 14:48   ` raman
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2017-03-12 13:38 UTC (permalink / raw)
  To: raman; +Cc: Emacs developers

On Sat, Mar 11, 2017 at 6:52 PM,  <raman@google.com> wrote:
> Would setting buffer-undo-list to t in the macro  definition of
> with-temp-buffer help save some work?
>
> At present we dont do this, and as a consequence, operations within
> body of with-tem-buffer may well push entries on the undo stack that
> just get thrown away.

Seems it already happens:

(with-temp-buffer
  buffer-undo-list) ;=> t

get-buffer-create has this code:

  bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);

So buffers starting with a space have the undo list set to t.



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

* Re: with-temp-buffer: should we set buffer-undo-list to t?
  2017-03-12 13:38 ` Noam Postavsky
@ 2017-03-12 14:48   ` raman
  0 siblings, 0 replies; 3+ messages in thread
From: raman @ 2017-03-12 14:48 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Emacs developers

Thanks for spotting that -- I had only looked at the defmacro for
with-temp-buffer and missed the connection between temp buffers having a
space in front and the related code in get-buffer-create.
-- 



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

end of thread, other threads:[~2017-03-12 14:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11 23:52 with-temp-buffer: should we set buffer-undo-list to t? raman
2017-03-12 13:38 ` Noam Postavsky
2017-03-12 14:48   ` raman

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