bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#21330: Fix Mac OS X key bindings bug


From: Mikhail Gusarov
Subject: bug#21330: Fix Mac OS X key bindings bug
Date: Mon, 26 Dec 2016 21:12:46 +0100

Hi Anders,

I have tried reproducing this discrepancy using my patch from #21330
on top of branch emacs-25.

Swedish layout, ns-alternate-modifier set to nil, LCmd-LAlt-9 replies
"s-]".

Maybe you could check again as well?

Best regards,
Mikhail.

On 2 Jan 2016, at 9:08, Anders Lindgren wrote:

I found a case where the code in question is needed, which none of the suggested patches handle correctly.

Steps to repeat:

    (setq ns-alternate-modifier nil)

    Press left CMD-ALT-9

    An unmodified Emacs replies "s-]" is not bound. (This assumes a Swedish keyboard layout, other layouts would yield a different character, but the principle is the same).

    With either of the two patches, Emacs respond with "s-9" is not bound, which isn't correct.

Unfortunately, I don't know how to distinguish between the cases where we need to strip away modifiers (C-s-a) and when we shouldn't, so I'm leaving this open for now.

    -- Anders Lindgren


On Wed, Dec 30, 2015 at 9:50 AM, Anders Lindgren <address@hidden> wrote:
Hi,

I'm looking into a key binding bug on OS X reported multiple times (19977, 21330, 21551). Two different patches have been submitted.

The original code looks like:

      if (is_left_key)
        {
          emacs_event->modifiers |= parse_solitary_modifier
            (ns_command_modifier);

          /* if super (default), take input manager's word so things like
             dvorak / qwerty layout work */
          if (EQ (ns_command_modifier, Qsuper)
              && !fnKeysym
              && [[theEvent characters] length] != 0)
            {
              /* XXX: the code we get will be unshifted, so if we have
                 a shift modifier, must convert ourselves */
              if (!(flags & NSShiftKeyMask))
                code = [[theEvent characters] characterAtIndex: 0];

One of the patches simply removes the `if (EQ(...))' statement. The other modifies the code to strip away modifiers.

First question: What is the code in the `if (EQ(...))' supposed to do? In other words, what will stop working if it is removed?

Second question: if it is needed for the LEFT command key, should the corresponding code be added for the RIGHT?

I've tested removing the `if' and Emacs still seems to be working as intended, both with a normal key layout and when Dvorak is used. If no one comes up with a reason to keep the code, I will remove it.

Third question: Does anybody know of a good way to automatically test things like this? What I'm looking for is a way to send keystrokes like Cmd-Alt-a to Emacs, that way it could be possible to write tests ensuring that things like this don't break in the future.

    -- Anders Lindgren



reply via email to

[Prev in Thread] Current Thread [Next in Thread]