]> git.eshelyaron.com Git - emacs.git/commitdiff
(print-help-return-message): If help buffer is a
authorRichard M. Stallman <rms@gnu.org>
Sat, 16 Jul 1994 17:58:12 +0000 (17:58 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 16 Jul 1994 17:58:12 +0000 (17:58 +0000)
special display buffer, say nothing about how to switch back.

lisp/help.el

index e861bc8e42e43ae9f696ea5a4289f2b35b4a891e..c6585f0e41b9400a0ef13e4f78b15960c9de2135 100644 (file)
 Computes a message and applies the optional argument FUNCTION to it.
 If FUNCTION is nil, applies `message' to it, thus printing it."
   (and (not (get-buffer-window standard-output))
-       (funcall (or function 'message)
-               (concat
-                (substitute-command-keys
-                 (if (one-window-p t)
-                     (if pop-up-windows
-                         "Type \\[delete-other-windows] to remove help window."
-                       "Type \\[switch-to-buffer] RET to remove help window.")
-                   "Type \\[switch-to-buffer-other-window] RET to restore the other window."))
-                (substitute-command-keys
-                 "  \\[scroll-other-window] to scroll the help.")))))
+       (let ((first-message
+             (cond ((or (member (buffer-name standard-output)
+                                special-display-buffer-names)
+                        (let (found
+                              (tail special-display-regexps)
+                              (name (buffer-name standard-output)))
+                          (while (and tail (not found))
+                            (if (string-match (car tail) name)
+                                (setq found t))
+                            (setq tail (cdr tail)))
+                          found))
+                    ;; If the help output buffer is a special display buffer,
+                    ;; don't say anything about how to get rid of it.
+                    ;; First of all, the user will do that with the window
+                    ;; manager, not with Emacs.
+                    ;; Secondly, the buffer has not been displayed yet,
+                    ;; so we don't know whether its frame will be selected.
+                    ;; Even the message about scrolling the help
+                    ;; might be wrong, but it seems worth showing it anyway.
+                    nil)
+                   ((not (one-window-p t))
+                    "Type \\[switch-to-buffer-other-window] RET to restore the other window.")
+                   (pop-up-windows
+                    "Type \\[delete-other-windows] to remove help window.")
+                   (t
+                    "Type \\[switch-to-buffer] RET to remove help window."))))
+        (funcall (or function 'message)
+                 (concat
+                  (if first-message
+                      (substitute-command-keys first-message)
+                    "")
+                  (if first-message "  " "")
+                  (substitute-command-keys
+                   "\\[scroll-other-window] to scroll the help."))))))
 
 (defun describe-key (key)
   "Display documentation of the function invoked by KEY.  KEY is a string."