unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
       [not found]         ` <44643259.3050302@soem.dk>
@ 2006-05-12 10:50           ` Lars Hansen
  2006-05-12 11:28             ` Eli Zaretskii
                               ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Lars Hansen @ 2006-05-12 10:50 UTC (permalink / raw)
  Cc: emacs-pretest-bug, Luc Teirlinck, rms, wohler

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

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.

[-- Attachment #2: subr.diff --]
[-- Type: text/x-patch, Size: 761 bytes --]

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

[-- 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 [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 [was: Big desktop undo buffer crashes Emacs]
  2006-05-12 11:41             ` Andreas Schwab
@ 2006-05-12 12:03               ` Lars Hansen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Hansen @ 2006-05-12 12:03 UTC (permalink / raw)
  Cc: emacs-pretest-bug, wohler, Luc Teirlinck, rms, emacs-devel

Andreas Schwab wrote:

>This won't disable undo in the temp buffer, you'd need to move that below
>with-current-buffer.
>  
>
Oops.

^ 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 [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

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

end of thread, other threads:[~2006-05-21 20:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <24090.1146238861@olgas.newt.com>
     [not found] ` <E1FZupW-00010U-IX@fencepost.gnu.org>
     [not found]   ` <87slngh3wu.fsf@olgas.newt.com>
     [not found]     ` <E1FeP3s-0002OD-U0@fencepost.gnu.org>
     [not found]       ` <200605120450.k4C4ovkM019797@jane.dms.auburn.edu>
     [not found]         ` <44643259.3050302@soem.dk>
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-12 17:30               ` Lars Hansen
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
2006-05-13  4:52             ` with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs] Richard Stallman

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