all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Yoichi Nakayama <yoichi.nakayama@gmail.com>,
	gerd.moellmann@gmail.com, 74619@debbugs.gnu.org
Subject: bug#74619: macOS: <ns-show-prefs> displayed as keybinding for \\[customize] on emacs -nw
Date: Mon, 09 Dec 2024 17:14:52 +0100	[thread overview]
Message-ID: <87ed2gal4z.fsf@gmail.com> (raw)
In-Reply-To: <86bjxmhfjo.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 08 Dec 2024 08:09:15 +0200")

>>>>> On Sun, 08 Dec 2024 08:09:15 +0200, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Yoichi Nakayama <yoichi.nakayama@gmail.com>
    >> * Emacs built with --without-ns doesn't load term/ns-win.el (in this
    >> case, the problem doesn't occur)
    >> * Emacs built with --with-ns does load term/ns-win.el even in -nw process
    >> 
    >> Therefore, putting make-non-key-event for non-key events ns-* in the
    >> toplevel of term/ns-win.el solve the problem, and I also think
    >> term/ns-win.el is better place as you said "NS specific code should
    >> definitely go to ns-win.el".

    Eli> Thanks, then I guess it's okay to move the code there.

Except if we do that, then in the --with-ns build, the ⌘-, binding
(and the toplevel emacs/Settings menu item) doesnʼt work anymore. Iʼd
rather not have the code be duplicated, so how about this (I suck at
naming, so we can change the defun name):

diff --git i/lisp/term/common-win.el w/lisp/term/common-win.el
index 181dcc8e6d9..68c3b2d56e3 100644
--- i/lisp/term/common-win.el
+++ w/lisp/term/common-win.el
@@ -45,6 +45,8 @@ x-alternatives-map
     map)
   "Keymap of possible alternative meanings for some keys.")
 
+(declare-function ns-setup-special-keys "term/ns-win" ())
+
 (defun x-setup-function-keys (frame)
   "Set up `function-key-map' on the graphical frame FRAME."
   ;; Don't do this twice on the same display, or it would break
@@ -56,22 +58,7 @@ x-setup-function-keys
         (set-keymap-parent map (keymap-parent local-function-key-map))
         (set-keymap-parent local-function-key-map map))
       (when (featurep 'ns)
-	(setq system-key-alist
-	      (list
-	       ;; These are special "keys" used to pass events from C to lisp.
-	       (cons  1 (make-non-key-event 'ns-power-off))
-	       (cons  2 (make-non-key-event 'ns-open-file))
-	       (cons  3 (make-non-key-event 'ns-open-temp-file))
-	       (cons  4 (make-non-key-event 'ns-drag-file))
-	       (cons  5 (make-non-key-event 'ns-drag-color))
-	       (cons  6 (make-non-key-event 'ns-drag-text))
-	       (cons  8 (make-non-key-event 'ns-open-file-line))
-;;;	       (cons  9 (make-non-key-event 'ns-insert-working-text))
-;;;	       (cons 10 (make-non-key-event 'ns-delete-working-text))
-	       (cons 11 (make-non-key-event 'ns-spi-service-call))
-	       (cons 12 (make-non-key-event 'ns-new-frame))
-	       (cons 13 (make-non-key-event 'ns-toggle-toolbar))
-	       (cons 14 (make-non-key-event 'ns-show-prefs))))))
+        (ns-setup-special-keys)))
     (set-terminal-parameter frame 'x-setup-function-keys t)))
 
 (defvar x-invocation-args)
diff --git i/lisp/term/ns-win.el w/lisp/term/ns-win.el
index 2a29457133e..640b7fe6dc7 100644
--- i/lisp/term/ns-win.el
+++ w/lisp/term/ns-win.el
@@ -168,6 +168,27 @@ global-map
 (define-key global-map [S-mouse-1] 'mouse-save-then-kill)
 (global-unset-key [S-down-mouse-1])
 
+;; Moved here from common-win.el because they need to work in a -nw
+;; invocation of a (featurep 'ns) => true build.  Bug#74619.
+(defun ns-setup-special-keys ()
+  (setq system-key-alist
+        (list
+         ;; These are special "keys" used to pass events from C to lisp.
+         (cons  1 (make-non-key-event 'ns-power-off))
+         (cons  2 (make-non-key-event 'ns-open-file))
+         (cons  3 (make-non-key-event 'ns-open-temp-file))
+         (cons  4 (make-non-key-event 'ns-drag-file))
+         (cons  5 (make-non-key-event 'ns-drag-color))
+         (cons  6 (make-non-key-event 'ns-drag-text))
+         (cons  8 (make-non-key-event 'ns-open-file-line))
+;;;            (cons  9 (make-non-key-event 'ns-insert-working-text))
+;;;            (cons 10 (make-non-key-event 'ns-delete-working-text))
+         (cons 11 (make-non-key-event 'ns-spi-service-call))
+         (cons 12 (make-non-key-event 'ns-new-frame))
+         (cons 13 (make-non-key-event 'ns-toggle-toolbar))
+         (cons 14 (make-non-key-event 'ns-show-prefs)))))
+(ns-setup-special-keys)
+
 ;; Special Nextstep-generated events are converted to function keys.  Here
 ;; are the bindings for them.  Note, these keys are actually declared in
 ;; x-setup-function-keys in common-win.


Robert
-- 





  reply	other threads:[~2024-12-09 16:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-30  7:40 bug#74619: macOS: <ns-show-prefs> displayed as keybinding for \\[customize] on emacs -nw Yoichi Nakayama
2024-12-02 14:09 ` Robert Pluim
2024-12-02 14:49   ` Gerd Möllmann
2024-12-04 13:53   ` Yoichi Nakayama
2024-12-04 14:38     ` Robert Pluim
2024-12-06 13:46       ` Yoichi Nakayama
2024-12-06 15:16         ` Robert Pluim
2024-12-06 16:22           ` Eli Zaretskii
2024-12-06 16:53             ` Robert Pluim
2024-12-06 16:59               ` Eli Zaretskii
2024-12-06 17:11                 ` Gerd Möllmann
2024-12-06 17:24                   ` Robert Pluim
2024-12-06 18:24                     ` Eli Zaretskii
2024-12-09  8:38                       ` Robert Pluim
2024-12-06 20:20                   ` Yoichi Nakayama
2024-12-07  7:32                     ` Eli Zaretskii
2024-12-08  1:01                       ` Yoichi Nakayama
2024-12-08  6:09                         ` Eli Zaretskii
2024-12-09 16:14                           ` Robert Pluim [this message]
2024-12-09 16:31                             ` Eli Zaretskii
2024-12-10 13:51                               ` Robert Pluim
2024-12-10 14:36                                 ` Eli Zaretskii
2024-12-10 15:45                                   ` Robert Pluim

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ed2gal4z.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=74619@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=yoichi.nakayama@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.