(defgroup reftex): Update home page url-link.
[bpt/emacs.git] / lisp / help-fns.el
index 78c156f..53e280f 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 Free Software Foundation, Inc.
+;;   2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help, internal
@@ -113,7 +113,8 @@ With ARG, you are asked to choose which language."
      (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)
@@ -251,6 +252,7 @@ face (according to `face-differs-from-default-p')."
                          "\\)"
                          "\\(?: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)))))
@@ -532,7 +534,8 @@ it is displayed along with the global value."
                         (error nil))))
                  (when location
                    (with-current-buffer (car location)
-                     (goto-char (cdr location))
+                     (when (cdr location)
+                       (goto-char (cdr location)))
                      (when (re-search-backward
                             "^;;; Generated autoloads from \\(.*\\)" nil t)
                        (setq file-name (match-string 1)))))))
@@ -554,10 +557,10 @@ it is displayed along with the global value."
                        (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
@@ -628,6 +631,7 @@ it is displayed along with the global value."
                              (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)
@@ -639,6 +643,13 @@ it is displayed along with the global value."
                 (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.