From 361109e038531ae731fe40b06e0594d9f4daf711 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Tue, 10 Dec 2024 09:42:11 +0100 Subject: [PATCH] Move ns-specific event setup to term/ns-win.el (Bug#74619) * lisp/term/ns-win.el (ns-setup-special-keys): New function, contains event setup code previously in term/common-win.el. Call it at top-level. * lisp/term/common-win.el (x-setup-function-keys): Call 'ns-setup-special-keys'. (cherry picked from commit ebd8feef1491907ebf4648a3aa38ddaa7fbf1dd2) --- lisp/term/common-win.el | 19 +++---------------- lisp/term/ns-win.el | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el index 181dcc8e6d9..68c3b2d56e3 100644 --- a/lisp/term/common-win.el +++ b/lisp/term/common-win.el @@ -45,6 +45,8 @@ 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 @@ (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 a/lisp/term/ns-win.el b/lisp/term/ns-win.el index 2a29457133e..2188aa67e54 100644 --- a/lisp/term/ns-win.el +++ b/lisp/term/ns-win.el @@ -168,6 +168,27 @@ The properties returned may include `top', `left', `height', and `width'." (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. -- 2.39.5