From: Dov Grobgeld <dov.grobgeld@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Yuri Khan <yuri.v.khan@gmail.com>,
manikulin@gmail.com, emacs-devel@gnu.org
Subject: Re: Physical keyboard events
Date: Wed, 30 Oct 2024 21:26:21 +0200 [thread overview]
Message-ID: <CA++fsGEJ4-mX=0FmhwmHBzVmjOORrNaHp9NvoJy7OTdNFatEYg@mail.gmail.com> (raw)
In-Reply-To: <86frod4hl9.fsf@gnu.org>
Switching to a different keyboard language causes all navigation
keyboard shortcuts to fail by default. This is why I found myself
adding the following to my .emacs file. I agree it would be nice if
there was some automatic way of creating this mapping, but using
keycodes, does not seem to be a correct way to do it.
;; some motion bindings in Hebrew mode that reflect key
;; positions for Dvorak.
(global-set-key [(control ?ש)] 'move-beginning-of-line)
(global-set-key [(control ?ג)] 'move-end-of-line)
(global-set-key [(control ?ר)] 'previous-line)
(global-set-key [(control ?ך)] 'next-line)
(global-set-key [(control ?ה)] 'kill-line)
(global-set-key [(control ?ף)] 'isearch-forward)
(global-set-key [(control ?ם)] 'isearch-backward)
(global-set-key [(control ?ץ)] 'scroll-up-command)
(global-set-key [(meta ?ץ)] 'scroll-down-command)
(global-set-key [(meta ?ט)] 'forward-word)
(global-set-key [(control ?ט)] 'forward-char)
(global-set-key [(meta ?מ)] 'backward-word)
(global-set-key [(control ?מ)] 'backward-char)
(define-key isearch-mode-map [(control ?ף)] 'isearch-repeat-forward)
(define-key isearch-mode-map [(control ?ם)] 'isearch-repeat-backward)
(global-set-key [(control ?נ) (control ?ף)] 'save-buffer)
On Wed, Oct 30, 2024 at 7:38 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: Yuri Khan <yuri.v.khan@gmail.com>
> > Date: Thu, 31 Oct 2024 00:13:31 +0700
> > Cc: manikulin@gmail.com, emacs-devel@gnu.org
> >
> > On Wed, 30 Oct 2024 at 22:27, Eli Zaretskii <eliz@gnu.org> wrote:
> >
> > > > From: Yuri Khan <yuri.v.khan@gmail.com>
> > > > Date: Wed, 30 Oct 2024 13:28:20 +0700
> > > > Cc: emacs-devel@gnu.org
> >
> > > > I’m going to posit the hypothesis that the *only* command for which it
> > > > makes sense to use the keysym of the current layout is
> > > > ‘self-insert-command’.
> > > >
> > > > Everything else wants the keysym of “the” Latin-based layout if there
> > > > is one and only one; the keycode if there is none; and some heuristic
> > > > tiebreaker for the case where the user has more than one Latin-based
> > > > layout configured.
> > >
> > > How do you suggest to arrange for a low-level keyboard interface to
> > > know which kind of Emacs command attempted to read the keyboard?
> >
> > Since it’s not clairvoyant, it would need to save enough information
> > for the keymap lookup code downstream. Specifically (XKB/X11 case):
> > state of modifiers, keycode, keysym according to the currently active
> > group, and keysym according to the appropriate Latin-based group.
> >
> > Then, at the time of keymap lookup:
> >
> > * Look up the active modifiers + active group keysym.
> > * If this yields ‘self-insert-command’ or another command
> > specifically whitelisted, return that.
> > * Look up the active modifiers + keysym from the Latin-based group. Return that.
>
> How do you know which keymap to look up and for which character,
> before you decide which character to produce?
>
> > Test case: If a mode keymap binds both ‘/’ and ‘.’, and a key produces
> > ‘/’ in the Latin layout and ‘.’ in Cyrillic layout, then the ‘/’
> > command shall be executed regardless of whether Latin or Cyrillic
> > layout is active.
>
> What if '/' is bound to self-insert-command, but '.' to something
> else: what do you return then?
>
next prev parent reply other threads:[~2024-10-30 19:26 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 23:15 Physical keyboard events Cecilio Pardo
2024-10-29 13:40 ` Eli Zaretskii
2024-10-29 15:07 ` Cecilio Pardo
2024-10-29 15:38 ` Peter Feigl
2024-10-29 17:54 ` Cecilio Pardo
2024-10-29 23:41 ` James Thomas
2024-10-29 16:44 ` Eli Zaretskii
2024-10-29 16:55 ` Yuri Khan
2024-10-29 17:46 ` Eli Zaretskii
2024-10-30 2:56 ` Max Nikulin
2024-10-30 6:28 ` Yuri Khan
2024-10-30 6:39 ` Peter Feigl
2024-10-30 15:27 ` Eli Zaretskii
2024-10-30 17:13 ` Yuri Khan
2024-10-30 17:37 ` Eli Zaretskii
2024-10-30 19:26 ` Dov Grobgeld [this message]
2024-10-30 19:36 ` Juri Linkov
2024-10-30 19:55 ` Eli Zaretskii
2024-10-30 15:21 ` Eli Zaretskii
2024-10-30 16:59 ` Max Nikulin
2024-10-29 17:56 ` Cecilio Pardo
2024-10-29 17:52 ` Cecilio Pardo
2024-10-29 17:13 ` Alan Mackenzie
2024-10-29 18:20 ` Cecilio Pardo
2024-10-29 19:31 ` Alan Mackenzie
2024-10-29 21:45 ` Cecilio Pardo
2024-10-30 6:02 ` Yuri Khan
2024-10-30 15:23 ` Eli Zaretskii
2024-10-30 16:51 ` Yuri Khan
2024-10-30 17:25 ` Eli Zaretskii
2024-10-30 3:27 ` Eli Zaretskii
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='CA++fsGEJ4-mX=0FmhwmHBzVmjOORrNaHp9NvoJy7OTdNFatEYg@mail.gmail.com' \
--to=dov.grobgeld@gmail.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=manikulin@gmail.com \
--cc=yuri.v.khan@gmail.com \
/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).