emacs-devel
[Top][All Lists]
Advanced

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

Re: [BUG] widget :help-echo property different between XEmacs & Emacs


From: William M. Perry
Subject: Re: [BUG] widget :help-echo property different between XEmacs & Emacs
Date: Wed, 15 Nov 2000 09:12:07 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.90

Dave Love <address@hidden> writes:

> >>>>> "WMP" == William M Perry <address@hidden> writes:
> 
>  WMP> This is incompatible with both the old way of doing things and
>  WMP> XEmacs, and made me put the following patch into Emacs/W3.  Ugh.
> 
> I don't recall this stuff well, but as far as I remember, the facility
> didn't seem to be used anywhere -- I guess I didn't look hard enough --
> and was completely undocumented.  Is there doc for this?  What is
> supposed to happen and what would be necessary for XEmacs compatibility?
> I seem to remember that some basic things are incompatible for one reason
> or another.  I don't remember whether we've used :help-echo functions
> anywhere in Emacs 21.

I don't see anybody else that is using them with a quick grep thru the
source, but Emacs/W3 uses them exclusively.  This is because the state of
a hyperlink may change, or the contents of a form element, etc.  Emacspeak
support relies on this behaviour.

> I'm not sure exactly what this means to implement:
> 
>  WMP> Any chance we could get a wrapper put in wid-edit.el
>  WMP> (widget-specify-field to be exact) 
> 
> (Why) should that be different from the button code?

What I meant was anywhere we use the help-echo property, we should use a
generic callback function to map Emacs' idea of what help-echo gets
(buffer, object, and position), to what widget's idea of :help-echo gets
(just the widget).  I thought this was isolated in widget-specify-field,
but after reading the code some more I see I was wrong.

Something along the lines of:

(defun widget-help-echo-translator (window obj pos)
  (let (widget help)
    (save-excursion
      (set-buffer (window-buffer widget))
      (setq widget (widget-at pos)
            help (and widget (widget-get widget :help-echo)))
      (if (functionp help)
          (setq help (funcall help widget)))
      help)))

And everywhere that currently calls (widget-get widget :help-echo) could
call widget-get-help-echo instead:

(defun widget-get-help-echo (widget)
  (let ((help (widget-get widget :help-echo)))
    (if (functionp help)
        'widget-help-echo-translator
      help)))

>  WMP> to use a generic help-echo function that uses the old behaviour
>  WMP> in the case the :help-echo property is not a simple string?
> 
>  WMP> There should at least be mention of this in NEWS or the
>  WMP> documentation for the widget library.
> 
> I agree documentation should exist.  The widget doc has had work done but
> doubtless needs more -- I know I've had trouble writing widget code.  If
> this does merit a NEWS entry, presumably other additions to the wid-edit
> do too, specifically the image stuff which is probably also
> incompatible...  Guidance welcome.

I wish I didn't suck so badly at writing documentation. :(

-bp



reply via email to

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