[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help-echo in Custom

From: Luc Teirlinck
Subject: help-echo in Custom
Date: Thu, 14 Aug 2003 11:46:56 -0500 (CDT)

The CVS Elisp manual seems to suggest that the syntax for help-echo's
used in :help-echo type keywords in Custom is exactly the same as for
`help-echo' text properties used elsewhere. In Info do: 

(elisp)Type Keywords

There we find:

`:help-echo MOTION-DOC'
     When you move to this item with `widget-forward' or
     `widget-backward', it will display the string MOTION-DOC in the
     echo area.  In addition, MOTION-DOC is used as the mouse
     `help-echo' string and may actually be a function or form
     evaluated to yield a help string as for `help-echo' text

First of all, :help-echo type keywords in Custom can not be variables
evaluating to strings.  I guess this one is just a bug and can be
fixed by putting two eval's in the last two lines of

(defun widget-echo-help (pos)
  "Display help-echo text for widget at POS."
  (let* ((widget (widget-at pos))
   (help-echo (and widget (widget-get widget :help-echo))))
    (if (functionp help-echo)
    (setq help-echo (funcall help-echo widget)))
    (if (stringp (eval help-echo))
    (message "%s" (eval help-echo)))))

There also is a fundamental difference in functional help-echo's.
Such help-echo's written for :help-echo type keywords in Custom have
to take one argument WIDGET.  help-echo's written for text properties
take three arguments.

Custom apparently goes to quite some length to do this conversion: it
actually uses `widget-mouse-help' as a place-holder 'echo-help
property with three arguments and then makes that one call the one
argument function:

(defun widget-mouse-help (window overlay point)
  "Help-echo callback for widgets whose :help-echo is a function."
  (with-current-buffer (overlay-buffer overlay)
    (let* ((widget (widget-at (overlay-start overlay)))
       (help-echo (if widget (widget-get widget :help-echo))))
      (if (functionp help-echo)
        (funcall help-echo widget)

Is this intentional (to make all the information in WIDGET available
to the function)?  If so, the documentation in the Elisp manual is not
only incomplete, but misleading.

If this is an unintentional bug, then I could send a test case
illustrating the problem, if desired.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]