unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Cecilio Pardo <cpardo@imayhem.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 74423@debbugs.gnu.org
Subject: bug#74423: Low level key events
Date: Tue, 19 Nov 2024 21:05:06 +0100	[thread overview]
Message-ID: <705fabb8-1ea0-4894-8c32-05097ab822c9@imayhem.com> (raw)
In-Reply-To: <jwv4j43jisn.fsf-monnier+emacs@gnu.org>

On 19/11/2024 17:43, Stefan Monnier wrote:

>> +         ((functionp func) (funcall func))
>> +         ((eq 'hyper func)
>> +          (message "H-...")
>> +          (let ((r (read-event)))
>> +            (setq unread-command-events
>> +                  (list (event-apply-modifier
>> +                         r 'hyper 24 "H-"))))))))))
> 
> Move that code to a function, so you can get rid of this `hyper`
> special case.  BTW, any reason why you couldn't use
> `event-apply-hyper-modifier`?

No, no reason. I will change that.

> I think the list of low-level keys handled here should not be hard-coded.
> IOW, maybe `enable-low-level-keys` should not be a boolean but
> a list/map/table indicating which keys to handle.

I was sending the keys for which I have an immediate use case. Using a 
list looks got, adding some special symbols to choose groups, such as 
"all modifier keys".

> So, IIUC you might generate 2 low-level events for a single key press?
> Why?

We want to allow to detect modifier keys, regardless of the key that is 
used. For example, when you press Shift_L we generate an event for 
'lshift and other (of different type) for the modifier 'shift.

> Other note: in the distant past (back around Emacs-21) I seem to
> remember Gerd making changes to the event structure so as to avoid
> allocating Lisp objects for this code.  I think it was related to
> problems due to running this low-level event-handler code from within
> a C signal handler, which is a practice was have since stopped, luckily,
> but maybe there are still good reasons to try and avoid involving
> allocating objects into the Lisp heap in this low-level code.

I will look into this.

Thanks for your comments!







  reply	other threads:[~2024-11-19 20:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fb50ec11-7aec-481e-8a3a-ecdcf22eb7c0@imayhem.com>
     [not found] ` <31bdc55d-8c13-4de0-9cef-bd6cc4fb033f@imayhem.com>
     [not found]   ` <s1r8qtzsvbe.fsf@yahoo.com>
2024-11-18 20:35     ` bug#74423: Low level key events Cecilio Pardo
2024-11-18 23:49       ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-19 15:29       ` Eli Zaretskii
2024-11-19 16:43       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-19 20:05         ` Cecilio Pardo [this message]
2024-11-20  4:21           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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=705fabb8-1ea0-4894-8c32-05097ab822c9@imayhem.com \
    --to=cpardo@imayhem.com \
    --cc=74423@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).