diff options
| author | Juanma Barranquero | 2004-05-07 22:41:22 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2004-05-07 22:41:22 +0000 |
| commit | 6aab5f13cdb9305efb3290b9abe02fe89276d48d (patch) | |
| tree | 9aac2d5da9ae3e742f294af6e4fdd72e58f0845e | |
| parent | e249a6d8e2c25465b51850d58487b2f41c826548 (diff) | |
| download | emacs-6aab5f13cdb9305efb3290b9abe02fe89276d48d.tar.gz emacs-6aab5f13cdb9305efb3290b9abe02fe89276d48d.zip | |
(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.
| -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." | |||
| 241 | "Face to highlight function arguments in docstrings.") | 241 | "Face to highlight function arguments in docstrings.") |
| 242 | 242 | ||
| 243 | (defun help-do-arg-highlight (doc args) | 243 | (defun help-do-arg-highlight (doc args) |
| 244 | (while args | 244 | (with-syntax-table (make-syntax-table emacs-lisp-mode-syntax-table) |
| 245 | (let ((arg (prog1 (car args) (setq args (cdr args))))) | 245 | (modify-syntax-entry ?\- "w") |
| 246 | (setq doc (replace-regexp-in-string | 246 | (while args |
| 247 | (concat "\\<\\(" arg "\\)\\(?:es\\|s\\|th\\)?\\>") | 247 | (let ((arg (prog1 (car args) (setq args (cdr args))))) |
| 248 | (propertize arg 'face 'help-argument-name) | 248 | (setq doc (replace-regexp-in-string |
| 249 | doc t t 1)))) | 249 | (concat "\\<\\(" arg "\\)\\(?:es\\|s\\|th\\)?\\>") |
| 250 | doc) | 250 | (propertize arg 'face 'help-argument-name) |
| 251 | doc t t 1)))) | ||
| 252 | doc)) | ||
| 251 | 253 | ||
| 252 | (defun help-highlight-arguments (usage doc &rest args) | 254 | (defun help-highlight-arguments (usage doc &rest args) |
| 253 | (when usage | 255 | (when usage |
| 254 | (let ((case-fold-search nil) | 256 | (let ((case-fold-search nil) |
| 255 | (next (not args))) | 257 | (next (not args)) |
| 258 | (opt nil)) | ||
| 256 | ;; Make a list of all arguments | 259 | ;; Make a list of all arguments |
| 257 | (with-temp-buffer | 260 | (with-temp-buffer |
| 258 | (insert usage) | 261 | (insert usage) |
| 259 | (goto-char (point-min)) | 262 | (goto-char (point-min)) |
| 260 | ;; Make a list of all arguments | 263 | ;; Make a list of all arguments |
| 261 | (while next | 264 | (while next |
| 265 | (or opt (not (looking-at " &")) (setq opt t)) | ||
| 262 | (if (not (re-search-forward " \\([\\[(]?\\)\\([^] &)\.]+\\)" nil t)) | 266 | (if (not (re-search-forward " \\([\\[(]?\\)\\([^] &)\.]+\\)" nil t)) |
| 263 | (setq next nil) | 267 | (setq next nil) |
| 264 | (setq args (cons (match-string 2) args)) | 268 | (setq args (cons (match-string 2) args)) |
| 265 | (when (string= (match-string 1) "(") | 269 | (when (and opt (string= (match-string 1) "(")) |
| 266 | ;; A pesky CL-style optional argument with default value, | 270 | ;; A pesky CL-style optional argument with default value, |
| 267 | ;; so let's skip over it | 271 | ;; so let's skip over it |
| 268 | (search-backward "(") | 272 | (search-backward "(") |