[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Improved help from minibuffer prompts
From: |
Juanma Barranquero |
Subject: |
Re: Improved help from minibuffer prompts |
Date: |
Fri, 30 Apr 2004 15:39:24 +0200 |
On 30 Apr 2004 12:08:47 +0200
address@hidden (Kim F. Storm) wrote:
> I have applied your patch locally; I'll use it for a while before
> I'll make a judgement.
Please, try this one instead. It's a bit less elegant because of the
support for CL-style optional arguments, but it works in all tests cases
I've tried.
> But initially, I like it.
Glad to hear.
Juanma
--- help-fns.el.orig 2004-04-30 15:31:10.000000000 +0200
+++ help-fns.el 2004-04-30 15:28:47.000000000 +0200
@@ -131,4 +131,33 @@
;; Functions
+(defun help-highlight-arguments (fun &rest args)
+ (save-excursion
+ (goto-char (point-min))
+ (let* ((case-fold-search nil)
+ (next (and (not args)
+ (re-search-forward (concat "(" (symbol-name fun)) nil
t))))
+ (save-restriction
+ (narrow-to-region (point) (re-search-forward ")\n" nil t))
+ (goto-char (point-min))
+ ;; Make a list of all arguments
+ (while next
+ (if (not (re-search-forward " \\((?\\)\\([^ &\)\.]+\\)" nil t))
+ (setq next nil)
+ (setq args (cons (match-string 2) args))
+ (unless (string= (match-string 1) "")
+ ;; A pesky CL-style optional argument with default value,
+ ;; so let's skip over it
+ (search-backward "(")
+ (goto-char (scan-sexps (point) 1))))))
+ ;; Highlight all found arguments anywhere in the *Help* buffer
+ (while args
+ (let* ((arg (car args))
+ (solo (concat "\\<\\(" arg "\\)e?s?\\>"))
+ (high (propertize arg 'face 'font-lock-variable-name-face)))
+ (setq args (cdr args))
+ (goto-char (point-min))
+ (while (re-search-forward solo nil t)
+ (replace-match high nil t nil 1)))))))
+
;;;###autoload
(defun describe-function (function)
@@ -156,4 +185,6 @@
(print-help-return-message)
(with-current-buffer standard-output
+ ;; highlight argument names
+ (help-highlight-arguments function)
;; Return the text we displayed.
(buffer-string))))))
- Re: Improved help from minibuffer prompts, (continued)
- Re: Improved help from minibuffer prompts, Stefan Reichör, 2004/04/15
- Re: Improved help from minibuffer prompts, Richard Stallman, 2004/04/16
- Re: Improved help from minibuffer prompts, Kim F. Storm, 2004/04/16
- Re: Improved help from minibuffer prompts, Richard Stallman, 2004/04/17
- Re: Improved help from minibuffer prompts, Stefan Reichör, 2004/04/19
- Re: Improved help from minibuffer prompts, Kim F. Storm, 2004/04/19
- Re: Improved help from minibuffer prompts, Juanma Barranquero, 2004/04/29
- Re: Improved help from minibuffer prompts, Stefan Reichör, 2004/04/30
- Re: Improved help from minibuffer prompts, Juanma Barranquero, 2004/04/30
- Re: Improved help from minibuffer prompts, Kim F. Storm, 2004/04/30
- Re: Improved help from minibuffer prompts,
Juanma Barranquero <=
- Re: Improved help from minibuffer prompts, Kim F. Storm, 2004/04/30
- Re: Improved help from minibuffer prompts, Juanma Barranquero, 2004/04/30
- Re: Improved help from minibuffer prompts, Stefan Monnier, 2004/04/30
- Re: Improved help from minibuffer prompts, Juanma Barranquero, 2004/04/30
- Re: Improved help from minibuffer prompts, Stefan Monnier, 2004/04/30
- Re: Improved help from minibuffer prompts, Juanma Barranquero, 2004/04/30
- RE: Improved help from minibuffer prompts, Drew Adams, 2004/04/19
- Re: Improved help from minibuffer prompts, Richard Stallman, 2004/04/20
- RE: Improved help from minibuffer prompts, Drew Adams, 2004/04/20
- Re: Improved help from minibuffer prompts, Eli Zaretskii, 2004/04/21