diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-03-05 16:10:03 -0500 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-03-05 16:10:03 -0500 |
commit | d23ae2b03fdaaf6ff2015f177c0770792c409d96 (patch) | |
tree | 4dd2954e80cdedbc13d6a0ec43b194f55b97de36 /lisp/help-mode.el | |
parent | b59a4335cd2e904d160323c9e00e1411c0d973bf (diff) | |
download | emacs-d23ae2b03fdaaf6ff2015f177c0770792c409d96.tar.gz |
Fix to help-buffer to ensure it returns a valid buffer (Bug#8147).
* lisp/help-mode.el (help-buffer): If we are to return the current
buffer, signal an error if it's not in Help mode.
Diffstat (limited to 'lisp/help-mode.el')
-rw-r--r-- | lisp/help-mode.el | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 724b0186679..51d18235e1b 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -409,13 +409,16 @@ restore it properly when going back." (defun help-buffer () "Return the name of a buffer for inserting help. If `help-xref-following' is non-nil, this is the name of the -current buffer. -Otherwise, it is *Help*; if no buffer with that name currently -exists, it is created." +current buffer. Signal an error if this buffer is not derived +from `help-mode'. +Otherwise, return \"*Help*\", creating a buffer with that name if +it does not already exist." (buffer-name ;for with-output-to-temp-buffer - (if help-xref-following - (current-buffer) - (get-buffer-create "*Help*")))) + (if (not help-xref-following) + (get-buffer-create "*Help*") + (unless (derived-mode-p 'help-mode) + (error "Current buffer is not in Help mode")) + (current-buffer)))) (defvar help-xref-override-view-map (let ((map (make-sparse-keymap))) |