unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Gregory Heytings <gregory@heytings.org>,
	Eli Zaretskii <eliz@gnu.org>,
	Stefan Kangas <stefankangas@gmail.com>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: Suggested experimental test
Date: Sat, 27 Mar 2021 01:34:52 +0200	[thread overview]
Message-ID: <45322b47-e868-d242-0972-8d517e2dcfd7@yandex.ru> (raw)
In-Reply-To: <CAP_d_8Ws_ydV_umocvf4W4fHT2ahB8s2d7L9RpuwZ9DGRAGZ_A@mail.gmail.com>

On 25.03.2021 21:30, Yuri Khan wrote:
> 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*

This is a solid proposal. We can go with it, especially if we don't mind 
the key sequence ergonomics in keymaps, as well as backward incompatibility.

Perhaps we could instead do something with key-translation-map (or one 
of its friends) that works on existing keymaps?

The use of 'menu-item' allows us to filter based on whether the key is 
first in the sequence:

(define-key key-translation-map (kbd "<menu>") (kbd "C-c"))
(define-key key-translation-map (kbd "C-c")
   `(menu-item "" ,(kbd "<C-c-translated>")
               :filter my--head-of-sequence-p))
(global-set-key (kbd "<C-c-translated>") 'kill-ring-save)

(defun my--head-of-sequence-p (cmd)
   (if (> (length (this-command-keys-vector)) 1)
       (kbd "C-c")
     cmd))

This seems backward-compatible enough, but the main downside is that 
Emacs now says 'C-c-' in the echo area when you hit <menu>. Which must 
be confusing to the main target audience.



  parent reply	other threads:[~2021-03-26 23:34 UTC|newest]

Thread overview: 171+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-20  9:03 Suggested experimental test Gregory Heytings
2021-03-20 11:14 ` Jean Louis
2021-03-20 11:27   ` Eli Zaretskii
2021-03-20 11:34   ` Gregory Heytings
2021-03-20 12:37 ` Proposal to remove C-o binding [was: Suggested experimental test] Alan Mackenzie
2021-03-21  6:53 ` Suggested experimental test Lars Ingebrigtsen
2021-03-21  8:35   ` Alfred M. Szmidt
2021-03-21 13:20     ` Gregory Heytings
2021-03-21 18:16       ` Alfred M. Szmidt
2021-03-21 22:16         ` Gregory Heytings
2021-03-21 22:54           ` Alfred M. Szmidt
2021-03-21 23:05             ` Gregory Heytings
2021-03-21 23:13               ` Alfred M. Szmidt
2021-03-21 23:46                 ` Gregory Heytings
2021-03-22  0:40                   ` Alfred M. Szmidt
2021-03-22 10:05                     ` Gregory Heytings
2021-03-22 18:14                       ` Alfred M. Szmidt
2021-03-22 19:06                         ` Gregory Heytings
2021-03-22 19:56                           ` [External] : " Drew Adams
2021-03-22 21:03                             ` Alfred M. Szmidt
2021-03-22 21:26                               ` Drew Adams
2021-03-23  8:06                                 ` Alfred M. Szmidt
2021-03-22 21:08                           ` Alfred M. Szmidt
2021-03-22 11:21                   ` Jean Louis
2021-03-22 11:07               ` Jean Louis
2021-03-22  3:33           ` Eli Zaretskii
2021-03-22 10:05             ` Gregory Heytings
2021-03-22 11:37               ` Philip Kaludercic
2021-03-22 12:20                 ` Gregory Heytings
2021-03-22 17:38               ` Eli Zaretskii
2021-03-22 17:48                 ` Gregory Heytings
2021-03-22 18:11                   ` Eli Zaretskii
2021-03-22 18:15                   ` Alfred M. Szmidt
2021-03-22 18:14               ` Alfred M. Szmidt
2021-03-22  8:59           ` Rudolf Schlatte
2021-03-22 10:05             ` Gregory Heytings
2021-03-22 10:49           ` Jean Louis
2021-03-21 10:48   ` Gregory Heytings
2021-03-21 10:58     ` Sv: " arthur miller
2021-03-21 13:20       ` Gregory Heytings
2021-03-21 18:16       ` Sv: " Alfred M. Szmidt
2021-03-22  5:11         ` Richard Stallman
2021-03-22 10:24       ` Sv: " Jean Louis
2021-03-22 10:14     ` Jean Louis
2021-03-22 12:06     ` Lars Ingebrigtsen
2021-03-22 12:23       ` Gregory Heytings
2021-03-22 16:15         ` Jean Louis
2021-03-22 16:14       ` Jean Louis
2021-03-22 17:08         ` Gregory Heytings
2021-03-22 17:46           ` Alan Mackenzie
2021-03-22 17:59             ` Gregory Heytings
2021-03-22 18:23             ` Alfred M. Szmidt
2021-03-23  6:09             ` Richard Stallman
2021-03-22 18:03           ` Jean Louis
2021-03-22 17:20       ` Robin Tarsiger
2021-03-22 17:40       ` Eli Zaretskii
2021-03-22 17:55         ` Gregory Heytings
2021-03-22 18:13           ` Eli Zaretskii
2021-03-22 20:22             ` Gregory Heytings
2021-03-23  8:06               ` Eli Zaretskii
2021-03-23 14:15                 ` Gregory Heytings
2021-03-23 14:37                   ` Eli Zaretskii
2021-03-23 16:51                     ` Gregory Heytings
2021-03-23 17:13                       ` Eli Zaretskii
2021-03-23 18:08                       ` Alfred M. Szmidt
2021-03-23 21:06                         ` Gregory Heytings
2021-03-23 21:43                           ` Alfred M. Szmidt
2021-03-23 21:57                             ` Gregory Heytings
2021-03-23 22:08                               ` Alfred M. Szmidt
2021-03-23 22:14                                 ` Gregory Heytings
2021-03-23 22:42                                   ` Alfred M. Szmidt
2021-03-23 23:05                                     ` Gregory Heytings
2021-03-24  5:15                                 ` Richard Stallman
2021-03-24  5:16                           ` Richard Stallman
2021-03-24  6:39                           ` Jean Louis
2021-03-24  6:32                       ` Jean Louis
2021-03-24  6:10                   ` Jean Louis
2021-03-22 18:17         ` Lars Ingebrigtsen
2021-03-22 18:50           ` Eli Zaretskii
2021-03-22 19:09             ` Lars Ingebrigtsen
2021-03-22 19:55               ` Lars Ingebrigtsen
2021-03-22 22:02                 ` Stefan Kangas
2021-03-22 22:33                   ` [External] : " Drew Adams
2021-03-22 23:28                     ` Stefan Kangas
2021-03-22 22:44                   ` Dmitry Gutov
2021-03-22 23:22                     ` Stefan Kangas
2021-03-23  5:22                     ` Jean Louis
2021-03-23  7:43                       ` Eli Zaretskii
2021-03-23 12:28                         ` Philip Kaludercic
2021-03-23 12:41                           ` Eli Zaretskii
2021-03-23 13:09                             ` Dmitry Gutov
2021-03-23 13:27                               ` Philip Kaludercic
2021-03-23 14:00                                 ` Dmitry Gutov
2021-03-23 13:54                               ` Eli Zaretskii
2021-03-23 17:04                                 ` Dmitry Gutov
2021-03-23 21:06                                 ` chad
2021-03-24  5:07                             ` Jean Louis
2021-03-25  5:09                               ` Richard Stallman
2021-03-23  6:12                     ` Yuri Khan
2021-03-24 23:41                       ` Dmitry Gutov
2021-03-25  6:12                         ` Yuri Khan
2021-03-25 13:20                           ` Dmitry Gutov
2021-03-25 14:30                             ` Basil L. Contovounesios
2021-03-25 17:09                               ` Dmitry Gutov
2021-03-25 18:59                               ` Yuri Khan
2021-03-25 19:30                             ` Yuri Khan
2021-03-25 21:11                               ` Stefan Monnier
2021-03-25 23:54                                 ` Dmitry Gutov
2021-03-26 10:34                                   ` Stefan Kangas
2021-03-26 23:13                                     ` Dmitry Gutov
2021-03-26 23:34                               ` Dmitry Gutov [this message]
2021-03-27  0:02                                 ` Stefan Monnier
2021-03-28 13:59                                   ` Dmitry Gutov
2021-03-22 20:22               ` Gregory Heytings
2021-03-22 20:36                 ` Lars Ingebrigtsen
2021-03-22 21:03                   ` Alfred M. Szmidt
2021-03-22 20:56         ` Thierry Volpiatto
2021-03-22 18:11       ` [EXTERNAL] " Stephan Mueller
2021-03-22 18:34         ` Lars Ingebrigtsen
2021-03-22 18:56           ` Eli Zaretskii
2021-03-22 19:13             ` Lars Ingebrigtsen
2021-03-22 19:19               ` Eli Zaretskii
2021-03-22 19:25                 ` Lars Ingebrigtsen
2021-03-22 19:49                   ` Stefan Monnier
2021-03-22 19:52                     ` Lars Ingebrigtsen
2021-03-22 20:54                       ` Stefan Monnier
2021-03-22 21:04                         ` Lars Ingebrigtsen
2021-03-23  7:18                           ` Eli Zaretskii
2021-03-22 19:21               ` chad
2021-03-22 19:26                 ` Eli Zaretskii
2021-03-22 19:51                   ` Stefan Monnier
2021-03-22 20:04                     ` Eli Zaretskii
2021-03-22 20:11                       ` Lars Ingebrigtsen
2021-03-22 20:16                         ` Lars Ingebrigtsen
2021-03-23  7:04                           ` Eli Zaretskii
2021-03-22 20:49                       ` Stefan Monnier
2021-03-22 21:02                         ` [External] : " Drew Adams
2021-03-23  7:09                         ` Eli Zaretskii
2021-03-22 19:28                 ` Lars Ingebrigtsen
2021-03-22 19:56                   ` [External] : " Drew Adams
2021-03-22 20:56                     ` Stefan Monnier
2021-03-22 21:19                       ` Drew Adams
2021-03-22 20:22             ` Gregory Heytings
2021-03-23  8:09               ` Eli Zaretskii
2021-03-23 14:15                 ` Gregory Heytings
2021-03-23 14:31                   ` Eli Zaretskii
2021-03-23 17:21                   ` Bob Rogers
2021-03-24  5:42                   ` Jean Louis
2021-03-23 20:55                 ` chad
2021-03-25 17:04           ` [EXTERNAL] " Stephan Mueller
2021-03-22 19:37         ` Stefan Monnier
2021-03-22 19:42         ` Dmitry Gutov
2021-03-22 20:33       ` Jose A. Ortega Ruiz
2021-03-22 18:42     ` Sean Whitton
  -- strict thread matches above, loose matches on Subject: below --
2021-03-23 21:51 Paul W. Rankin via Emacs development discussions.
2021-03-24  8:34 ` Lars Ingebrigtsen
2021-03-24  8:51   ` tomas
2021-03-24  9:16     ` Paul W. Rankin via Emacs development discussions.
2021-03-24  9:22       ` tomas
2021-03-24 10:37     ` Eli Zaretskii
2021-03-24 11:13       ` tomas
2021-03-24 11:51         ` Jean Louis
2021-03-24 11:55           ` tomas
2021-03-25  5:14           ` Richard Stallman
2021-03-24 17:04         ` Eli Zaretskii
2021-03-24 17:19           ` tomas
2021-03-24 17:30         ` Dmitry Gutov
2021-03-24 20:08           ` tomas
2021-03-25  5:14       ` Richard Stallman
2021-03-25  5:48         ` Paul W. Rankin via Emacs development discussions.
2021-03-25  7:46         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45322b47-e868-d242-0972-8d517e2dcfd7@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=gregory@heytings.org \
    --cc=larsi@gnus.org \
    --cc=stefankangas@gmail.com \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).