comparison lisp/help.el @ 233:52952cbfc5b5 r20-5b15

Import from CVS: tag r20-5b15
author cvs
date Mon, 13 Aug 2007 10:14:14 +0200
parents 557eaa0339bf
children 41f2f0e326e9
comparison
equal deleted inserted replaced
232:aa6545ea0638 233:52952cbfc5b5
828 "*If non-nil, describe-function will show its arglist, 828 "*If non-nil, describe-function will show its arglist,
829 unless the function is autoloaded." 829 unless the function is autoloaded."
830 :type 'boolean 830 :type 'boolean
831 :group 'help-appearance) 831 :group 'help-appearance)
832 832
833 (defun describe-function-find-file (function) 833 (defun describe-symbol-find-file (function)
834 (let ((files load-history) 834 (let ((files load-history)
835 file) 835 file)
836 (while files 836 (while files
837 (if (memq function (cdr (car files))) 837 (if (memq function (cdr (car files)))
838 (setq file (car (car files)) 838 (setq file (car (car files))
839 files nil)) 839 files nil))
840 (setq files (cdr files))) 840 (setq files (cdr files)))
841 file)) 841 file))
842 (define-obsolete-function-alias
843 'describe-function-find-file
844 'describe-symbol-find-file)
842 845
843 (defun describe-function (function) 846 (defun describe-function (function)
844 "Display the full documentation of FUNCTION (a symbol). 847 "Display the full documentation of FUNCTION (a symbol).
845 When run interactively, it defaults to any function found by 848 When run interactively, it defaults to any function found by
846 `function-at-point'." 849 `function-at-point'."
967 (format 970 (format
968 "\n which is an alias for `%s', " 971 "\n which is an alias for `%s', "
969 (symbol-name def))) 972 (symbol-name def)))
970 (format "an alias for `%s', " (symbol-name def))))) 973 (format "an alias for `%s', " (symbol-name def)))))
971 (setq def (symbol-function def))) 974 (setq def (symbol-function def)))
972 (if (compiled-function-p def) 975 (if (and (fboundp 'compiled-function-annotation)
976 (compiled-function-p def))
973 (setq file-name (compiled-function-annotation def))) 977 (setq file-name (compiled-function-annotation def)))
974 (if (eq 'macro (car-safe def)) 978 (if (eq 'macro (car-safe def))
975 (setq fndef (cdr def) 979 (setq fndef (cdr def)
976 file-name (and (compiled-function-p (cdr def)) 980 file-name (and (compiled-function-p (cdr def))
981 (fboundp 'compiled-function-annotation)
977 (compiled-function-annotation (cdr def))) 982 (compiled-function-annotation (cdr def)))
978 macrop t) 983 macrop t)
979 (setq fndef def)) 984 (setq fndef def))
980 (if aliases (princ aliases)) 985 (if aliases (princ aliases))
981 (let ((int #'(lambda (string an-p macro-p) 986 (let ((int #'(lambda (string an-p macro-p)
1012 nil))) 1017 nil)))
1013 (princ "\n") 1018 (princ "\n")
1014 (if autoload-file 1019 (if autoload-file
1015 (princ (format " -- autoloads from \"%s\"\n" autoload-file))) 1020 (princ (format " -- autoloads from \"%s\"\n" autoload-file)))
1016 (or file-name 1021 (or file-name
1017 (setq file-name (describe-function-find-file function))) 1022 (setq file-name (describe-symbol-find-file function)))
1018 (if file-name 1023 (if file-name
1019 (princ (format " -- loaded from \"%s\"\n" file-name))) 1024 (princ (format " -- loaded from \"%s\"\n" file-name)))
1020 ;; (terpri) 1025 ;; (terpri)
1021 (if describe-function-show-arglist 1026 (if describe-function-show-arglist
1022 (let ((arglist (function-arglist function))) 1027 (let ((arglist (function-arglist function)))
1169 (setq variable newvar))) 1174 (setq variable newvar)))
1170 (if aliases 1175 (if aliases
1171 (princ (format "%s" aliases))) 1176 (princ (format "%s" aliases)))
1172 (princ (built-in-variable-doc variable)) 1177 (princ (built-in-variable-doc variable))
1173 (princ ".\n") 1178 (princ ".\n")
1174 (let ((file-name (describe-function-find-file variable))) 1179 (let ((file-name (describe-symbol-find-file variable)))
1175 (if file-name 1180 (if file-name
1176 (princ (format " -- loaded from \"%s\"\n" file-name)))) 1181 (princ (format " -- loaded from \"%s\"\n" file-name))))
1177 (princ "\nValue: ") 1182 (princ "\nValue: ")
1178 (if (not (boundp variable)) 1183 (if (not (boundp variable))
1179 (princ "void\n") 1184 (princ "void\n")