(flymake-process-filter): Make sure the source buffer isn't dead.
[bpt/emacs.git] / lisp / ehelp.el
index 641faca..a9b3a58 100644 (file)
@@ -1,16 +1,17 @@
 ;;; ehelp.el --- bindings for electric-help mode
 
-;; Copyright (C) 1986, 1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1995, 2000, 2001, 2002, 2003, 2004,
+;;   2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help, extensions
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -18,9 +19,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
     (define-key map "<" 'beginning-of-buffer)
     (define-key map ">" 'end-of-buffer)
     ;(define-key map "\C-g" 'electric-help-exit)
-    (define-key map "q" 'electric-help-exit)
     (define-key map "Q" 'electric-help-exit)
+    (define-key map "q" 'electric-help-exit)
     ;;a better key than this?
-    (define-key map "r" 'electric-help-retain)
     (define-key map "R" 'electric-help-retain)
+    (define-key map "r" 'electric-help-retain)
     (define-key map "\ex" 'electric-help-execute-extended)
     (define-key map "\C-x" 'electric-help-ctrl-x-prefix)
 
 ;;;###autoload
 (defun with-electric-help (thunk &optional buffer noerase minheight)
   "Pop up an \"electric\" help buffer.
-The arguments are THUNK &optional BUFFER NOERASE MINHEIGHT.
 THUNK is a function of no arguments which is called to initialize the
 contents of BUFFER.  BUFFER defaults to `*Help*'.  BUFFER will be
 erased before THUNK is called unless NOERASE is non-nil.  THUNK will
@@ -124,7 +122,7 @@ shrink the window to fit.  If THUNK returns non-nil, we don't do those things.
 
 After THUNK has been called, this function \"electrically\" pops up a window
 in which BUFFER is displayed and allows the user to scroll through that buffer
-in electric-help-mode. The window's height will be at least MINHEIGHT if
+in `electric-help-mode'. The window's height will be at least MINHEIGHT if
 this value is non-nil.
 
 If THUNK returns nil, we display BUFFER starting at the top, and
@@ -133,7 +131,7 @@ If THUNK returns non-nil, we don't do those things.
 
 When the user exits (with `electric-help-exit', or otherwise), the help
 buffer's window disappears (i.e., we use `save-window-excursion'), and
-BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit."
+BUFFER is put into `default-major-mode' (or `fundamental-mode')."
   (setq buffer (get-buffer-create (or buffer "*Help*")))
   (let ((one (one-window-p t))
        (config (current-window-configuration))
@@ -196,7 +194,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit."
     (if (pos-visible-in-window-p (point-max))
        (progn (message "%s" (substitute-command-keys "<<< Press Space to bury the help buffer, Press \\[electric-help-retain] to retain it >>>"))
               (if (equal (setq unread-command-events (list (read-event)))
-                         '(?\ ))
+                         '(?\s))
                   (progn (setq unread-command-events nil)
                          (throw 'exit t)))))
     (let (up down both neither
@@ -215,7 +213,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit."
                      ;beginning-of-buffer - otherwise pos-visible-in-window-p
                      ;will yield a wrong result.
          (let ((min (pos-visible-in-window-p (point-min)))
-               (max (pos-visible-in-window-p (point-max))))
+               (max (pos-visible-in-window-p (1- (point-max)))))
            (cond (isearch-mode 'noprompt)
                  ((and min max)
                   (cond (standard "Press q to exit, r to retain ")
@@ -245,7 +243,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit."
 ;    (scroll-up arg)))
 
 (defun electric-help-exit ()
-  "Exit `electric-help', restoring the previous window/buffer configuration.
+  "Exit `with-electric-help', restoring the previous window/buffer configuration.
 \(The *Help* buffer will be buried.)"
   (interactive)
   ;; Make sure that we don't throw twice, even if two events cause
@@ -256,7 +254,7 @@ BUFFER is put into `default-major-mode' (or `fundamental-mode') when we exit."
        (throw 'exit t))))
 
 (defun electric-help-retain ()
-  "Exit `electric-help', retaining the current window/buffer configuration.
+  "Exit `with-electric-help', retaining the current window/buffer configuration.
 \(The *Help* buffer will not be selected, but \\[switch-to-buffer-other-window] RET
 will select it.)"
   (interactive)
@@ -426,5 +424,5 @@ will select it.)"
 
 (provide 'ehelp)
 
-;;; arch-tag: e0e3037f-42c0-433e-ba18-322c5d951f46
+;; arch-tag: e0e3037f-42c0-433e-ba18-322c5d951f46
 ;;; ehelp.el ends here