]> code.delx.au - gnu-emacs/blobdiff - lisp/help.el
(print-help-return-message): When
[gnu-emacs] / lisp / help.el
index c2db80029369296887d500aa54635b45537d760a..67a8858473fd1659038318dbf67b22f363376341 100644 (file)
@@ -274,6 +274,10 @@ If FUNCTION is nil, applies `message' to it, thus printing it."
                     ;; Secondly, the buffer has not been displayed yet,
                     ;; so we don't know whether its frame will be selected.
                     nil)
+                   (display-buffer-reuse-frames
+                    (setq help-return-method (cons (selected-window)
+                                                   'quit-window))
+                    nil)
                    ((not (one-window-p t))
                     (setq help-return-method
                           (cons (selected-window) 'quit-window))
@@ -357,7 +361,8 @@ For minor modes, see following pages.\n\n"))
          ;; Document a minor mode if it is listed in minor-mode-alist,
          ;; bound locally in this buffer, non-nil, and has a function
          ;; definition.
-         (if (and (symbol-value minor-mode)
+         (if (and (boundp minor-mode)
+                  (symbol-value minor-mode)
                   (fboundp minor-mode))
              (let ((pretty-minor-mode minor-mode))
                (if (string-match "-mode$" (symbol-name minor-mode))
@@ -621,7 +626,9 @@ It can also be nil, if the definition is not associated with any file."
                     (vectorp def))
                 "a keyboard macro")
                ((subrp def)
-                (concat beg "built-in function"))
+                (if (eq 'unevalled (cdr (subr-arity def)))
+                    (concat beg "special form")
+                  (concat beg "built-in function")))
                ((byte-code-function-p def)
                 (concat beg "compiled Lisp function"))
                ((symbolp def)
@@ -716,19 +723,35 @@ It can also be nil, if the definition is not associated with any file."
       (if doc
          (progn (terpri)
                 (princ doc)
-                (with-current-buffer standard-output
-                  (beginning-of-line)
-                  ;; Builtins get the calling sequence at the end of
-                  ;; the doc string.  Move it to the same place as
-                  ;; for other functions.
-                  (when (looking-at (format "(%S[ )]" function))
-                    (let ((start (point-marker)))
-                      (goto-char (point-min))
-                      (forward-paragraph)
-                      (insert-buffer-substring (current-buffer) start)
-                      (insert ?\n)
-                      (delete-region (1- start) (point-max))
-                      (goto-char (point-max)))))
+                (if (subrp (symbol-function function))
+                    (with-current-buffer standard-output
+                      (beginning-of-line)
+                      ;; Builtins get the calling sequence at the end of
+                      ;; the doc string.  Move it to the same place as
+                      ;; for other functions.
+
+                      ;; In cases where `function' has been fset to a
+                      ;; subr we can't search for function's name in
+                      ;; the doc string.  Kluge round that using the
+                      ;; printed representation.  The arg list then
+                      ;; shows the wrong function name, but that
+                      ;; might be a useful hint.
+                      (let* ((rep (prin1-to-string def))
+                             (name (progn
+                                     (string-match " \\([^ ]+\\)>$" rep)
+                                     (match-string 1 rep))))
+                        (if (looking-at (format "(%s[ )]" name))
+                            (let ((start (point-marker)))
+                              (goto-char (point-min))
+                              (forward-paragraph)
+                              (insert-buffer-substring (current-buffer) start)
+                              (insert ?\n)
+                              (delete-region (1- start) (point-max)))
+                          (goto-char (point-min))
+                          (forward-paragraph)
+                          (insert
+                           "[Missing arglist.  Please make a bug report.]\n")))
+                      (goto-char (point-max))))
                 (help-setup-xref (list #'describe-function function)
                                  interactive-p))
        (princ "not documented")))))
@@ -829,13 +852,16 @@ Returns the documentation as a string, also."
            (set-buffer standard-output)
            (if (> (count-lines (point-min) (point-max)) 10)
                (progn
+                 ;; Note that setting the syntax table like below
+                 ;; makes forward-sexp move over a `'s' at the end
+                 ;; of a symbol.
                  (set-syntax-table emacs-lisp-mode-syntax-table)
                  (goto-char (point-min))
                  (if valvoid
                      (forward-line 1)
                    (forward-sexp 1)
                    (delete-region (point) (progn (end-of-line) (point)))
-                   (insert "'s value is shown below.\n\n")
+                   (insert " value is shown below.\n\n")
                    (save-excursion
                      (insert "\n\nValue:"))))))
          (princ "Documentation:")
@@ -1473,7 +1499,7 @@ out of view."
      (catch . "(catch TAG BODY...)")
      (unwind-protect . "(unwind-protect BODYFORM UNWINDFORMS...)")
      (condition-case . "(condition-case VAR BODYFORM HANDLERS...)")
-     (track-mouse . "(track-mouse BOFY ...)")
+     (track-mouse . "(track-mouse BODY ...)")
      (ml-if . "(ml-if COND THEN ELSE...)")
      (ml-provide-prefix-argument . "(ml-provide-prefix-argument ARG1 ARG2)")
      (with-output-to-temp-buffer