[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: POLL: make C-x o transient
From: |
Juri Linkov |
Subject: |
Re: POLL: make C-x o transient |
Date: |
Wed, 03 Feb 2021 19:20:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> In this case it's easy to implement it as a minor mode that uses hooks,
>> e.g. last-char-repeatable-mode added to repeat.el.
>>
>> This could be like delete-selection-mode that by default
>> puts a special property on symbols of affected commands.
>
> I think this is the best way to implement this. People who don't want
> to accept getting into transient states where not every self-insert key
> is self-inserting can turn the mode off entirely (and maybe bind 'repeat
> to C-z or something, which is what I do), and people who haven't had
> problems with that can turn it on once and have it work all over.
As Gregory noted, it's not clear which keys to use in every case:
for 'C-x o' it makes sense to use the shifted version "O" too,
for 'M-g n' also to use the opposite key "p".
It's possible to solve this by attaching own transient map
to each repeatable command like:
(put 'other-window 'repeat-map 'other-window-repeat-map)
(defvar other-window-repeat-map
(let ((map (make-sparse-keymap)))
(define-key map "o" 'other-window)
(define-key map "O" (lambda () (interactive) (other-window -1)))
map)
"Keymap to navigate windows.")
(put 'next-error 'repeat-map 'next-error-repeat-map)
(put 'previous-error 'repeat-map 'next-error-repeat-map)
(defvar next-error-repeat-map
(let ((map (make-sparse-keymap)))
(define-key map "n" 'next-error)
(define-key map "p" 'previous-error)
map)
"Keymap to navigate errors.")