Subject: 23.1.50; NextStep emacs port problem with key sequences in menus (with patch)
From: Rob Christie <[email-masked]>
To: [email-masked]
Date: Fri, 4 Sep 2009 10:32:45 -0400

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing
list.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

In the ns/cocoa version of Emacs 23 when key sequences are added to menu
items via calls such as easy-menu-define, key sequences that start with
s end up showing up as just the Command key with a single letter. In
previous versions of emacs for the Mac (Carbon Emacs), the key sequence
would show up correctly.  For
packages such as YaSnippet this becomes a problem because the key
sequence that is shown is the snippet you must type to get an
expansion. For example, in snippets that I currently use typing
shbt <tab> expands to "should belong to". In previous versions of emacs
the menu item for this would show

should_belong_to ... (shbt =>)

In the next step version of emacs it shows

should_belong_to ...     ⌘B

The following patch makes does a bit more of a check in parseKeyEquiv in
nsmenu.m to fix the issue.

From f00edeb61d82aaed792f8615f7cd529bd4a8b4f7 Mon Sep 17 00:00:00 2001
From: Rob Christie <[email-masked]>
Date: Fri, 4 Sep 2009 04:02:20 -0400
Subject: [PATCH] Changed nsmenu so that parseKeyEquiv can handle when menus
are created with key combinations that start with s, but do are not supposed
to be intermpreted as meta.

---
 src/nsmenu.m |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/nsmenu.m b/src/nsmenu.m
index 0518466..2a4f9f7 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -609,12 +609,13 @@ name_is_separator (name)
     return @"";

   while (*tpos == ' ' || *tpos == '(')
-    tpos++;
-  if (*tpos != 's') {
-    keyEquivModMask = 0; /* signal */
-    return [NSString stringWithUTF8String: tpos];
-  }
-  return [NSString stringWithFormat: @"%c", tpos[2]];
+      tpos++;
+  if ((*tpos == 's') && (*(tpos+1) == '-'))
+    {
+      return [NSString stringWithFormat: @"%c", tpos[2]];
+    }
+  keyEquivModMask = 0; /* signal */
+  return [NSString stringWithUTF8String: tpos];
 }

-- 

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Emacs.app/Contents/Resources/etc/DEBUG for instructions.

In GNU Emacs 23.1.50.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54)
 of 2009-08-28 on black.local
Windowing system distributor `Apple', version 10.3.949
configured using `configure  '--with-ns''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  yas/global-mode: t
  yas/minor-mode: t
  shell-dirtrack-mode: t
  flyspell-mode: t
  diff-auto-refine-mode: t
  global-hl-line-mode: t
  delete-selection-mode: t
  pc-selection-mode: t
  icomplete-mode: t
  show-paren-mode: t
  which-function-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x s i b <backspace> <backspace> u b SPC <backspace>
<backspace> <backspace> b u SPC SPC g SPC C-g C-h i
m E m a c s <return> m B u g SPC <backspace> s <return>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<up> <up> <up> <down> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <down>
<left> <left> <left> <return> M-x r e p o r t SPC e
m SPC SPC SPC <return>

Recent messages:
Loading /Users/rchristie/.emacs.d/rwc-c.el (source)...done
Loading /Users/rchristie/.emacs.d/rwc-defuns.el (source)...
Loading /Users/rchristie/.emacs.d/elpa/package.el (source)...done
Loading /Users/rchristie/.emacs.d/rwc-defuns.el (source)...done
Loading /Users/rchristie/.emacs.d/elpa/package.el (source)...done
Starting new Ispell process [default] ...
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]
Quit
Composing main Info directory...done

Load-path shadows:
/Users/rchristie/.emacs.d/vendor/gist.el/gist hides ~/.emacs.d/vendor/gist
/Users/rchristie/.emacs.d/git/vc-git hides
/Applications/Emacs.app/Contents/Resources/lisp/vc-git
~/.emacs.d/custom hides
/Applications/Emacs.app/Contents/Resources/lisp/custom
/Users/rchristie/dev/dotfiles/emacs.d/vendor/rinari/util/ruby-mode hides
/Applications/Emacs.app/Contents/Resources/lisp/progmodes/ruby-mode