Upgraded to MH-E version 7.4.80.
[bpt/emacs.git] / lisp / help-fns.el
index e069211..e534c69 100644 (file)
@@ -181,14 +181,14 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 ARG2 ...)\"."
   (unless (stringp docstring) (setq docstring "Not documented"))
   (if (or (string-match "\n\n(fn\\(\\( .*\\)?)\\)\\'" docstring) (eq arglist t))
       docstring
-    (format "%s%s%S" docstring
+    (concat docstring
            (if (string-match "\n?\n\\'" docstring)
                (if (< (- (match-end 0) (match-beginning 0)) 2) "\n" "")
              "\n\n")
            (if (and (stringp arglist)
                     (string-match "\\`([^ ]+\\(.*\\))\\'" arglist))
                (concat "(fn" (match-string 1 arglist) ")")
-             (help-make-usage 'fn arglist)))))
+             (format "%S" (help-make-usage 'fn arglist))))))
 
 (defun help-function-arglist (def)
   ;; Handle symbols aliased to other symbols.
@@ -237,14 +237,20 @@ KIND should be `var' for a variable or `subr' for a subroutine."
            (concat "src/" file)
          file)))))
 
+;;;###autoload
+(defface help-argument-name '((((supports :slant italic)) :inherit italic))
+  "Face to highlight argument names in *Help* buffers."
+  :group 'help)
+
 (defun help-default-arg-highlight (arg)
   "Default function to highlight arguments in *Help* buffers.
-It returns ARG in lowercase italics, if the display supports it;
-else ARG is returned in uppercase normal."
-  (let ((attrs '(:slant italic)))
-    (if (display-supports-face-attributes-p attrs)
-        (propertize (downcase arg) 'face attrs)
-      arg)))
+It returns ARG in face `help-argument-name'; ARG is also
+downcased if it displays differently than the default
+face (according to `face-differs-from-default-p')."
+  (propertize (if (face-differs-from-default-p 'help-argument-name)
+                  (downcase arg)
+                arg)
+              'face 'help-argument-name))
 
 (defun help-do-arg-highlight (doc args)
   (with-syntax-table (make-syntax-table emacs-lisp-mode-syntax-table)
@@ -275,6 +281,7 @@ else ARG is returned in uppercase normal."
             (next (not (or args (looking-at "\\["))))
             (opt nil))
         ;; Make a list of all arguments
+        (skip-chars-forward "^ ")
         (while next
           (or opt (not (looking-at " &")) (setq opt t))
           (if (not (re-search-forward " \\([\\[(]*\\)\\([^] &)\.]+\\)" nil t))