diff options
author | Juanma Barranquero <lekktu@gmail.com> | 2004-05-07 22:41:22 +0000 |
---|---|---|
committer | Juanma Barranquero <lekktu@gmail.com> | 2004-05-07 22:41:22 +0000 |
commit | 6aab5f13cdb9305efb3290b9abe02fe89276d48d (patch) | |
tree | 9aac2d5da9ae3e742f294af6e4fdd72e58f0845e /lisp/help-fns.el | |
parent | e249a6d8e2c25465b51850d58487b2f41c826548 (diff) | |
download | emacs-6aab5f13cdb9305efb3290b9abe02fe89276d48d.tar.gz |
(help-do-arg-highlight): Temporarily set ?\- to be a word constituent so
FOO-ARG is not recognized as an arg.
(help-highlight-arguments): Don't skip lists in mandatory arguments.
Diffstat (limited to 'lisp/help-fns.el')
-rw-r--r-- | lisp/help-fns.el | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/help-fns.el b/lisp/help-fns.el index a94c0ed9dea..f19bdbf1c35 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -241,28 +241,32 @@ KIND should be `var' for a variable or `subr' for a subroutine." "Face to highlight function arguments in docstrings.") (defun help-do-arg-highlight (doc args) - (while args - (let ((arg (prog1 (car args) (setq args (cdr args))))) - (setq doc (replace-regexp-in-string - (concat "\\<\\(" arg "\\)\\(?:es\\|s\\|th\\)?\\>") - (propertize arg 'face 'help-argument-name) - doc t t 1)))) - doc) + (with-syntax-table (make-syntax-table emacs-lisp-mode-syntax-table) + (modify-syntax-entry ?\- "w") + (while args + (let ((arg (prog1 (car args) (setq args (cdr args))))) + (setq doc (replace-regexp-in-string + (concat "\\<\\(" arg "\\)\\(?:es\\|s\\|th\\)?\\>") + (propertize arg 'face 'help-argument-name) + doc t t 1)))) + doc)) (defun help-highlight-arguments (usage doc &rest args) (when usage (let ((case-fold-search nil) - (next (not args))) + (next (not args)) + (opt nil)) ;; Make a list of all arguments (with-temp-buffer (insert usage) (goto-char (point-min)) ;; Make a list of all arguments (while next + (or opt (not (looking-at " &")) (setq opt t)) (if (not (re-search-forward " \\([\\[(]?\\)\\([^] &)\.]+\\)" nil t)) (setq next nil) (setq args (cons (match-string 2) args)) - (when (string= (match-string 1) "(") + (when (and opt (string= (match-string 1) "(")) ;; A pesky CL-style optional argument with default value, ;; so let's skip over it (search-backward "(") |