unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: 8147@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	[thread overview]
Message-ID: <8762s2akxq.fsf@escher.fritz.box> (raw)

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

             reply	other threads:[~2011-03-01 16:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 16:02 Stephen Berman [this message]
2011-03-02 17:07 ` bug#8147: 24.0.50; Inserting *Help* buffer can lead to data loss 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8762s2akxq.fsf@escher.fritz.box \
    --to=stephen.berman@gmx.net \
    --cc=8147@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).