From fef3a3ab7c63a3e9d399b90e75dbd28b129e16f0 Mon Sep 17 00:00:00 2001 From: Juanma Barranquero Date: Sun, 9 May 2004 00:45:49 +0000 Subject: [PATCH] (help-highlight-arguments): Don't try to highlight missing or autoloaded arglists. Accept structured arguments, like the first ones of `do' and `flet'. --- lisp/help-fns.el | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index f19bdbf1c35..51850288b70 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -45,10 +45,10 @@ If there's no tutorial in that language, `TUTORIAL' is selected. 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 @@ KIND should be `var' for a variable or `subr' for a subroutine." (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 @@ KIND should be `var' for a variable or `subr' for a subroutine." (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) -- 2.39.2