emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103535: Fix to help-buffer to ensure


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103535: Fix to help-buffer to ensure it returns a valid buffer (Bug#8147).
Date: Sat, 05 Mar 2011 16:10:03 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103535
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2011-03-05 16:10:03 -0500
message:
  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.
modified:
  lisp/ChangeLog
  lisp/help-mode.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-05 20:43:35 +0000
+++ b/lisp/ChangeLog    2011-03-05 21:10:03 +0000
@@ -1,3 +1,8 @@
+2011-03-05  Chong Yidong  <address@hidden>
+
+       * help-mode.el (help-buffer): If we are to return the current
+       buffer, signal an error if it's not in Help mode (Bug#8147).
+
 2011-03-05  Reuben Thomas  <address@hidden>
 
        * files.el (file-name-version-regexp): Handle backup files of the

=== modified file 'lisp/help-mode.el'
--- a/lisp/help-mode.el 2011-02-10 16:56:00 +0000
+++ b/lisp/help-mode.el 2011-03-05 21:10:03 +0000
@@ -409,13 +409,16 @@
 (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)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]