all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Question for help-echo property
@ 2002-12-07  9:43 Klaus Berndl
       [not found] ` <m2vg25biet.fsf@nyaumo.btinternet.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Klaus Berndl @ 2002-12-07  9:43 UTC (permalink / raw)



I have a problem with a function as value for the help-echo property (I'm not
sure if this is a bug or if i have not understood the help-echo stuff right?!)

Please do the following test (I'm using NTEmacs 21.2. with Windows XP):

1. Start a vanilla Emacs with "emacs -q -no-site-file"

2. Evaluate the following small code in the *scratch* buffer:

(defun klaus-insert-line (text)
  (let ((p (point)))
    (insert text)
    (put-text-property p (+ p (length text)) 'mouse-face 'highlight)
    (put-text-property p (+ p (length text)) 'help-echo
                       'klaus-help-echo-fn)
    (insert "\n")))

(defun klaus-help-echo-fn (win obj pos)
  (message "Position: %d" pos))

(defun klaus-test ()
  (interactive)
  (klaus-insert-line "This is a test line")
  (klaus-insert-line "here is another one")
  (klaus-insert-line "Line Line Line")
  (klaus-insert-line "I think this is enough")
  (klaus-insert-line "last line"))

3. Call M-x klaus-test RET at the end of the scratch buffer. Then you will
have the following text inserted:

This is a test line
here is another one
Line Line Line
I think this is enough
last line


Now please begin to move the mouse over the newly inserted text, e.g. over the
'T' in the first line "This is a test line". OK, then in the minibuffer
"Position: 765" is displayed (or whatever position the 'T' has). Fine!

But now continue moving the mouse down slowly over the first chars in every
line, ie. you move from the 'T' to the 'h', stop, then over the 'L', stop, the
'I', stop and at least over the 'l' of the last line. If i understand the
help-echo stuff right, after every move the displayed position should be
change, because after every move another position is under the mouse pointer.

But what happens is: If you begin moving over the 'T' then a the position of
the 'T' is displayed, but this position is never changes after the following
moves, ie. the function 'klaus-help-echo-fn' is only called once!

Even more: After every move from a buffer-position which has *NO* help-echo
property to a position which *HAS* a help-property all is working fine (ie.
the correct position of the character under the mouse is displayed) but after
a move from a position which *has* *already* a help-echo property to a new
position which has a help-property too nothing happens, means the
help-echo-property function is *NOT* called.

==> Seems the help-echo function 'klaus-help-echo-fn' is only called if moving
the mouse from a "no-help-echo"-property to a position with a
help-echo-property but not if moving from one help-echo-property-position to
another one? is this a bug or a feature? ;-)

Another aspect: If i use a string instead a function for the help-property all
is working fine: Please change the function 'klaus-insert-line' as follows:

(defun klaus-insert-line (text)
  (let ((p (point)))
    (insert text)
    (put-text-property p (+ p (length text)) 'mouse-face 'highlight)
    (put-text-property p (+ p (length text)) 'help-echo
                       text)
    (insert "\n")))

Now the help-echo property has the text of the line as value instead of a
function. Now performing the same test as described above all is working fine,
i.e. regardless from where i move always the right text is displayed in the
minibuffer!

Sorry for this long text but i do not know how to describe my problem in a
shorter way...

Any thoughts of the Gurus?

BTW: If i remember right, the stuff with a function as value for the
help-property has already worked well, and i suppose this was with Emacs 21.1.
Now I'm using 21.2.! Is is possible that concerning help-echo something has
changed??  But unfortuntelly i can not say at 100% if my suspicion is right!

Many thanks in advance!  Klaus

-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question for help-echo property
       [not found] ` <m2vg25biet.fsf@nyaumo.btinternet.com>
@ 2002-12-09  8:31   ` Klaus Berndl
  2002-12-10  0:04     ` Jason Rumney
  0 siblings, 1 reply; 3+ messages in thread
From: Klaus Berndl @ 2002-12-09  8:31 UTC (permalink / raw)


On Sun, 8 Dec 2002, Jason Rumney wrote:



>  Klaus Berndl <Klaus.Berndl@sdm.de> writes:
>  
> >     (put-text-property p (+ p (length text)) 'help-echo
> >                        'klaus-help-echo-fn)
> > 
> > (defun klaus-help-echo-fn (win obj pos)
> >   (message "Position: %d" pos))

Yes, you are right. But this doesn' matter for the described problem...

>  
>  This results in both message and help-echo displaying the same thing
>  in the mode-line. It would be better to use format rather than
>  message.
>  
> > BTW: If i remember right, the stuff with a function as value for the
> > help-property has already worked well, and i suppose this was with Emacs
> > 21.1. Now I'm using 21.2.! Is is possible that concerning help-echo
> > something has changed??
>  
>  I recall some bugs were fixed in the MS-Windows code to prevent
>  excessive redisplaying of help-echo in the minibuffer which was causing
>  CPU usage to approach 100% in some cases.

Of course this would be bad

>  Perhaps the fix went too far.

Can you reproduce my problem description?



-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG				http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Question for help-echo property
  2002-12-09  8:31   ` Klaus Berndl
@ 2002-12-10  0:04     ` Jason Rumney
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Rumney @ 2002-12-10  0:04 UTC (permalink / raw)


Klaus Berndl <Klaus.Berndl@sdm.de> writes:

> Can you reproduce my problem description?

Not in the Emacs I am currently using, but that is the current CVS on
GNU/Linux.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-10  0:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-07  9:43 Question for help-echo property Klaus Berndl
     [not found] ` <m2vg25biet.fsf@nyaumo.btinternet.com>
2002-12-09  8:31   ` Klaus Berndl
2002-12-10  0:04     ` Jason Rumney

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.