emacs-devel
[Top][All Lists]
Advanced

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

Re: Howto: Bind Windows key as a prefix?


From: Akib Azmain Turja
Subject: Re: Howto: Bind Windows key as a prefix?
Date: Wed, 06 Jul 2022 00:37:53 +0600

"T.V Raman" <raman@google.com> writes:

> On my laptop,
> pressing windows-key+<c> says 
> s-<c> is undefined for any <c>.
>
> M-x global-set-key RET
> windows+<c> RET
> command RET
> binds windows-<c>
> and asking where is <command> shows it as being on s-<c>.
>
> However calling global-set-key with "s-<c>" bombs with key-sequence
> "s-<c>" starts with  non-prefix s"
>
> Debugger entered--Lisp error: (error "Key sequence s - a starts with 
> non-prefix key s")
>   (define-key (keymap #^[nil nil keymap 
> #^^[3 0 set-mark-command move-beginning-of-line backward-char 
> mode-specific-command-prefix delete-char emacspeak-prefix-command 
> forward-char keyboard-quit help-command indent-for-tab-command 
> electric-newline-and-maybe-indent kill-line recenter-top-bottom newline 
> next-line (keymap (32 . emacspeak-outline-speak-this-heading) (102 . 
> emacspeak-outline-speak-forward-heading) (98 . 
> emacspeak-outline-speak-backward-heading) (110 . 
> emacspeak-outline-speak-next-heading) (112 . 
> emacspeak-outline-speak-previous-heading) (111 . open-line) (13 . 
> outline-insert-heading) (67108926 . outline-demote) (67108924 . 
> outline-promote) (22 . outline-move-subtree-down) (30 . 
> outline-move-subtree-up) (15 . outline-hide-other) (17 . 
> outline-hide-sublevels) (11 . outline-show-branches) (12 . 
> outline-hide-leaves) (5 . outline-show-entry) (3 . outline-hide-entry) (1 . 
> outline-show-all) (20 . outline-hide-body) (2 . outline-backward-same-level) 
> (6 . outline-forward-same-level) (21 . outline-up-heading) (4 . 
> outline-hide-subtree) (19 . outline-show-subtree) (9 . outline-show-children) 
> (16 . outline-previous-visible-heading) (14 . outline-next-visible-heading) 
> (64 . outline-mark-subtree)) previous-line quoted-insert isearch-backward 
> isearch-forward transpose-chars universal-argument scroll-up-command 
> kill-region Control-X-prefix emacspeak-muggles-yank-pop/yank 
> emacspeak-ctl-z-keymap ESC-prefix toggle-input-method abort-recursive-edit 
> nil ...] #^^[1 0 #^^[2 0 
> #^^[3 0 set-mark-command move-beginning-of-line backward-char 
> mode-specific-command-prefix delete-char emacspeak-prefix-command 
> forward-char keyboard-quit help-command indent-for-tab-command 
> electric-newline-and-maybe-indent kill-line recenter-top-bottom newline 
> next-line (keymap ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... 
> ... ... ... ... ... ... ... ... ... ... ... ... ...) previous-line 
> quoted-insert isearch-backward isearch-forward transpose-chars 
> universal-argument scroll-up-command kill-region Control-X-prefix 
> emacspeak-muggles-yank-pop/yank emacspeak-ctl-z-keymap ESC-prefix 
> toggle-input-method abort-recursive-edit nil ...] self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command ...] self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command] self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command self-insert-command 
> self-insert-command self-insert-command ...] (8388716 . ansi-term) (8388640 . 
> emacspeak-muggles-maths-navigator/body) (8388718 . 
> emacspeak-muggles-navigate/body) (print . emacspeak-muggles-brightness/body) 
> (f14 . kmacro-end-or-call-macro) (f13 . kmacro-start-macro-or-insert-counter) 
> (S-mouse-3 . kmacro-end-call-mouse) (C-S-iso-lefttab . tab-previous) (C-S-tab 
> . tab-previous) (C-tab . tab-next) (f5 . find-file) (remap keymap 
> (dabbrev-expand . hippie-expand)) (silence . emacspeak-silence) (67108903 . 
> emacspeak-multi-keymap) (67108923 . emacspeak-hyper-keymap) (67108910 . 
> emacspeak-super-keymap) (67108908 . emacspeak-alt-keymap) (S-down . 
> emacspeak-skip-blank-lines-forward) (S-up . 
> emacspeak-skip-blank-lines-backward) (S-right . next-buffer) (S-left . 
> previous-buffer) (XF86AudioRaiseVolume . amixer-volume-up) 
> (XF86AudioLowerVolume . amixer-volume-down) (C-f2 . amixer-volume-down) (C-f1 
> . amixer-volume-up) (XF86AudioPlay . emacspeak-silence) (paste . 
> clipboard-yank) (copy . clipboard-kill-ring-save) (cut . 
> clipboard-kill-region) (f18 . clipboard-yank) ...) "s-a" ansi-term)
>   (#f(compiled-function (key command) "Give KEY a global binding as 
> COMMAND.\nThis is a legacy function; see `keymap-global-set' for 
> the\nrecommended function to use instead.\n\nCOMMAND is the command 
> definition to use; usually it is\na symbol naming an interactively-callable 
> function.\nKEY is a key sequence; noninteractively, it is a string or 
> vector\nof characters or event types, and non-ASCII characters with 
> codes\nabove 127 (such as ISO Latin-1) can be included if you use a 
> vector.\n\nNote that if KEY has a local binding in the current buffer,\nthat 
> local binding will continue to shadow any global binding\nthat you make with 
> this function." (interactive #f(compiled-function () #<bytecode 
> 0x1c12d585360c8f11>)) #<bytecode 0xb0d11433d0335b6>) "s-a" ansi-term)
>   (ad-Advice-global-set-key #f(compiled-function (key command) "Give KEY a 
> global binding as COMMAND.\nThis is a legacy function; see 
> `keymap-global-set' for the\nrecommended function to use instead.\n\nCOMMAND 
> is the command definition to use; usually it is\na symbol naming an 
> interactively-callable function.\nKEY is a key sequence; noninteractively, it 
> is a string or vector\nof characters or event types, and non-ASCII characters 
> with codes\nabove 127 (such as ISO Latin-1) can be included if you use a 
> vector.\n\nNote that if KEY has a local binding in the current buffer,\nthat 
> local binding will continue to shadow any global binding\nthat you make with 
> this function." (interactive #f(compiled-function () #<bytecode 
> 0x1c12d585360c8f11>)) #<bytecode 0xb0d11433d0335b6>) "s-a" ansi-term)
>   (apply ad-Advice-global-set-key #f(compiled-function (key command) "Give 
> KEY a global binding as COMMAND.\nThis is a legacy function; see 
> `keymap-global-set' for the\nrecommended function to use instead.\n\nCOMMAND 
> is the command definition to use; usually it is\na symbol naming an 
> interactively-callable function.\nKEY is a key sequence; noninteractively, it 
> is a string or vector\nof characters or event types, and non-ASCII characters 
> with codes\nabove 127 (such as ISO Latin-1) can be included if you use a 
> vector.\n\nNote that if KEY has a local binding in the current buffer,\nthat 
> local binding will continue to shadow any global binding\nthat you make with 
> this function." (interactive #f(compiled-function () #<bytecode 
> 0x1c12d585360c8f11>)) #<bytecode 0xb0d11433d0335b6>) ("s-a" ansi-term))
>   (global-set-key "s-a" ansi-term)
>   (eval (global-set-key "s-a" 'ansi-term) t)
>   (#f(compiled-function (exp &optional insert-value no-truncate 
> char-print-limit) "Evaluate EXP and print value in the echo area.\nWhen 
> called interactively, read an Emacs Lisp expression and\nevaluate it.  Value 
> is also consed on to front of the variable\n`values'.  Optional argument 
> INSERT-VALUE non-nil (interactively,\nwith a non `-' prefix argument) means 
> insert the result into the\ncurrent buffer instead of printing it in the echo 
> area.\n\nNormally, this function truncates long output according to 
> the\nvalue of the variables `eval-expression-print-length' 
> and\n`eval-expression-print-level'.  When NO-TRUNCATE is\nnon-nil 
> (interactively, with a prefix argument of zero), however,\nthere is no such 
> truncation.\n\nIf the resulting value is an integer, and CHAR-PRINT-LIMIT 
> is\nnon-nil (interactively, unless given a non-zero prefix argument)\nit will 
> be printed in several additional formats (octal,\nhexadecimal, and 
> character).  The character format is used only\nif the value is below 
> CHAR-PRINT-LIMIT (interactively, if the\nprefix argument is -1 or the value 
> doesn't exceed\n`eval-expression-print-maximum-character').\n\nRuns the hook 
> `eval-expression-minibuffer-setup-hook' on entering the\nminibuffer.\n\nIf 
> `eval-expression-debug-on-error' is non-nil, which is the default,\nthis 
> command arranges for all errors to enter the debugger." (interactive 
> #f(compiled-function () #<bytecode -0x459e253eac81345>)) #<bytecode 
> -0xc624bdd988e525e>) (global-set-key "s-a" 'ansi-term) nil nil 127)
>   (ad-Advice-eval-expression #f(compiled-function (exp &optional insert-value 
> no-truncate char-print-limit) "Evaluate EXP and print value in the echo 
> area.\nWhen called interactively, read an Emacs Lisp expression and\nevaluate 
> it.  Value is also consed on to front of the variable\n`values'.  Optional 
> argument INSERT-VALUE non-nil (interactively,\nwith a non `-' prefix 
> argument) means insert the result into the\ncurrent buffer instead of 
> printing it in the echo area.\n\nNormally, this function truncates long 
> output according to the\nvalue of the variables 
> `eval-expression-print-length' and\n`eval-expression-print-level'.  When 
> NO-TRUNCATE is\nnon-nil (interactively, with a prefix argument of zero), 
> however,\nthere is no such truncation.\n\nIf the resulting value is an 
> integer, and CHAR-PRINT-LIMIT is\nnon-nil (interactively, unless given a 
> non-zero prefix argument)\nit will be printed in several additional formats 
> (octal,\nhexadecimal, and character).  The character format is used only\nif 
> the value is below CHAR-PRINT-LIMIT (interactively, if the\nprefix argument 
> is -1 or the value doesn't 
> exceed\n`eval-expression-print-maximum-character').\n\nRuns the hook 
> `eval-expression-minibuffer-setup-hook' on entering the\nminibuffer.\n\nIf 
> `eval-expression-debug-on-error' is non-nil, which is the default,\nthis 
> command arranges for all errors to enter the debugger." (interactive 
> #f(compiled-function () #<bytecode -0x459e253eac81345>)) #<bytecode 
> -0xc624bdd988e525e>) (global-set-key "s-a" 'ansi-term) nil nil 127)
>   (apply ad-Advice-eval-expression #f(compiled-function (exp &optional 
> insert-value no-truncate char-print-limit) "Evaluate EXP and print value in 
> the echo area.\nWhen called interactively, read an Emacs Lisp expression 
> and\nevaluate it.  Value is also consed on to front of the 
> variable\n`values'.  Optional argument INSERT-VALUE non-nil 
> (interactively,\nwith a non `-' prefix argument) means insert the result into 
> the\ncurrent buffer instead of printing it in the echo area.\n\nNormally, 
> this function truncates long output according to the\nvalue of the variables 
> `eval-expression-print-length' and\n`eval-expression-print-level'.  When 
> NO-TRUNCATE is\nnon-nil (interactively, with a prefix argument of zero), 
> however,\nthere is no such truncation.\n\nIf the resulting value is an 
> integer, and CHAR-PRINT-LIMIT is\nnon-nil (interactively, unless given a 
> non-zero prefix argument)\nit will be printed in several additional formats 
> (octal,\nhexadecimal, and character).  The character format is used only\nif 
> the value is below CHAR-PRINT-LIMIT (interactively, if the\nprefix argument 
> is -1 or the value doesn't 
> exceed\n`eval-expression-print-maximum-character').\n\nRuns the hook 
> `eval-expression-minibuffer-setup-hook' on entering the\nminibuffer.\n\nIf 
> `eval-expression-debug-on-error' is non-nil, which is the default,\nthis 
> command arranges for all errors to enter the debugger." (interactive 
> #f(compiled-function () #<bytecode -0x459e253eac81345>)) #<bytecode 
> -0xc624bdd988e525e>) ((global-set-key "s-a" 'ansi-term) nil nil 127))
>   (eval-expression (global-set-key "s-a" 'ansi-term) nil nil 127)
>   (#<subr funcall-interactively> eval-expression (global-set-key "s-a" 
> 'ansi-term) nil nil 127)
>   (apply #<subr funcall-interactively> eval-expression ((global-set-key "s-a" 
> 'ansi-term) nil nil 127))
>   (ad-Advice-funcall-interactively #<subr funcall-interactively> 
> eval-expression (global-set-key "s-a" 'ansi-term) nil nil 127)
>   (apply ad-Advice-funcall-interactively #<subr funcall-interactively> 
> (eval-expression (global-set-key "s-a" 'ansi-term) nil nil 127))
>   (funcall-interactively eval-expression (global-set-key "s-a" 'ansi-term) 
> nil nil 127)
>   (#<subr call-interactively> eval-expression nil nil)
>   (apply #<subr call-interactively> eval-expression (nil nil))
>   (call-interactively@ido-cr+-record-current-command #<subr 
> call-interactively> eval-expression nil nil)
>   (apply call-interactively@ido-cr+-record-current-command #<subr 
> call-interactively> (eval-expression nil nil))
>   (call-interactively eval-expression nil nil)
>   (command-execute eval-expression)
>
> -- 
>
> Thanks,
>
> --Raman(I Search, I Find, I Misplace, I Research)
> ♉ Id: kg:/m/0285kf1  🦮NZIrwH2+)!y܄do9

Evaluating "(global-set-key "s-a" 'ansi-term)" won't work.  Try
evaluating "(global-set-key (kbd "s-a") 'ansi-term)".

-- 
Akib Azmain Turja

This message is signed by me with my GnuPG key.  It's fingerprint is:

    7001 8CE5 819F 17A3 BBA6  66AF E74F 0EFA 922A E7F5

Attachment: signature.asc
Description: PGP signature


reply via email to

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