unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515)
Date: Wed, 24 Feb 2021 20:45:28 +0200	[thread overview]
Message-ID: <87a6rtl7b3.fsf@mail.linkov.net> (raw)
In-Reply-To: <jwvzgzuo2vg.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 23 Feb 2021 17:08:35 -0500")

>>>>>> +(defvar next-error-repeat-map
>>>>>> +  (let ((map (make-sparse-keymap)))
>>>>>> +    (define-key map    "n" 'next-error)
>>>>>> +    (define-key map "\M-n" 'next-error)
>>>>>> +    (define-key map    "p" 'previous-error)
>>>>>> +    (define-key map "\M-p" 'previous-error)
>>>>>> +    map)
>>>>>> +  "Keymap to repeat next-error key sequences.  Used in `repeat-mode'.")
>>>>>> +(put 'next-error 'repeat-map 'next-error-repeat-map)
>>>>>> +(put 'previous-error 'repeat-map 'next-error-repeat-map)
>>>>>
>>>>> Could we avoid this duplication between the map and the
>>>>> `repeat-map` property?
>>>
>>> There is in the above code snippet: the `put` statements are redundant
>>> since the same info is fundamentally already available from
>>> `next-error-repeat-map`.
>>
>> Now I see where is duplication.  But currently I have no idea
>> in what keymaps post-command-hook should look for keybindings.
>
> I don't see the problem: since your code installs the keymap, it can
> also arrange to stash the info of which keymap to look up.

In

  (put 'next-error 'repeat-map 'next-error-repeat-map)
  (put 'previous-error 'repeat-map 'next-error-repeat-map)

both next-error and previous-error are entry points to
a repeatable key sequence, i.e. both can start a key sequence:

  M-g n n p ...
  M-g p p n ...



  reply	other threads:[~2021-02-24 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210217180506.28704.14280@vcs0.savannah.gnu.org>
     [not found] ` <20210217180507.C061220DFB@vcs0.savannah.gnu.org>
2021-02-18  4:39   ` master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515) Stefan Monnier
2021-02-18  9:37     ` Juri Linkov
2021-02-18 15:32       ` Stefan Monnier
2021-02-18 17:29         ` Juri Linkov
2021-02-23 22:08           ` Stefan Monnier
2021-02-24 18:45             ` Juri Linkov [this message]
2021-02-24 18:58               ` Stefan Monnier
2021-02-24 19:44                 ` Juri Linkov
2021-02-24 20:53                   ` Stefan Monnier

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=87a6rtl7b3.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).