GNU bug report logs - #8147
24.0.50; Inserting *Help* buffer can lead to data loss

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Tue, 1 Mar 2011 16:03:02 UTC

Severity: normal

Found in version 24.0.50

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 8147 <at> debbugs.gnu.org
Subject: bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
Date: Tue, 01 Mar 2011 17:02:09 +0100
[Message part 1 (text/plain, inline)]
In GNU Emacs 24.0.50.1 (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 -fno-optimize-sibling-calls''

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.

[Message part 2 (text/x-emacs-lisp, inline)]
*** /data/steve/bzr/emacs/trunk/lisp/simple.el	2011-02-23 15:11:01.000000000 +0100
--- /data/steve/bzr/emacs/quickfixes/lisp/simple.el	2011-03-01 15:04:22.000000000 +0100
***************
*** 3626,3631 ****
--- 3626,3632 ----
     (save-excursion
       (insert-buffer-substring (get-buffer buffer))
       (point)))
+   (remove-yank-excluded-properties (point) (mark))
    nil)
  
  (defun append-to-buffer (buffer start end)
[Message part 3 (text/plain, inline)]
Steve Berman

This bug report was last modified 14 years and 139 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.