* Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
2006-05-12 10:50 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Lars Hansen
@ 2006-05-12 11:28 ` Eli Zaretskii
2006-05-12 11:41 ` Andreas Schwab
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2006-05-12 11:28 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, teirllm, rms, emacs-devel
> Date: Fri, 12 May 2006 12:50:23 +0200
> From: Lars Hansen <lists@soem.dk>
> Cc: emacs-pretest-bug@gnu.org, Luc Teirlinck <teirllm@dms.auburn.edu>,
> rms@gnu.org, wohler@newt.com
>
> Does it ever make sense to save undo information in a temporary buffer?
Why not? The fact that it's temporary doesn't necessarily mean it
cannot be used interactively. For example, I could imagine some
specialized mode that pops up a temporary buffer where the user is
supposed to type some text that the mode then uses. Some VC-related
feature could, for example, ask for a comment or descriptive text that
way.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
2006-05-12 10:50 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Lars Hansen
2006-05-12 11:28 ` Eli Zaretskii
@ 2006-05-12 11:41 ` Andreas Schwab
2006-05-12 12:03 ` Lars Hansen
2006-05-12 13:56 ` with-temp-buffer and undo Stefan Monnier
2006-05-13 4:52 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Richard Stallman
3 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2006-05-12 11:41 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, Luc Teirlinck, rms, emacs-devel
Lars Hansen <lists@soem.dk> writes:
> Lars Hansen wrote:
>
>>I suggest to use with-temp-buffer (and buffer-disable-undo)
>>
>>
> Does it ever make sense to save undo information in a temporary buffer?
> If not, I suggest to disable it in with-temp-buffer.
> Patch attached.
> *** subr.el~ 2006-05-12 08:24:10.000000000 +0200
> --- subr.el 2006-05-12 12:40:59.575290323 +0200
> ***************
> *** 2220,2226 ****
> See also `with-temp-file' and `with-output-to-string'."
> (declare (indent 0) (debug t))
> (let ((temp-buffer (make-symbol "temp-buffer")))
> ! `(let ((,temp-buffer (generate-new-buffer " *temp*")))
> (unwind-protect
> (with-current-buffer ,temp-buffer
> ,@body)
> --- 2220,2227 ----
> See also `with-temp-file' and `with-output-to-string'."
> (declare (indent 0) (debug t))
> (let ((temp-buffer (make-symbol "temp-buffer")))
> ! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
> ! (buffer-undo-list t))
> (unwind-protect
> (with-current-buffer ,temp-buffer
> ,@body)
This won't disable undo in the temp buffer, you'd need to move that below
with-current-buffer.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 10:50 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Lars Hansen
2006-05-12 11:28 ` Eli Zaretskii
2006-05-12 11:41 ` Andreas Schwab
@ 2006-05-12 13:56 ` Stefan Monnier
2006-05-12 17:30 ` Lars Hansen
2006-05-12 17:47 ` Lars Hansen
2006-05-13 4:52 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Richard Stallman
3 siblings, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2006-05-12 13:56 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, Luc Teirlinck, emacs-devel
> ! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
> ! (buffer-undo-list t))
Buffer whose name start with a space have their undo disabled by default.
I.e. someone thought of that years ago already,
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 13:56 ` with-temp-buffer and undo Stefan Monnier
@ 2006-05-12 17:30 ` Lars Hansen
2006-05-12 17:47 ` Lars Hansen
1 sibling, 0 replies; 11+ messages in thread
From: Lars Hansen @ 2006-05-12 17:30 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, Luc Teirlinck, rms, emacs-devel
Stefan Monnier wrote:
>>! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
>>! (buffer-undo-list t))
>>
>>
>
>Buffer whose name start with a space have their undo disabled by default.
>I.e. someone thought of that years ago already,
>
>
Cool :-)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 13:56 ` with-temp-buffer and undo Stefan Monnier
2006-05-12 17:30 ` Lars Hansen
@ 2006-05-12 17:47 ` Lars Hansen
2006-05-12 17:50 ` Bill Wohler
2006-05-13 4:53 ` Richard Stallman
1 sibling, 2 replies; 11+ messages in thread
From: Lars Hansen @ 2006-05-12 17:47 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, Luc Teirlinck, rms, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 322 bytes --]
Stefan Monnier wrote:
>>! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
>>! (buffer-undo-list t))
>>
>>
>
>Buffer whose name start with a space have their undo disabled by default.
>I.e. someone thought of that years ago already,
>
>
Then my previous patch can be simplified.
Any objections?
[-- Attachment #2: with-temp-file.diff --]
[-- Type: text/x-patch, Size: 1498 bytes --]
*** desktop.el.~1.99.~ 2006-02-19 15:43:52.000000000 +0100
--- desktop.el 2006-05-12 19:42:09.642918747 +0200
***************
*** 763,773 ****
(setq locals (cdr locals)))
ll)))
(buffer-list)))
! (eager desktop-restore-eager)
! (buf (get-buffer-create "*desktop*")))
! (set-buffer buf)
! (erase-buffer)
!
(insert
";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
desktop-header
--- 763,770 ----
(setq locals (cdr locals)))
ll)))
(buffer-list)))
! (eager desktop-restore-eager))
! (with-temp-buffer
(insert
";; -*- mode: emacs-lisp; coding: emacs-mule; -*-\n"
desktop-header
***************
*** 801,807 ****
info)
(setq default-directory dirname)
(let ((coding-system-for-write 'emacs-mule))
! (write-region (point-min) (point-max) filename nil 'nomessage))))
(setq desktop-dirname dirname))
;; ----------------------------------------------------------------------------
--- 798,804 ----
info)
(setq default-directory dirname)
(let ((coding-system-for-write 'emacs-mule))
! (write-region (point-min) (point-max) filename nil 'nomessage)))))
(setq desktop-dirname dirname))
;; ----------------------------------------------------------------------------
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 17:47 ` Lars Hansen
@ 2006-05-12 17:50 ` Bill Wohler
2006-05-21 20:36 ` Bill Wohler
2006-05-13 4:53 ` Richard Stallman
1 sibling, 1 reply; 11+ messages in thread
From: Bill Wohler @ 2006-05-12 17:50 UTC (permalink / raw)
Cc: emacs-pretest-bug, Luc Teirlinck, Stefan Monnier, rms,
emacs-devel
Lars Hansen <lists@soem.dk> wrote:
> Stefan Monnier wrote:
>
> >>! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
> >>! (buffer-undo-list t))
> >>
> >>
> >
> >Buffer whose name start with a space have their undo disabled by default.
> >I.e. someone thought of that years ago already,
> >
> >
> Then my previous patch can be simplified.
> Any objections?
None from me. I've applied it and will let you know how it goes. Thanks.
--
Bill Wohler <wohler@newt.com> http://www.newt.com/wohler/ GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 17:50 ` Bill Wohler
@ 2006-05-21 20:36 ` Bill Wohler
0 siblings, 0 replies; 11+ messages in thread
From: Bill Wohler @ 2006-05-21 20:36 UTC (permalink / raw)
Cc: emacs-pretest-bug
Bill Wohler <wohler@newt.com> writes:
> Lars Hansen <lists@soem.dk> wrote:
>
>> Stefan Monnier wrote:
>>
>> >>! `(let ((,temp-buffer (generate-new-buffer " *temp*"))
>> >>! (buffer-undo-list t))
>> >>
>> >>
>> >
>> >Buffer whose name start with a space have their undo disabled by default.
>> >I.e. someone thought of that years ago already,
>> >
>> >
>> Then my previous patch can be simplified.
>> Any objections?
>
> None from me. I've applied it and will let you know how it goes. Thanks.
So far so good. Thanks.
--
Bill Wohler <wohler@newt.com> http://www.newt.com/wohler/ GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo
2006-05-12 17:47 ` Lars Hansen
2006-05-12 17:50 ` Bill Wohler
@ 2006-05-13 4:53 ` Richard Stallman
1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2006-05-13 4:53 UTC (permalink / raw)
Cc: emacs-pretest-bug, wohler, teirllm, monnier, emacs-devel
Then my previous patch can be simplified.
Any objections?
Your patch looks good to me.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
2006-05-12 10:50 ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Lars Hansen
` (2 preceding siblings ...)
2006-05-12 13:56 ` with-temp-buffer and undo Stefan Monnier
@ 2006-05-13 4:52 ` Richard Stallman
3 siblings, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2006-05-13 4:52 UTC (permalink / raw)
Cc: emacs-pretest-bug, teirllm, wohler, emacs-devel
Using with-temp-buffer seems like a good idea.
Does it ever make sense to save undo information in a temporary buffer?
If not, I suggest to disable it in with-temp-buffer.
Undo is always disabled for with-temp-buffer, because it is disabled
by default for buffers whose names start with space.
^ permalink raw reply [flat|nested] 11+ messages in thread