all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Getting the click position in a string
Date: Tue, 25 Apr 2006 16:55:28 +0200	[thread overview]
Message-ID: <85vesxso0v.fsf@lola.goethe.zz> (raw)
In-Reply-To: <m3hd4hk9hf.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Tue, 25 Apr 2006 16:36:44 +0200")

storm@cua.dk (Kim F. Storm) writes:

> David Kastrup <dak@gnu.org> 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	other threads:[~2006-04-25 14:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25  9:53 Getting the click position in a string David Kastrup
2006-04-25 14:36 ` Kim F. Storm
2006-04-25 14:55   ` David Kastrup [this message]
2006-04-26  8:13     ` Kim F. Storm
2006-04-26  8:17 ` David Kastrup
2006-04-26 11:32   ` Kim F. Storm
2006-04-26 11:56     ` David Kastrup
2006-04-26 12:52       ` David Kastrup
2006-04-26 12:54         ` David Kastrup
2006-04-26 13:58         ` Stefan Monnier
2006-04-27 12:08           ` David Kastrup
2006-04-27 16:05             ` Stefan Monnier
2006-04-27 18:33               ` David Kastrup
2006-04-27 21:24                 ` Stefan Monnier
2006-04-27 21:39                   ` David Kastrup
2006-04-28 16:16                     ` Stefan Monnier
2006-04-29 21:55                       ` David Kastrup
2006-04-29 23:33                         ` Stefan Monnier
2006-04-30 21:55                           ` David Kastrup
2006-05-01  0:48                             ` Stefan Monnier
2006-05-01  5:55                               ` David Kastrup
2006-05-01 12:52                                 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85vesxso0v.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.