[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: POLL: make C-x o transient
From: |
Philip K. |
Subject: |
Re: POLL: make C-x o transient |
Date: |
Thu, 28 Jan 2021 08:46:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Juri Linkov <juri@linkov.net> writes:
>>>> Which will make `C-x o` invoke a transient version of `other-window'
>>>> like `text-scale-adjust’ does.
>>>
>>> I think the pattern is clear: `C-x <letter>` are good candidates ;-)
>>
>> And non-letters too, especially `C-x {`, `C-x }`, `C-x ^`, ...
>> need to be repeatable. I'm using such quite messy blob of code,
>> it would be nice if someone would generalize this mess
>> without using advice-add.
>
> Maybe something simple like:
>
> #+begin_src emacs-lisp
> (put 'other-window 'repeatable-command t)
> (put 'enlarge-window 'repeatable-command t)
> (put 'enlarge-window-horizontally 'repeatable-command t)
> (put 'shrink-window-horizontally 'repeatable-command t)
>
> (add-hook 'post-command-hook 'repeatable-command)
>
> (defun repeatable-command ()
> (when (get this-command 'repeatable-command)
> (let* ((keys (this-single-command-keys))
> (last-key (elt keys (1- (length keys)))))
> (set-transient-map
> (let ((map (make-sparse-keymap)))
> (define-key map (vector last-key) this-command)
> map)))))
> #+end_src
I like this idea, but would the hook be added by default?
--
Philip K.
- Re: POLL: make C-x o transient, (continued)
- Re: POLL: make C-x o transient, Philip K., 2021/01/25
- Re: POLL: make C-x o transient, Colin Baxter, 2021/01/25
- Re: POLL: make C-x o transient, Richard Stallman, 2021/01/26
- Re: POLL: make C-x o transient, Olivier Certner, 2021/01/26
- Re: POLL: make C-x o transient, Sean Whitton, 2021/01/26
- Re: POLL: make C-x o transient, Colin Baxter, 2021/01/27
RE: [External] : Re: POLL: make C-x o transient, Drew Adams, 2021/01/25
Re: POLL: make C-x o transient, Juri Linkov, 2021/01/25
Re: POLL: make C-x o transient, martin rudalics, 2021/01/28
Re: POLL: make C-x o transient, Juri Linkov, 2021/01/28
Re: POLL: make C-x o transient, Gregory Heytings, 2021/01/28
Re: POLL: make C-x o transient, Kévin Le Gouguec, 2021/01/28
Re: POLL: make C-x o transient, Gregory Heytings, 2021/01/28
Re: POLL: make C-x o transient, Alan Mackenzie, 2021/01/28
Re: POLL: make C-x o transient, Philip K., 2021/01/28
RE: [External] : Re: POLL: make C-x o transient, Drew Adams, 2021/01/28
Re: [External] : Re: POLL: make C-x o transient, chad, 2021/01/28