;;; help-fns.el --- Complex help functions
;; Copyright (C) 1985, 1986, 1993, 1994, 1998, 1999, 2000, 2001,
-;; 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: help, internal
(setq buffer-undo-list nil)
(set-buffer-modified-p nil))))
-;;;###autoload
-(defun locate-library (library &optional nosuffix path interactive-call)
- "Show the precise file name of Emacs library LIBRARY.
-This command searches the directories in `load-path' like `\\[load-library]'
-to find the file that `\\[load-library] RET LIBRARY RET' would load.
-Optional second arg NOSUFFIX non-nil means don't add suffixes `load-suffixes'
-to the specified name LIBRARY.
-
-If the optional third arg PATH is specified, that list of directories
-is used instead of `load-path'.
-
-When called from a program, the file name is normaly returned as a
-string. When run interactively, the argument INTERACTIVE-CALL is t,
-and the file name is displayed in the echo area."
- (interactive (list (completing-read "Locate library: "
- 'locate-file-completion
- (cons load-path load-suffixes))
- nil nil
- t))
- (let ((file (locate-file library
- (or path load-path)
- (append (unless nosuffix load-suffixes) '("")))))
- (if interactive-call
- (if file
- (message "Library is file %s" (abbreviate-file-name file))
- (message "No library %s in search path" library)))
- file))
-
\f
;; Functions
(setq val (completing-read (if fn
(format "Describe function (default %s): " fn)
"Describe function: ")
- obarray 'fboundp t nil nil (symbol-name fn)))
+ obarray 'fboundp t nil nil
+ (and fn (symbol-name fn))))
(list (if (equal val "")
fn (intern val)))))
(if (null function)
(concat "src/" file)
file)))))
-;;;###autoload
(defface help-argument-name '((((supports :slant italic)) :inherit italic))
"Face to highlight argument names in *Help* buffers."
:group 'help)
"\\)"
"\\(?:es\\|s\\|th\\)?" ; for ARGth, ARGs
"\\(?:-[a-z0-9-]+\\)?" ; for ARG-xxx, ARG-n
+ "\\(?:-[{([<`\"].*?\\)?"; for ARG-{x}, (x), <x>, [x], `x'
"\\>") ; end of word
(help-default-arg-highlight arg)
doc t t 1)))))
;; Return value is like the one from help-split-fundoc, but highlighted
(cons usage doc))
+;;;###autoload
(defun describe-simplify-lib-file-name (file)
"Simplify a library name FILE to a relative name, and make it a source file."
(if file
;; Now convert that back to a file name and see if we get
;; the original one. If so, they are equivalent.
(if (equal file (locate-file libname load-path '("")))
- (if (string-match "[.]elc?\\'" libname)
+ (if (string-match "[.]elc\\'" libname)
(substring libname 0 -1)
libname)
file))))
(format "\nMacro: %s" (format-kbd-macro def)))
(t "[Missing arglist. Please make a bug report.]")))
(high (help-highlight-arguments use doc)))
- (insert (car high) "\n")
+ (let ((fill-begin (point)))
+ (insert (car high) "\n")
+ (fill-region fill-begin (point)))
(setq doc (cdr high))))
(let ((obsolete (and
;; function might be a lambda construct.
(format
"Describe variable (default %s): " v)
"Describe variable: ")
- obarray 'boundp t nil nil
+ obarray
+ '(lambda (vv)
+ (or (boundp vv)
+ (get vv 'variable-documentation)))
+ t nil nil
(if (symbolp v) (symbol-name v))))
(list (if (equal val "")
v (intern val)))))
(help-xref-button 1 'help-variable-def
variable file-name)))
(if valvoid
- (princ "It is void as a variable.\n")
+ (princ "It is void as a variable.")
(princ "Its ")))
(if valvoid
- (princ " is void as a variable.\n")
+ (princ " is void as a variable.")
(princ "'s "))))
(if valvoid
nil
(indirect-variable variable)
(error variable)))
(obsolete (get variable 'byte-obsolete-variable))
+ (safe-var (get variable 'safe-local-variable))
(doc (or (documentation-property variable 'variable-documentation)
(documentation-property alias 'variable-documentation))))
(unless (eq alias variable)
(princ (if (stringp (car obsolete)) (car obsolete)
(format "use `%s' instead." (car obsolete))))
(terpri))
+ (when safe-var
+ (princ "This variable is safe as a file local variable ")
+ (princ "if its value\nsatisfies the predicate ")
+ (princ (if (byte-code-function-p safe-var)
+ "which is byte-compiled expression.\n"
+ (format "`%s'.\n" safe-var)))
+ (terpri))
(princ "Documentation:\n")
(princ (or doc "Not documented as a variable.")))
;; Make a link to customize if this variable can be customized.