changeset 55454:3b8721850659

(help-highlight-arguments): Don't try to highlight missing or autoloaded arglists. Accept structured arguments, like the first ones of `do' and `flet'.
author Juanma Barranquero <lekktu@gmail.com>
date Sun, 09 May 2004 00:45:49 +0000
parents 839940e38326
children c1c4318a2189
files lisp/help-fns.el
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/help-fns.el	Sat May 08 19:51:35 2004 +0000
+++ b/lisp/help-fns.el	Sun May 09 00:45:49 2004 +0000
@@ -45,10 +45,10 @@
 With ARG, you are asked to choose which language."
   (interactive "P")
   (let ((lang (if arg
-		    (let ((minibuffer-setup-hook minibuffer-setup-hook))
-		      (add-hook 'minibuffer-setup-hook
-				'minibuffer-completion-help)
-		      (read-language-name 'tutorial "Language: " "English"))
+                  (let ((minibuffer-setup-hook minibuffer-setup-hook))
+                    (add-hook 'minibuffer-setup-hook
+                              'minibuffer-completion-help)
+                    (read-language-name 'tutorial "Language: " "English"))
 		(if (get-language-info current-language-environment 'tutorial)
 		    current-language-environment
 		  "English")))
@@ -253,17 +253,16 @@
 
 (defun help-highlight-arguments (usage doc &rest args)
   (when usage
-    (let ((case-fold-search nil)
-          (next (not args))
-          (opt nil))
-      ;; Make a list of all arguments
-      (with-temp-buffer
-        (insert usage)
-        (goto-char (point-min))
+    (with-temp-buffer
+      (insert usage)
+      (goto-char (point-min))
+      (let ((case-fold-search nil)
+            (next (not (or args (looking-at "\\["))))
+            (opt nil))
         ;; Make a list of all arguments
         (while next
           (or opt (not (looking-at " &")) (setq opt t))
-          (if (not (re-search-forward " \\([\\[(]?\\)\\([^] &)\.]+\\)" nil t))
+          (if (not (re-search-forward " \\([\\[(]*\\)\\([^] &)\.]+\\)" nil t))
               (setq next nil)
             (setq args (cons (match-string 2) args))
             (when (and opt (string= (match-string 1) "("))
@@ -272,11 +271,11 @@
               (search-backward "(")
               (goto-char (scan-sexps (point) 1)))))
         ;; Highlight aguments in the USAGE string
-        (setq usage (help-do-arg-highlight (buffer-string) args)))
-      ;; Highlight arguments in the DOC string
-      (setq doc (and doc (help-do-arg-highlight doc args)))
-      ;; Return value is like the one from help-split-fundoc, but highlighted
-      (cons usage doc))))
+        (setq usage (help-do-arg-highlight (buffer-string) args))))
+    ;; Highlight arguments in the DOC string
+    (setq doc (and doc (help-do-arg-highlight doc args)))
+    ;; Return value is like the one from help-split-fundoc, but highlighted
+    (cons usage doc)))
 
 ;;;###autoload
 (defun describe-function-1 (function)