GNU bug report logs - #72555
30.0.60; [PATCH] NS: support passing key events to the system

Previous Next

Package: emacs;

Reported by: Kai Ma <justksqsf <at> gmail.com>

Date: Sat, 10 Aug 2024 11:49:02 UTC

Severity: normal

Found in version 30.0.60

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72555 in the body.
You can then email your comments to 72555 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#72555; Package emacs. (Sat, 10 Aug 2024 11:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kai Ma <justksqsf <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 10 Aug 2024 11:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kai Ma <justksqsf <at> gmail.com>
To: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
Subject: 30.0.60; [PATCH] NS: support passing key events to the system
Date: Sat, 10 Aug 2024 13:47:48 +0200
[Message part 1 (text/plain, inline)]
The attached patch adds ns-pass-keys-to-system and makes Emacs to send
the key events to the system input manager when it's set.  This can
correct a number of problems that are hard to work around due to the
current key handling logic of Emacs NSport.

(1) The keydown event of Shift+Enter is never sent to the system input
method.  This causes an annoying problem for system input methods: if
you press Shift+Enter in Emacs (that is three events: Shift down,
Shift+Enter down, Shift up), the input method only sees Shift down and
up.  However, many input methods interprets a click of Shift differently
(mostly toggling ASCII mode), and this causes unwanted behavior.  (This
was reported as #38293 in 2019.)

This can only be fixed by Emacs, because to input methods, Shift+Enter
is indistinguishable from a single Shift.

(2) The input method may define some special keys and Emacs cannot make
use of them.

(3) Some system level shortcuts never work in Emacs.  For example,
Rectangle (think of it as a third-party window manager in macOS) will
not receive any requests from Emacs windows.

The fix is mostly modeled after Mitsuharu's Mac port, with a few
adjustments for NS port.  I've been using it for some time and there are
no more defects known to me, so I decide it's time to send it to you.

Regards,
Kai

[0001-NS-Pass-key-events-to-system-first.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72555; Package emacs. (Sat, 10 Aug 2024 19:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 72555 <at> debbugs.gnu.org (full text, mbox):

From: Kai Ma <justksqsf <at> gmail.com>
To: 72555 <at> debbugs.gnu.org
Subject: 30.0.60; [PATCH] NS: support passing key events to the system 
Date: Sat, 10 Aug 2024 21:46:53 +0200
Do NOT test the patch.  I just found the handling of certain keys incorrect.

(e.g. Control-/ seems to unconditionally triggers the alert beep.  I’d appreciate it if some experts can share their insights.)

I will post a new patch once I find a solution.



Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72555; Package emacs. (Sat, 05 Oct 2024 01:14:01 GMT) Full text and rfc822 format available.

Message #11 received at 72555 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 72555 <at> debbugs.gnu.org
Subject: Re: bug#72555: 30.0.60;
 [PATCH] NS: support passing key events to the system
Date: Fri, 4 Oct 2024 18:12:07 -0700
tags 72555 - patch
thanks

Kai Ma <justksqsf <at> gmail.com> writes:

> Do NOT test the patch.  I just found the handling of certain keys incorrect.
>
> (e.g. Control-/ seems to unconditionally triggers the alert beep.  I’d appreciate it if some experts can share their insights.)
>
> I will post a new patch once I find a solution.

Thanks.  Any updates here?




Removed tag(s) patch. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 05 Oct 2024 01:14:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72555; Package emacs. (Tue, 11 Feb 2025 19:22:01 GMT) Full text and rfc822 format available.

Message #16 received at 72555 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 72555 <at> debbugs.gnu.org
Subject: Re: bug#72555: 30.0.60;
 [PATCH] NS: support passing key events to the system
Date: Tue, 11 Feb 2025 11:21:04 -0800
Stefan Kangas <stefankangas <at> gmail.com> writes:

> tags 72555 - patch
> thanks
>
> Kai Ma <justksqsf <at> gmail.com> writes:
>
>> Do NOT test the patch.  I just found the handling of certain keys incorrect.
>>
>> (e.g. Control-/ seems to unconditionally triggers the alert beep.  I’d appreciate it if some experts can share their insights.)
>>
>> I will post a new patch once I find a solution.
>
> Thanks.  Any updates here?

Friendly ping.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#72555; Package emacs. (Wed, 12 Feb 2025 07:36:01 GMT) Full text and rfc822 format available.

Message #19 received at 72555 <at> debbugs.gnu.org (full text, mbox):

From: Kai Ma <justksqsf <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 72555 <at> debbugs.gnu.org
Subject: Re: bug#72555: 30.0.60; [PATCH] NS: support passing key events to the
 system
Date: Wed, 12 Feb 2025 08:35:30 +0100
Sorry, I don’t have the capacity to work on this for the next months. Please close it. I’ll resubmit a patch if I ever sort this out in the future.

According to my memories, the remaining problems are:

1. C-/ causes an unconditional beep because macOS has no default keybinding for it.
2. C-q is intercepted by Cocoa’s own quoted insert.

We can simply handle them inside Emacs, but I’m not sure whether the list is complete.

> On Feb 11, 2025, at 20:21, Stefan Kangas <stefankangas <at> gmail.com> wrote:
> 
> Stefan Kangas <stefankangas <at> gmail.com> writes:
> 
>> tags 72555 - patch
>> thanks
>> 
>> Kai Ma <justksqsf <at> gmail.com> writes:
>> 
>>> Do NOT test the patch.  I just found the handling of certain keys incorrect.
>>> 
>>> (e.g. Control-/ seems to unconditionally triggers the alert beep.  I’d appreciate it if some experts can share their insights.)
>>> 
>>> I will post a new patch once I find a solution.
>> 
>> Thanks.  Any updates here?
> 
> Friendly ping.





Reply sent to Stefan Kangas <stefankangas <at> gmail.com>:
You have taken responsibility. (Sun, 23 Feb 2025 00:28:01 GMT) Full text and rfc822 format available.

Notification sent to Kai Ma <justksqsf <at> gmail.com>:
bug acknowledged by developer. (Sun, 23 Feb 2025 00:28:01 GMT) Full text and rfc822 format available.

Message #24 received at 72555-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Kai Ma <justksqsf <at> gmail.com>
Cc: 72555-done <at> debbugs.gnu.org
Subject: Re: bug#72555: 30.0.60;
 [PATCH] NS: support passing key events to the system
Date: Sun, 23 Feb 2025 00:26:53 +0000
Kai Ma <justksqsf <at> gmail.com> writes:

> Sorry, I don’t have the capacity to work on this for the next months. Please close it. I’ll resubmit a patch if I ever sort this out in the future.
>
> According to my memories, the remaining problems are:
>
> 1. C-/ causes an unconditional beep because macOS has no default keybinding for it.
> 2. C-q is intercepted by Cocoa’s own quoted insert.
>
> We can simply handle them inside Emacs, but I’m not sure whether the list is complete.

OK, I'm therefore closing this bug report for now.

Please report back if you make any further progress with this.

Thanks in advance.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Mar 2025 11:24:43 GMT) Full text and rfc822 format available.

This bug report was last modified 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.