GNU bug report logs - #44973
Add a macOS global hotkey function

Previous Next

Package: emacs;

Reported by: j <at> mremus.net

Date: Mon, 30 Nov 2020 21:27:02 UTC

Severity: minor

To reply to this bug, email your comments to 44973 AT debbugs.gnu.org.

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#44973; Package emacs. (Mon, 30 Nov 2020 21:27:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to j <at> mremus.net:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Nov 2020 21:27:03 GMT) Full text and rfc822 format available.

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

From: j <at> mremus.net
To: bug-gnu-emacs <at> gnu.org
Subject: Add a macOS global hotkey function
Date: Mon, 30 Nov 2020 13:01:52 -0800
[Message part 1 (text/plain, inline)]
MacOS makes it very difficult to assign global hotkeys to focus Emacs.
For example, if I'm in another program, and I want to launch/focus Emacs
with "Alt-SPC", it can't just be set in the system preferences; I'd need to
use a 3rd-party program like skhd.

Would it be possible to add a function or hook to Emacs which registers one
or more global hotkeys (using addGlobalMonitorForEventsMatchingMask), and
then when the hotkey is pressed, run an elisp function?

For example, by creating a "ns-register-global hotkey" function, where the
user could choose a keybinding (maybe "ALT-SPC"), and letting the user
provide a hook function (maybe "org-capture-stuff")

I intend this feature to be used for something like an Alfred replacement,
as described here: https://www.mattduck.com/emacs-fuzzy-launcher.html .

Even if it's rare for Emacs to implement an OS-specific feature, there is
some precedent on Windows. If you look at w32-register-hot-keys, it's
similar to, but different from my request.

The implementation in nsterm.m should be simple, but it requires Obj-C and
Emacs-specific development knowledge.

Thanks!
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 08 Dec 2020 20:40:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 08 Dec 2020 21:39:41 +0100
j <at> mremus.net writes:

> MacOS makes it very difficult to assign global hotkeys to focus
> Emacs. For example, if I'm in another program, and I want to
> launch/focus Emacs with "Alt-SPC", it can't just be set in the system
> preferences; I'd need to use a 3rd-party program like skhd.
>
> Would it be possible to add a function or hook to Emacs which registers one or
> more global hotkeys (using addGlobalMonitorForEventsMatchingMask), and then
> when the hotkey is pressed, run an elisp function?

[...]

> Even if it's rare for Emacs to implement an OS-specific feature, there
> is some precedent on Windows. If you look at w32-register-hot-keys,
> it's similar to, but different from my request.

Sure, I think that makes sense.  Would it be possible for you to work up
a patch that adds this functionality?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 21 Dec 2020 01:18:02 GMT) Full text and rfc822 format available.

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

From: j <at> mremus.net
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 44973 <at> debbugs.gnu.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Sun, 20 Dec 2020 16:40:37 -0800
[Message part 1 (text/plain, inline)]
Hi Lars,

I'm pretty close to having a patch ready, but I'm stuck in one key spot. I
don't know if anyone on the list could help?

After the user registers a hotkey, and when they press the hotkey, MacOS
will run the code below. On the line "RUN_SOME_ELISP_FUNCTION", I would
expect some elisp function to be run (e.g. 'emacs-version').

But no matter what I do, it always crashes the program. I think my first
problem is not knowing how to call elisp (run_hooks, safe_call, etc?)
correctly, but second, I suspect if this is crashing due to a threading
issue.

    handler = [NSEvent
addGlobalMonitorForEventsMatchingMask:(NSEventMaskKeyDown)
handler:^(NSEvent *event){
        if (event.modifierFlags & modifier)
          if([event.charactersIgnoringModifiers characterAtIndex:0] ==
vkey) {
           RUN_SOME_ELISP_FUNCTION
            [[NSApp mainWindow] makeKeyAndOrderFront:NSApp];
          }
        }
      }];

Is there anyone who might know how to fill in this piece?

Thanks

On Tue, Dec 8, 2020 at 12:39 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> j <at> mremus.net writes:
>
> > MacOS makes it very difficult to assign global hotkeys to focus
> > Emacs. For example, if I'm in another program, and I want to
> > launch/focus Emacs with "Alt-SPC", it can't just be set in the system
> > preferences; I'd need to use a 3rd-party program like skhd.
> >
> > Would it be possible to add a function or hook to Emacs which registers
> one or
> > more global hotkeys (using addGlobalMonitorForEventsMatchingMask), and
> then
> > when the hotkey is pressed, run an elisp function?
>
> [...]
>
> > Even if it's rare for Emacs to implement an OS-specific feature, there
> > is some precedent on Windows. If you look at w32-register-hot-keys,
> > it's similar to, but different from my request.
>
> Sure, I think that makes sense.  Would it be possible for you to work up
> a patch that adds this functionality?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 21 Dec 2020 04:36:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Mon, 21 Dec 2020 05:34:57 +0100
j <at> mremus.net writes:

> But no matter what I do, it always crashes the program. I think my
> first problem is not knowing how to call elisp (run_hooks, safe_call,
> etc?) correctly, but second, I suspect if this is crashing due to a
> threading issue.

I am not at all familiar with the ns functions, but looking at the other
.m files, it looks like you should be able to just say

  call0 (intern ("some-function"));

or something like that?  (Modulo threading stuff.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 21 Dec 2020 08:13:02 GMT) Full text and rfc822 format available.

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

From: Alan Third <alan <at> idiocy.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Mon, 21 Dec 2020 08:12:04 +0000
On Sun, Dec 20, 2020 at 04:40:37PM -0800, j <at> mremus.net wrote:
> Hi Lars,
> 
> I'm pretty close to having a patch ready, but I'm stuck in one key spot. I
> don't know if anyone on the list could help?
> 
> After the user registers a hotkey, and when they press the hotkey, MacOS
> will run the code below. On the line "RUN_SOME_ELISP_FUNCTION", I would
> expect some elisp function to be run (e.g. 'emacs-version').
> 
> But no matter what I do, it always crashes the program. I think my first
> problem is not knowing how to call elisp (run_hooks, safe_call, etc?)
> correctly, but second, I suspect if this is crashing due to a threading
> issue.
> 
>     handler = [NSEvent
> addGlobalMonitorForEventsMatchingMask:(NSEventMaskKeyDown)
> handler:^(NSEvent *event){
>         if (event.modifierFlags & modifier)
>           if([event.charactersIgnoringModifiers characterAtIndex:0] ==
> vkey) {
>            RUN_SOME_ELISP_FUNCTION
>             [[NSApp mainWindow] makeKeyAndOrderFront:NSApp];
>           }
>         }
>       }];

I think you probably want to send an event to Emacs, that way a user
can bind it to anything they like. Look at, say, [EmacsApp openFile:]
for how do that.

One potential problem with your approach is that we don't accept code
using Objective C blocks as it's incompatible with GCC. Unless that
policy has changed?
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 21 Dec 2020 16:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Alan Third <alan <at> idiocy.org>
Cc: 44973 <at> debbugs.gnu.org, alan <at> idiocy.org, larsi <at> gnus.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Mon, 21 Dec 2020 18:18:58 +0200
> Date: Mon, 21 Dec 2020 08:12:04 +0000
> From: Alan Third <alan <at> idiocy.org>
> Cc: 44973 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
> 
> One potential problem with your approach is that we don't accept code
> using Objective C blocks as it's incompatible with GCC. Unless that
> policy has changed?

It hasn't changed, but does this code really need to use that feature?
The last time we had a much more grave problem: the system header used
for some code itself used ObjC blocks, and thus couldn't be compiled
by GCC.  It looks like this case is not that problematic?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 21 Dec 2020 16:35:02 GMT) Full text and rfc822 format available.

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

From: Alan Third <alan <at> idiocy.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44973 <at> debbugs.gnu.org, larsi <at> gnus.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Mon, 21 Dec 2020 16:34:45 +0000
On Mon, Dec 21, 2020 at 06:18:58PM +0200, Eli Zaretskii wrote:
> > Date: Mon, 21 Dec 2020 08:12:04 +0000
> > From: Alan Third <alan <at> idiocy.org>
> > Cc: 44973 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
> > 
> > One potential problem with your approach is that we don't accept code
> > using Objective C blocks as it's incompatible with GCC. Unless that
> > policy has changed?
> 
> It hasn't changed, but does this code really need to use that feature?
> The last time we had a much more grave problem: the system header used
> for some code itself used ObjC blocks, and thus couldn't be compiled
> by GCC.  It looks like this case is not that problematic?

The class method used takes a block as an argument. I don't think
there are any work-arounds.

The GCC work to support blocks appears to be progressing, but slowly:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78352
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 22 Dec 2020 05:21:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Alan Third <alan <at> idiocy.org>
Cc: 44973 <at> debbugs.gnu.org, larsi <at> gnus.org, alan <at> idiocy.org, eliz <at> gnu.org,
 j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 22 Dec 2020 00:20:05 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > The GCC work to support blocks appears to be progressing, but slowly:

  > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78352

I am glad it is making progress.  We will get there eventually.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Wed, 30 Dec 2020 04:11:02 GMT) Full text and rfc822 format available.

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

From: j <at> mremus.net
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 44973 <at> debbugs.gnu.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 29 Dec 2020 20:10:00 -0800
[Message part 1 (text/plain, inline)]
Hi Lars,

Here is the patch to bind a global hotkey in mac. As long as Emacs is set as
"trusted" in macOS preferences, the user can bind a two-key hotkey of the
form [modifier-key] or a single-key modifier [function key], for example
(mac-bind-global-hotkey [f1] 'tetris). Binding a three-key
combo is left to a future patch.

The code is copied from w32-register-hot-key as much as possible.

The routine intentionally does not focus the window after the hotkey is
hit; the
user must call a function like (x-focus-frame nil) to focus the frame.

I also wanted to mention that after discovering x-focus-frame, and testing
my
patch and shkd more, I realized that my patch is in fact very similar to
shkd in
functionality. The main differences are that my patch allows hotkeys to be
declared directly in emacs (which I like), and that this patch acts
directly on
an open window (e.g. making it easier to make a hotkey to yank into an
already-open buffer). On the other hand skhd would call emacsclient, which
interacts with the server, even if no frame is open, offering its own
advantages.

Anyways, I'll leave this patch for your consideration as to whether it's
the right
thing to include in emacs!

P.S. I looked into what other code in emacs might be using blocks. I believe
nsxwidget.m also has a block in nsxwidget_webkit_execute_script. I'm
guessing
it's working in our cases because we're ultimately building with the Xcode C
compiler.

Thanks

On Sun, Dec 20, 2020 at 8:35 PM Lars Ingebrigtsen <larsi <at> gnus.org> wrote:

> j <at> mremus.net writes:
>
> > But no matter what I do, it always crashes the program. I think my
> > first problem is not knowing how to call elisp (run_hooks, safe_call,
> > etc?) correctly, but second, I suspect if this is crashing due to a
> > threading issue.
>
> I am not at all familiar with the ns functions, but looking at the other
> .m files, it looks like you should be able to just say
>
>   call0 (intern ("some-function"));
>
> or something like that?  (Modulo threading stuff.)
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>
[Message part 2 (text/html, inline)]
[mac_bind_global_hotkey.diff (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Wed, 30 Dec 2020 11:02:01 GMT) Full text and rfc822 format available.

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

From: Alan Third <alan <at> idiocy.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Wed, 30 Dec 2020 11:01:09 +0000
On Tue, Dec 29, 2020 at 08:10:00PM -0800, j <at> mremus.net wrote:
> Here is the patch to bind a global hotkey in mac. As long as Emacs is set as
> "trusted" in macOS preferences, the user can bind a two-key hotkey of the
> form [modifier-key] or a single-key modifier [function key], for example
> (mac-bind-global-hotkey [f1] 'tetris). Binding a three-key
> combo is left to a future patch.

Hi, thanks for this.

I'll leave it up to Lars and Eli whether this gets to go in, but I've
got a few comments:

+;; Copyright (C) 1993-1994, 2005-2020 Free Software Foundation, Inc.

Since this is a new file I'm pretty sure we just specify 2020 for
copyright.

+const char *const lispy_to_mac_function_keys[] =
+  {
+    "up", "down", "left", "right",          /* NSUpArrowfunctionKey    0xF700 */
+    "f1", "f2", "f3", "f4", "f5",           /* NSF1FunctionKey         0xF704 */
+    "f6", "f7", "f8", "f9", "f10",

I take it's not possible to use the existing keyboard IO stuff for
this? Like convert_ns_to_X_keysym?

+mac_parse_and_add_hotkey (Lisp_Object key, Lisp_Object lispfn, int hook)
 ^^^

We don't use mac_ in the NS port, we use ns_. I realise this code is
mac specific, but I'd rather not add a new function name prefix, not
least because it's possible it will interfere with the Mac port's
code, but also we may want to extend this functionality to GNUstep in
the future (although that seems unlikely right now).

It also means it's easy to see all the lisp functions that relate to
the NS port by doing something like M-x ns-<TAB>.

If you're copying functionality from the Mac port feel free to set up
an alias, but please use ns for the function names.

+      || ((lisp_modifiers & ctrl_modifier)
+          && EQ (ns_command_modifier, Qcontrol))
+      )
      ^^^

I don't think we leave closing parens hanging like that, just stick it
on the end of the previous line, please.

       doc: /* Bind KEY combination as a global hotkey, and run HOOK upon
+invokation. This function assigns a hotkey that will run an elisp function
 ^^^^^^^^^^

invocation

+mac_bind_key (NSEventModifierFlags modifier, unsigned vkey,

You might want to call this something like ns_bind_global_hotkey so
it's clearer what it does, and a short descriptive comment wouldn't go
amiss.

+    hotkey_ids = [[NSMutableArray alloc] initWithCapacity: 1];

You're allocing this array, but not releasing it anywhere.

+  if (trusted) {
               ^^^

Opening brace should be on a new line. This function (mac_bind_key)
needs this fix in a few places.

+          if([[event.charactersIgnoringModifiers capitalizedString]
            ^^^

Missing space.

We could also do with some documentation.

One thing I'm unsure about is that we allow users to map the left and
right modifier keys separately but I think your code only allows for
matching with left key settings. Is that intentional? It would seem
unlikely that macOS would let us map global hotkeys to the left and
right keys separately, so I understand if it's not possible.
-- 
Alan Third




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Wed, 30 Dec 2020 17:09:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Wed, 30 Dec 2020 19:08:46 +0200
> From: j <at> mremus.net
> Date: Tue, 29 Dec 2020 20:10:00 -0800
> Cc: 44973 <at> debbugs.gnu.org
> 
> Here is the patch to bind a global hotkey in mac. As long as Emacs is set as
> "trusted" in macOS preferences, the user can bind a two-key hotkey of the
> form [modifier-key] or a single-key modifier [function key], for example
> (mac-bind-global-hotkey [f1] 'tetris). Binding a three-key
> combo is left to a future patch. 
> 
> The code is copied from w32-register-hot-key as much as possible.

Hmm...  w32-register-hot-key is not for binding Emacs commands to
platform-specific keys, it is so that the OS doesn't catch some key
combinations ahead of Emacs.  That is, by using w32-register-hot-key
you make the key combination available for binding to a command using
global-set-key and the likes.

By contrast, it sounds like your patch is for letting users bind
platform-specific key sequences to Emacs commands, which is something
quite different.  What is the rationale for adding this functionality
to Emacs?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 04 Jan 2021 05:15:01 GMT) Full text and rfc822 format available.

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

From: j <at> mremus.net
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44973 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Sun, 3 Jan 2021 21:13:47 -0800
[Message part 1 (text/plain, inline)]
Hi Eli, Alan,

Here's a new patch incorporating all of Alan's feedback, with two notes:
1. This implementation is unable to differentiate between left and right
   modifier keys, because it depends upon NSEventModifierFlags, which
doesn't
   differentiate between left and right.
2. hotkey_ids is a global variable, so it should not be released.

To address Eli's feedback, this patch is inspired by
https://www.mattduck.com/emacs-fuzzy-launcher.html , where Matt uses emacs
to
create a launcher like Spotlight or Alfred. Since he's using GNU/Linux and
i3 wm, he
simply assigned a global hotkey in his window manager config to run
emacsclient
and run the launcher. I believe this is also easy to do in Windows.

In macOS this is much more difficult, because assigning a global hotkey can
only
be done in code. So a user would have to rely on a utility like skhd or
Hammerspoon.

My proposal is to add this patch to emacs, so that a user can assign a
global
hotkey in emacs without relying on a 3rd-party program.

I used w32-register-hot-key as an example of another instance where emacs
added
an OS-specific feature in order to provide a consistent user experience
across
platforms. Also, even though the behavior is totally different, the actual
implementation of that routine and mine are very similar.

Thanks for all of your time and feedback.

On Wed, Dec 30, 2020 at 9:08 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: j <at> mremus.net
> > Date: Tue, 29 Dec 2020 20:10:00 -0800
> > Cc: 44973 <at> debbugs.gnu.org
> >
> > Here is the patch to bind a global hotkey in mac. As long as Emacs is
> set as
> > "trusted" in macOS preferences, the user can bind a two-key hotkey of the
> > form [modifier-key] or a single-key modifier [function key], for example
> > (mac-bind-global-hotkey [f1] 'tetris). Binding a three-key
> > combo is left to a future patch.
> >
> > The code is copied from w32-register-hot-key as much as possible.
>
> Hmm...  w32-register-hot-key is not for binding Emacs commands to
> platform-specific keys, it is so that the OS doesn't catch some key
> combinations ahead of Emacs.  That is, by using w32-register-hot-key
> you make the key combination available for binding to a command using
> global-set-key and the likes.
>
> By contrast, it sounds like your patch is for letting users bind
> platform-specific key sequences to Emacs commands, which is something
> quite different.  What is the rationale for adding this functionality
> to Emacs?
>
[Message part 2 (text/html, inline)]
[ns_bind_global_hotkey.diff (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Mon, 04 Jan 2021 17:10:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: j <at> mremus.net
Cc: 44973 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Mon, 04 Jan 2021 19:09:19 +0200
> From: j <at> mremus.net
> Date: Sun, 3 Jan 2021 21:13:47 -0800
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 44973 <at> debbugs.gnu.org
> 
> I used w32-register-hot-key as an example of another instance where emacs added
> an OS-specific feature in order to provide a consistent user experience across
> platforms.

w32-register-hot-key allows a consistent UX across platforms
_inside_Emacs_.  Your changes, AFAIU, aims at using Emacs as a way to
work around problems in the OS WM, not in Emacs running on that OS.

So I'm still not sure we should install this.

Lars, do you have an opinion on this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 05 Jan 2021 08:26:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44973 <at> debbugs.gnu.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 05 Jan 2021 09:25:24 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> w32-register-hot-key allows a consistent UX across platforms
> _inside_Emacs_.  Your changes, AFAIU, aims at using Emacs as a way to
> work around problems in the OS WM, not in Emacs running on that OS.
>
> So I'm still not sure we should install this.
>
> Lars, do you have an opinion on this?

Since this brings up the Macos version of Emacs into feature parity with
what you can do in GNU/Linux and Windows, I don't have any objections to
including it.  

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 05 Jan 2021 08:28:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44973 <at> debbugs.gnu.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 05 Jan 2021 09:26:56 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Since this brings up the Macos version of Emacs into feature parity with
> what you can do in GNU/Linux and Windows, I don't have any objections to
> including it.  

(There's still the issue of code blocks, though -- we're not accepting
those until gcc supports those, I think?)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 05 Jan 2021 15:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 44973 <at> debbugs.gnu.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 05 Jan 2021 17:04:42 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: j <at> mremus.net,  44973 <at> debbugs.gnu.org
> Date: Tue, 05 Jan 2021 09:26:56 +0100
> 
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> 
> > Since this brings up the Macos version of Emacs into feature parity with
> > what you can do in GNU/Linux and Windows, I don't have any objections to
> > including it.  
> 
> (There's still the issue of code blocks, though -- we're not accepting
> those until gcc supports those, I think?)

Right.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Tue, 05 Jan 2021 15:20:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 44973 <at> debbugs.gnu.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Tue, 05 Jan 2021 17:04:21 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: j <at> mremus.net,  44973 <at> debbugs.gnu.org
> Date: Tue, 05 Jan 2021 09:25:24 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > w32-register-hot-key allows a consistent UX across platforms
> > _inside_Emacs_.  Your changes, AFAIU, aims at using Emacs as a way to
> > work around problems in the OS WM, not in Emacs running on that OS.
> >
> > So I'm still not sure we should install this.
> >
> > Lars, do you have an opinion on this?
> 
> Since this brings up the Macos version of Emacs into feature parity with
> what you can do in GNU/Linux and Windows, I don't have any objections to
> including it.  

Then I guess we can install it (once the other problem is solved).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Wed, 06 Jan 2021 05:03:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 44973 <at> debbugs.gnu.org, larsi <at> gnus.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Wed, 06 Jan 2021 00:02:29 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > w32-register-hot-key allows a consistent UX across platforms
  > _inside_Emacs_.  Your changes, AFAIU, aims at using Emacs as a way to
  > work around problems in the OS WM, not in Emacs running on that OS.

That sure sounds like a MacOS-specific feature.  If so, we should
not include it in a GNU program.

-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44973; Package emacs. (Wed, 06 Jan 2021 05:16:02 GMT) Full text and rfc822 format available.

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

From: Richard Stallman <rms <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 44973 <at> debbugs.gnu.org, eliz <at> gnu.org, j <at> mremus.net
Subject: Re: bug#44973: Add a macOS global hotkey function
Date: Wed, 06 Jan 2021 00:15:20 -0500
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

You and Eli gave two analyses of the nature of this change:

Eli:

  > w32-register-hot-key allows a consistent UX across platforms
  > _inside_Emacs_.  Your changes, AFAIU, aims at using Emacs as a way to
  > work around problems in the OS WM, not in Emacs running on that OS.

Lars:

  > Since this brings up the Macos version of Emacs into feature parity with
  > what you can do in GNU/Linux and Windows,

If Lars is right, it is ok to install.  If Eli is right, it should not
be installed.

So it's a matter of which of those two is right.  I have no idea.
But you can compare notes and figure out.

Is it possible that, in some way, both are right?  If so, this is a
strange situation and worth deeper study.


-- 
Dr Richard Stallman
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)






This bug report was last modified 4 years and 163 days ago.

Previous Next


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