emacs-devel
[Top][All Lists]
Advanced

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

Re: Getting the click position in a string


From: David Kastrup
Subject: Re: Getting the click position in a string
Date: Tue, 25 Apr 2006 16:55:28 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

address@hidden (Kim F. Storm) writes:

> David Kastrup <address@hidden> writes:
>
>> Hi,
>>
>> I am trying to fix mouse.el so that it can heed follow-link properties
>> in display strings.  But it does not appear that the mouse click info
>> gives the requisite position information: there is posn-string, and
>> there is posn-point, but it does not look like there is
>> posn-string-pos or whatever else which would be able to pinpoint the
>> actual position within a string that is used as a display property or
>> before-string or after-string.
>
> It should be there -- 
>
> posn-string should return a cons ("string" . POS)

Uh, what?

posn-string is a compiled Lisp function in `subr.el'.
(posn-string POSITION)

Return the string object of POSITION, or nil if a buffer position.
POSITION should be a list of the form returned by the `event-start'
and `event-end' functions.

[back]


I am afraid that the help string does not suggest that.  "string
object" is not really a well-known term in my book and amounts to a
string in my naive connotations.  It appears that indeed a cons is
returned.

Similarly for

posn-object is a compiled Lisp function in `subr.el'.
(posn-object POSITION)

Return the object (image or string) of POSITION.
POSITION should be a list of the form returned by the `event-start'
and `event-end' functions.

[back]

I mean, how is one supposed to guess that "image or string" is
actually going to be a cons?

I am not sure that the name of those functions is well-chosen.  But
irrespective of that, the doc strings are less than helpful here.  We
need to do something about that.

Personally, I'd have expected posn-object and posn-string to just
return the image or string, and then have a separate posn-offset or
posn-object-pos or so that will deliver the corresponding offset _if_
there is such a one.

That would seem somewhat natural.

Sorry for noticing this only now.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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