Re: with-temp-buffer and undo
Bill Wohler [EMAIL PROTECTED] writes: Lars Hansen [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
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.0 +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) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
Date: Fri, 12 May 2006 12:50:23 +0200 From: Lars Hansen [EMAIL PROTECTED] Cc: emacs-pretest-bug@gnu.org, Luc Teirlinck [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] 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. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
Lars Hansen [EMAIL PROTECTED] 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.0 +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, [EMAIL PROTECTED] 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. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
Andreas Schwab wrote: This won't disable undo in the temp buffer, you'd need to move that below with-current-buffer. Oops. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo
! `(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 ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo
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 :-) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo
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? *** desktop.el.~1.99.~ 2006-02-19 15:43:52.0 +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)) ;; ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo
Lars Hansen [EMAIL PROTECTED] 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 [EMAIL PROTECTED] 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. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo [was: Big desktop undo buffer crashes Emacs]
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. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: with-temp-buffer and undo
Then my previous patch can be simplified. Any objections? Your patch looks good to me. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug