hereHere is an "attempt" to get more BONUS keys ... The snippet is works on GUI Emacs.
here is an "attempt" to get more BONUS keys
Here is an "attempt" to get more BONUS keys ... The snippet is works on GUI Emacs.
Define your own
BLAH/fakekeys (so that they are not hijacked by other modules), here is an "attempt" to get more and more keys on GUI Emacs.Three bonus keys—
C-i,C-mandC-\[—for your GUI Emacs; all with zero headache
Apropos the remark "some C-xxx keys are problematic to generate in terminal" in the snippet above,
On
gnome-terminal, withemacs -Q -nw, when I doC-h k C-1,Emacssays1 runs the command self-insert-command (found in global-map)On
xterm, withemacs -Qwhen I doC-h k C-2,EmacssaysC-@ runs the command set-mark-command (found in global-map)
Similar observations can be made for "some"(?) C-M-xxx bindings. C-M-xxx is essentially M- and C-xxx and M- is emitted with ESC and if you have issues with C-xxx it shouldn't be surprising that there are issues with C-M-xxx.
Comprehensive keyboard handling in terminals is a good introduction to terminals, and with a quick glimpse one can reasonably anticipate which key sequences are going to give you problematic on the terminal Emacs.
I understand none of what I say, so take what I say with a grain of salt. But the behavioural observations I make can be independently verified. I am on Debian / sid, btw.
Define your own
BLAH/fakekeys (so that they are not hijacked by other modules), here is an "attempt" to get more and more keys on GUI Emacs.Three bonus keys—
C-i,C-mandC-\[—for your GUI Emacs; all with zero headache
Define your own
BLAH/fakekeys (so that they are not hijacked by other modules)Three bonus keys—
C-i,C-mandC-\[—for your GUI Emacs; all with zero headache
Apropos the remark "some C-xxx keys are problematic to generate in terminal" in the snippet above,
On
gnome-terminal, withemacs -Q -nw, when I doC-h k C-1,Emacssays1 runs the command self-insert-command (found in global-map)On
xterm, withemacs -Qwhen I doC-h k C-2,EmacssaysC-@ runs the command set-mark-command (found in global-map)
Similar observations can be made for "some"(?) C-M-xxx bindings. C-M-xxx is essentially M- and C-xxx and M- is emitted with ESC and if you have issues with C-xxx it shouldn't be surprising that there are issues with C-M-xxx.
Comprehensive keyboard handling in terminals is a good introduction to terminals, and with a quick glimpse one can reasonably anticipate which key sequences are going to give you problematic on the terminal Emacs.
I understand none of what I say, so take what I say with a grain of salt. But the behavioural observations I make can be independently verified. I am on Debian / sid, btw.
If you want additional keys on GUI Emacs, you can seeFollowing the leads in
Define your own
BLAH/fakekeys (so that they are not hijacked by other modules), here is an "attempt" to get more and more keys on GUI Emacs.Three bonus keys—
C-i,C-mandC-\[—for your GUI Emacs; all with zero headache
here is an "attempt" to get more Three bonus keys—C-i, C-m and C-\[—for your GUI Emacs; all with zero headacheBONUS keys
(cl-loop for (x . fmt-string) in `( ;; ????: The `C-xxx` keys are problematic to generate in ;; terminal. If you type it, `Emacs` may report a ;; different thing. The behaviour varies with the ;; terminal. ("C" . "C-%s") ("M" . "M-%s") ;; ????: The previous comment applies ("C-M" . "C-M-%s") ,@(when (display-graphic-p) '(("ESCAPE" . "<escape> %s")))) do (cl-loop for digit in (number-sequence 0 9) for key = (format fmt-string digit) for sym = (intern (format "BLAH-%s-%s" x digit)) do (condition-case err (progn (message "%s -> %s" key sym) (define-key input-decode-map (kbd key) (vector sym))) (error (message "Error %S" err))))) ;; Bind `C-1' to `find-file' (global-set-key (kbd "<BLAH-C-1> f") 'find-file) (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode) ;; Bind `C-0' as `outline-minor-mode-prefix' (custom-set-variables ;; Key zero look like `o` (for outline) '(outline-minor-mode-prefix (kbd "<BLAH-C-0>"))) ;; Use `C-0 C-0' to to enable `outline-minor-mode' (global-set-key (kbd "<BLAH-C-0> <BLAH-C-0>") 'outline-minor-mode) (add-hook 'hs-minor-mode-hook (defun my-hs-minor-mode-hook () ;; Overwrite `hs-minor-mode-map'. `C-c @' is difficult to ;; type. (setq hs-minor-mode-map (let ((map (make-sparse-keymap))) ;; These bindings roughly imitate those used by Outline mode. (define-key map (kbd "C-S-b") 'hs-show-block) (define-key map (kbd "C-b") 'hs-hide-block) (define-key map (kbd "C-a") 'hs-hide-all) (define-key map (kbd "C-S-a") 'hs-show-all) (define-key map (kbd "C-l") 'hs-hide-level) (define-key map (kbd "C-c") 'hs-toggle-hiding) (define-key map (kbd "<BLAH-C-2>") 'hs-minor-mode) map)) ;; Put `hs-' commands on `C-2' prefix; ;; 2 and `@' are on the same key on the keyboard. (fset 'hs-minor-mode-map hs-minor-mode-map) (global-set-key (kbd "<BLAH-C-2>") 'hs-minor-mode-map))) ;; Use `C-2 C-2' to toggle `hs-minor-mode' (global-set-key (kbd "<BLAH-C-2> <BLAH-C-2>") 'hs-minor-mode) If you want additional keys on GUI Emacs, you can see Three bonus keys—C-i, C-m and C-\[—for your GUI Emacs; all with zero headache
Following the leads in
Define your own
BLAH/fakekeys (so that they are not hijacked by other modules), here is an "attempt" to get more and more keys on GUI Emacs.Three bonus keys—
C-i,C-mandC-\[—for your GUI Emacs; all with zero headache
here is an "attempt" to get more BONUS keys
(cl-loop for (x . fmt-string) in `( ;; ????: The `C-xxx` keys are problematic to generate in ;; terminal. If you type it, `Emacs` may report a ;; different thing. The behaviour varies with the ;; terminal. ("C" . "C-%s") ("M" . "M-%s") ;; ????: The previous comment applies ("C-M" . "C-M-%s") ,@(when (display-graphic-p) '(("ESCAPE" . "<escape> %s")))) do (cl-loop for digit in (number-sequence 0 9) for key = (format fmt-string digit) for sym = (intern (format "BLAH-%s-%s" x digit)) do (condition-case err (progn (message "%s -> %s" key sym) (define-key input-decode-map (kbd key) (vector sym))) (error (message "Error %S" err))))) ;; Bind `C-1' to `find-file' (global-set-key (kbd "<BLAH-C-1> f") 'find-file) (add-hook 'emacs-lisp-mode-hook 'outline-minor-mode) ;; Bind `C-0' as `outline-minor-mode-prefix' (custom-set-variables ;; Key zero look like `o` (for outline) '(outline-minor-mode-prefix (kbd "<BLAH-C-0>"))) ;; Use `C-0 C-0' to to enable `outline-minor-mode' (global-set-key (kbd "<BLAH-C-0> <BLAH-C-0>") 'outline-minor-mode) (add-hook 'hs-minor-mode-hook (defun my-hs-minor-mode-hook () ;; Overwrite `hs-minor-mode-map'. `C-c @' is difficult to ;; type. (setq hs-minor-mode-map (let ((map (make-sparse-keymap))) ;; These bindings roughly imitate those used by Outline mode. (define-key map (kbd "C-S-b") 'hs-show-block) (define-key map (kbd "C-b") 'hs-hide-block) (define-key map (kbd "C-a") 'hs-hide-all) (define-key map (kbd "C-S-a") 'hs-show-all) (define-key map (kbd "C-l") 'hs-hide-level) (define-key map (kbd "C-c") 'hs-toggle-hiding) (define-key map (kbd "<BLAH-C-2>") 'hs-minor-mode) map)) ;; Put `hs-' commands on `C-2' prefix; ;; 2 and `@' are on the same key on the keyboard. (fset 'hs-minor-mode-map hs-minor-mode-map) (global-set-key (kbd "<BLAH-C-2>") 'hs-minor-mode-map))) ;; Use `C-2 C-2' to toggle `hs-minor-mode' (global-set-key (kbd "<BLAH-C-2> <BLAH-C-2>") 'hs-minor-mode)