On Thu, 25 Mar 2021 at 20:20, Dmitry Gutov <dgutov@yandex.ru> wrote:
But C-c doesn't have a dedicated keymap, so solving this seems like the
first step. What could we do?
(kbd (format "%s C-l" ctl-c-key-sequence) 'some-command)
Or maybe create a bogus ctrl-c keymap and then make sure to refer to its
binding with something like
(kbd "[C-c] C-l" 'some-command)
...I'm not sure, ideas welcome.
How about this:
* Introduce a virtual key, let’s call it <mode-specific>. Let’s
specifically *not* name it <key-formerly-known-as-C-c>.
* Have all modes use that as the prefix key for mode-specific
commands, instead of C-c.
* In the default configuration, translate C-c to <mode-specific>.
Proof of concept:
$ emacs -Q
(define-key help-mode-map (kbd "<mode-specific> <mode-specific>")
#'help-follow-symbol)
(define-key help-mode-map (kbd "<mode-specific> C-b") #'help-go-back)
(define-key help-mode-map (kbd "<mode-specific> C-f") #'help-go-forward)
(define-key key-translation-map (kbd "<menu>") (kbd "<mode-specific>"))
;; C-x C-e all of the above
(define-key help-mode-map (kbd "C-c C-c") nil)
(define-key help-mode-map (kbd "C-c C-b") nil)
(define-key help-mode-map (kbd "C-c C-f") nil)
(define-key help-mode-map (kbd "C-c") nil)
;; should be unneeded after all modes convert
(global-set-key (kbd "C-c") #'copy-region-as-kill)
(global-set-key (kbd "C-v") #'cua-paste)
<f1> m C-x o
;; I’m now in a *Help* buffer listing currently enabled modes
<f1> b
;; I’m now in a *Help* buffer listing bindings
<menu> C-b
;; I’m back to modes
<menu> C-f
;; I’m back to bindings
S-<down> S-<down> S-<down> C-c
C-x o C-v
;; I have a copy of a few lines from *Help* in my *scratch*