;;; 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
;;; Code:
-(require 'help-mode)
-
;; Functions
;;;###autoload
;; 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)
(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)
(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)
(terpri)
(princ output))))
- (save-excursion
- (set-buffer standard-output)
+ (with-current-buffer standard-output
;; Return the text we displayed.
(buffer-string))))))))