[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss

From: Stephen Berman
Subject: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
Date: Tue, 01 Mar 2011 17:02:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

In GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.20.1)
 of 2011-02-23 on escher
Windowing system distributor `The X.Org Foundation', version 11.0.10800000
configured using `configure  '--without-toolkit-scroll-bars' 'CFLAGS=-g -O2 

1. emacs -Q
2. Start editing some buffer.
3. Bring up a doc string in a *Help* buffer with content that contains
   buttons to other doc strings, e.g. `C-h f completing-read'.
4. Return to the buffer in step 2 and type `M-x insert-buffer RET
   *Help*'.  Note that the buttons in the inserted text are active.
5. Click on one of the buttons in the inserted text that links to
   another doc string, e.g. `try-completion'.
=> The previous content of the buffer you were editing is replaced by
the doc string of the just clicked button (e.g. that of
`try-completion').  This buffer is read-only, but if you make it
writable and type `C-x _' to restore the previous content, you get the
message "No undo information in this buffer".  So whatever unsaved data
was in the buffer prior to clicking the button is unrecoverable.

I reported this problem to emacs-devel in May 2008 (see
http://thread.gmane.org/gmane.emacs.devel/97367/) and there were a few
ideas about how to deal with it, but none were pursued.  I just got bit
by it again -- more fool me, perhaps, but it gives me the opportunity to
put it in the bug tracker.  And I offer a fix to the immediate problem
in the following patch, which prevents insert-buffer from inserting
active help buttons.  This extends to insert-buffer the default behavior
of yanking the content of *Help*, since the help button text properties
are in yank-excluded-properties by default.

*** /data/steve/bzr/emacs/trunk/lisp/simple.el  2011-02-23 15:11:01.000000000 
--- /data/steve/bzr/emacs/quickfixes/lisp/simple.el     2011-03-01 
15:04:22.000000000 +0100
*** 3626,3631 ****
--- 3626,3632 ----
       (insert-buffer-substring (get-buffer buffer))
+   (remove-yank-excluded-properties (point) (mark))
  (defun append-to-buffer (buffer start end)
Steve Berman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]