all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss
@ 2011-03-01 16:02 Stephen Berman
  2011-03-02 17:07 ` Stefan Monnier
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Berman @ 2011-03-01 16:02 UTC (permalink / raw)
  To: 8147

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

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: insert-buffer patch --]
[-- Type: text/x-emacs-lisp, Size: 426 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


Steve Berman

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-07 16:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 16:02 bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss Stephen Berman
2011-03-02 17:07 ` Stefan Monnier
2011-03-05 21:10   ` Chong Yidong
2011-03-06  0:24     ` Stephen Berman
2011-03-06 16:38       ` Stephen Berman
2011-03-06 20:28         ` Chong Yidong
2011-03-06 23:41           ` Stephen Berman
2011-03-06 23:58             ` Stephen Berman
2011-03-07 16:20           ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.