aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-03-05 16:10:03 -0500
committerChong Yidong2011-03-05 16:10:03 -0500
commitd23ae2b03fdaaf6ff2015f177c0770792c409d96 (patch)
tree4dd2954e80cdedbc13d6a0ec43b194f55b97de36
parentb59a4335cd2e904d160323c9e00e1411c0d973bf (diff)
downloademacs-d23ae2b03fdaaf6ff2015f177c0770792c409d96.tar.gz
emacs-d23ae2b03fdaaf6ff2015f177c0770792c409d96.zip
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.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/help-mode.el15
2 files changed, 14 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 707464670e9..55935189af6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-03-05 Chong Yidong <cyd@stupidchicken.com>
2
3 * help-mode.el (help-buffer): If we are to return the current
4 buffer, signal an error if it's not in Help mode (Bug#8147).
5
12011-03-05 Reuben Thomas <rrt@sc3d.org> 62011-03-05 Reuben Thomas <rrt@sc3d.org>
2 7
3 * files.el (file-name-version-regexp): Handle backup files of the 8 * files.el (file-name-version-regexp): Handle backup files of the
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."
409(defun help-buffer () 409(defun help-buffer ()
410 "Return the name of a buffer for inserting help. 410 "Return the name of a buffer for inserting help.
411If `help-xref-following' is non-nil, this is the name of the 411If `help-xref-following' is non-nil, this is the name of the
412current buffer. 412current buffer. Signal an error if this buffer is not derived
413Otherwise, it is *Help*; if no buffer with that name currently 413from `help-mode'.
414exists, it is created." 414Otherwise, return \"*Help*\", creating a buffer with that name if
415it does not already exist."
415 (buffer-name ;for with-output-to-temp-buffer 416 (buffer-name ;for with-output-to-temp-buffer
416 (if help-xref-following 417 (if (not help-xref-following)
417 (current-buffer) 418 (get-buffer-create "*Help*")
418 (get-buffer-create "*Help*")))) 419 (unless (derived-mode-p 'help-mode)
420 (error "Current buffer is not in Help mode"))
421 (current-buffer))))
419 422
420(defvar help-xref-override-view-map 423(defvar help-xref-override-view-map
421 (let ((map (make-sparse-keymap))) 424 (let ((map (make-sparse-keymap)))