jpw> GNU Emacs' `mouse-position' returns positional
values based
jpw> on standard character cells, even if the cursor isn't over a
jpw> character.
Is this broken according to their doc, or do they have a different
specification for the function?
It is fine according to their doc, and makes some sense because they
return (FRAME X . Y) rather than (WINDOW X . Y)
Presently, XEmacs avoid.el occaisionally wants to treat
(car (mouse-position)) as a frame :-/
Either way, someone should get in
touch with the GNU Emacs project to adjust this. I have my
preferences, see below.
jpw> I guess `mouse-position' could do something similar,
or
jpw> preferably better. I don't know whether any XEmacs specific
jpw> code relies upon `mouse-position' returning (nil nil) when
jpw> not over a character though.
The code you wrote is broken for proportional fonts, and for many
historical character cell fonts.
Well, hence "brain-damage", "I wanna lose!"...
Consider any buffer containing
native widgets. (What _should_ `mouse-position' do in that case, I
wonder?)
Dunno what it should do, it'll probably end up punting by returning
(nil nil).
However, rather than make a new function or break
`mouse-position', I would add a new (keyword) argument :force-estimate,
which would estimate based on distance from current line-ending to
mouse xpos, and current baseline to mouse ypos
That sounds neat.
--
John Paul Wallington