[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Migration from define-key to bind-key with prefix-command
From: |
Karl Voit |
Subject: |
Migration from define-key to bind-key with prefix-command |
Date: |
Mon, 9 Nov 2015 13:55:17 +0100 |
User-agent: |
slrn/pre1.0.0-18 (Linux) |
Hi!
How can I define "define-key" commands with a global prefix-command to
bind-key(s) syntax?
I don't want to loose the ability to change my global prefix "my-map"
to a different one on one single place. I also want to keep my habit
of defining key bindings on many different places scattered all over
my init file and not on one single spot.
What I do have in my Emacs initialization file(s):
#+BEGIN_SRC elisp
(define-prefix-command 'my-map)
(global-set-key (kbd "C-c C-,") 'my-map)
(global-set-key (kbd "C-c ,") 'my-map)
[...]
;; scale text size (C-c C-, +/-)
(define-key my-map "-" 'text-scale-decrease)
(define-key my-map "+" 'text-scale-increase)
[...]
;; remove trailing whitespaces (C-c C-, " ")
(define-key my-map " " 'delete-trailing-whitespace)
#+END_SRC
What I think of (in totally wrong Elisp):
#+BEGIN_SRC elisp
(define-prefix-command 'my-map)
(global-set-key (kbd "C-c C-,") 'my-map)
(global-set-key (kbd "C-c ,") 'my-map)
[...]
;; scale text size (C-c C-, +/-)
(my-bind-key my-map "-" 'text-scale-decrease)
(my-bind-key my-map "+" 'text-scale-increase)
[...]
;; remove trailing whitespaces (C-c C-, " ")
(my-bind-key my-map " " 'delete-trailing-whitespace)
#+END_SRC
Or do I have to change my habits, get rid of my unified prefix
(my-map), and use define-key with repeating "C-c C-," prefix?
Thanks!
--
All in all, one of the most disturbing things today is the definitive
fact that the NSA, GCHQ, and many more government organizations are
massively terrorizing the freedom of us and the next generations.
http://Karl-Voit.at
- Migration from define-key to bind-key with prefix-command,
Karl Voit <=