]> code.delx.au - gnu-emacs/blobdiff - lisp/help-fns.el
Fix typos in docstrings.
[gnu-emacs] / lisp / help-fns.el
index a080cd22ea0e441567ce072f95ab8e9aba1b4d46..86e9411b14072b95d320f80cb9c0c907c8bae613 100644 (file)
@@ -1,7 +1,7 @@
 ;;; help-fns.el --- Complex help functions
 
 ;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001, 2002,
-;;   2003, 2004, 2005, 2006, 2007, 2008, 2009
+;;   2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
@@ -32,8 +32,6 @@
 
 ;;; Code:
 
-(require 'help-mode)
-
 ;; Functions
 
 ;;;###autoload
@@ -101,15 +99,13 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"."
   ;; Handle symbols aliased to other symbols.
   (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def)))
   ;; If definition is a macro, find the function inside it.
-  (let ((advertised (gethash def advertised-signature-table t)))
-    (if (listp advertised) advertised
-      (if (eq (car-safe def) 'macro) (setq def (cdr def)))
-      (cond
-       ((byte-code-function-p def) (aref def 0))
-       ((eq (car-safe def) 'lambda) (nth 1 def))
-       ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
-        "[Arg list not available until function definition is loaded.]")
-       (t t)))))
+  (if (eq (car-safe def) 'macro) (setq def (cdr def)))
+  (cond
+   ((byte-code-function-p def) (aref def 0))
+   ((eq (car-safe def) 'lambda) (nth 1 def))
+   ((and (eq (car-safe def) 'autoload) (not (eq (nth 4 def) 'keymap)))
+    "[Arg list not available until function definition is loaded.]")
+   (t t)))
 
 (defun help-make-usage (function arglist)
   (cons (if (symbolp function) function 'anonymous)
@@ -459,7 +455,9 @@ suitable file is found, return nil."
              (terpri)))))
       ;; Note that list* etc do not get this property until
       ;; cl-hack-byte-compiler runs, after bytecomp is loaded.
-      (when (eq (get function 'byte-compile) 'cl-byte-compile-compiler-macro)
+      (when (and (symbolp function)
+                 (eq (get function 'byte-compile)
+                     'cl-byte-compile-compiler-macro))
        (princ "This function has a compiler macro")
        (let ((lib (get function 'compiler-macro-file)))
          (when (stringp lib)
@@ -469,14 +467,17 @@ suitable file is found, return nil."
                (re-search-backward "`\\([^`']+\\)'" nil t)
                (help-xref-button 1 'help-function-cmacro function lib)))))
        (princ ".\n\n"))
-      (let* ((arglist (help-function-arglist def))
+      (let* ((advertised (gethash def advertised-signature-table t))
+            (arglist (if (listp advertised)
+                         advertised (help-function-arglist def)))
             (doc (documentation function))
             (usage (help-split-fundoc doc function)))
        (with-current-buffer standard-output
          ;; If definition is a keymap, skip arglist note.
          (unless (keymapp function)
+           (if usage (setq doc (cdr usage)))
            (let* ((use (cond
-                        (usage (setq doc (cdr usage)) (car usage))
+                        ((and usage (not (listp advertised))) (car usage))
                         ((listp arglist)
                          (format "%S" (help-make-usage function arglist)))
                         ((stringp arglist) arglist)
@@ -788,8 +789,7 @@ file local variable.\n")
                  (terpri)
                  (princ output))))
 
-           (save-excursion
-             (set-buffer standard-output)
+           (with-current-buffer standard-output
              ;; Return the text we displayed.
              (buffer-string))))))))