From: David Kastrup <dak@gnu.org>
Cc: cyd@stupidchicken.com, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: local keymap patch for key-binding
Date: Wed, 13 Sep 2006 14:32:28 +0200 [thread overview]
Message-ID: <853bawj6ar.fsf@lola.goethe.zz> (raw)
In-Reply-To: <m3bqpk3qh6.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Wed\, 13 Sep 2006 14\:23\:17 +0200")
storm@cua.dk (Kim F. Storm) writes:
> David Kastrup <dak@gnu.org> writes:
>
>> storm@cua.dk (Kim F. Storm) writes:
>>
>>> Your patch still looks good to me.
>>
>> Well, I could not witness any adverse effect after some testing, it
>> tracks the behavior of read-key-sequence closely.
>>
>> There is one concern that I have: the type of the "location" argument.
>> This currently is a key sequence. But it might make more sense to
>> turn this into the "location" data structure that `event-start' and/or
>> `event-end' return. This would make it much easier to feed lookup-key
>> with data produced from, say, `posn-at-x-y'.
>
> I overlooked that part -- I actually thought it was such a location.
>
>> In order to get this data easier, it might make sense to define a
>> convenience function.
>>
>> (defun key-event (key)
>> "Return event from moused-base key sequence KEY."
>> (and (vectorp key)
>> (if (consp (aref key 0))
>> (aref key 0)
>> (and
>> (symbolp (aref key 0))
>> (> (length key) 1)
>> (consp (aref key 1))
>> (aref key 1)))))
>>
>> Maybe even in C, as this function can be executed without consing.
>
> That is usually not the normal way to decide what should be in C...
>
>> I found that the current usage in the help echo fixup stuff does
>> not even have a key sequence to start from, just a mouse position.
>>
>> So it would likely make more sense to rework the location argument
>> type to just be a mouse position.
>
> in pixels or chars?
In the form returned by `event-start' or `posn-at-x-y'. One does not
want to look up the object relations in the display matrix again,
since those may have changed since the event.
>> That seems like the most basic unit for this argument that still
>> makes sense.
>
> True, but shouldn't it accept both types ...
I don't see that this will buy much over using
(let ((event (key-event key)))
(key-binding whatever nil nil (and event (event-start event))))
once the convenience function key-event (or key-mouse-event or what
ever you want to call it) is present (note that (event-start nil) does
not return nil).
It also has the advantage that you can, if you want to, do a lookup in
the keymaps at the _end_ of a drag event.
> if you already have the full event, it seems wasteful to first
> convert it to just a mouse position, pass that to key-binding and
> then use that to derive what the original event was (eg. using
> posn-at-x-y).
No, I am afraid you misunderstood. I mentioned `posn-at-x-y' only for
the case where indeed nothing but pixel coordinates exist.
I wanted to use a `location' argument as returned by `event-start'.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
next prev parent reply other threads:[~2006-09-13 12:32 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-10 9:34 longlines-mode doesn't seem to work with some non-english text Miles Bader
2006-02-11 4:35 ` Chong Yidong
2006-02-13 0:32 ` Kevin Ryde
2006-09-09 15:08 ` local keymap patch for key-binding Chong Yidong
2006-09-09 15:15 ` David Kastrup
2006-09-09 15:26 ` Chong Yidong
2006-09-10 12:44 ` Chong Yidong
2006-09-10 13:25 ` David Kastrup
2006-09-11 2:36 ` Chong Yidong
2006-09-11 6:25 ` David Kastrup
2006-09-11 7:05 ` David Kastrup
2006-09-11 8:52 ` Kim F. Storm
2006-09-11 9:48 ` David Kastrup
2006-09-11 10:11 ` David Kastrup
2006-09-11 12:53 ` Kim F. Storm
2006-09-11 13:04 ` David Kastrup
2006-09-11 13:07 ` Chong Yidong
2006-09-11 19:58 ` Richard Stallman
2006-09-12 10:04 ` David Kastrup
2006-09-12 15:21 ` David Kastrup
2006-09-12 15:39 ` PCL-CVS's diff and marks (was: local keymap patch for key-binding) Stefan Monnier
2006-09-12 15:42 ` PCL-CVS's diff and marks David Kastrup
2006-09-12 15:54 ` Stefan Monnier
2006-09-12 21:45 ` local keymap patch for key-binding Richard Stallman
2006-09-12 22:23 ` David Kastrup
2006-09-12 23:44 ` David Kastrup
2006-09-13 7:45 ` Kim F. Storm
2006-09-13 8:11 ` David Kastrup
2006-09-13 11:05 ` Kim F. Storm
2006-09-13 11:38 ` David Kastrup
2006-09-13 12:23 ` Kim F. Storm
2006-09-13 12:32 ` David Kastrup [this message]
2006-09-13 13:45 ` Kim F. Storm
2006-09-13 19:25 ` Richard Stallman
2006-09-13 19:49 ` David Kastrup
2006-09-13 19:25 ` Richard Stallman
2006-09-13 20:02 ` David Kastrup
2006-09-13 19:24 ` Richard Stallman
2006-09-13 15:10 ` Richard Stallman
2006-09-13 15:25 ` David Kastrup
2006-09-14 2:34 ` Richard Stallman
2006-09-14 11:57 ` David Kastrup
2006-09-14 22:34 ` David Kastrup
2006-09-14 22:36 ` David Kastrup
2006-09-15 3:14 ` Richard Stallman
2006-09-15 8:20 ` David Kastrup
2006-09-15 23:47 ` David Kastrup
2006-09-16 0:14 ` Kim F. Storm
2006-09-16 19:05 ` Richard Stallman
2006-09-18 15:43 ` David Kastrup
2006-09-18 20:34 ` Kim F. Storm
2006-09-18 23:39 ` Richard Stallman
2006-09-16 16:41 ` Stefan Monnier
2006-09-10 18:52 ` Richard Stallman
2006-09-11 2:39 ` Chong Yidong
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=853bawj6ar.fsf@lola.goethe.zz \
--to=dak@gnu.org \
--cc=cyd@stupidchicken.com \
--cc=emacs-devel@gnu.org \
--cc=rms@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).