[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter ke
From: |
Juri Linkov |
Subject: |
Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515) |
Date: |
Thu, 18 Feb 2021 11:37:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> +(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?
>
>> + (set-transient-map map)))))))
>
> For example passing a second argument t to `set-transient-map` makes
> `set-transient-map` look to see if the key just typed was found in the
> map and if so keep the transient alive, which seems to [after an
> admittedly cursory check of the code] play the same role as what your
> `repeat-map` property does, but without the duplication.
The current design relies on post-command-hook that runs after every command.
Using the second argument KEEP-PRED of set-transient-map will add duplication:
the same map will be set by both post-command-hook and KEEP-PRED.
So currently there is no duplication. But is it possible to avoid duplication
when using KEEP-PRED too? Could post-command-hook detect that KEEP-PRED
is in use for the next command, and not to call set-transient-map again?
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Stefan Monnier, 2021/02/17
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515),
Juri Linkov <=
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Stefan Monnier, 2021/02/18
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Juri Linkov, 2021/02/18
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Stefan Monnier, 2021/02/23
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Juri Linkov, 2021/02/24
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Stefan Monnier, 2021/02/24
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Juri Linkov, 2021/02/24
- Re: master 12409c9: New transient mode 'repeat-mode' to allow shorter key sequences (bug#46515), Stefan Monnier, 2021/02/24