[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: master 371c4f642a 1/2: Add new commands to zoom emo
From: |
Drew Adams |
Subject: |
RE: [External] : Re: master 371c4f642a 1/2: Add new commands to zoom emojis |
Date: |
Thu, 30 Jun 2022 14:59:11 +0000 |
> These commands should probably be "self repeating" (i.e.,
> repeating without having to switch on repeat-mode).
>
> But do we have code somewhere to reuse the
> repeat-mode machinery in a convenient way?
> I poked around, but didn't see anything obvious.
(Caveat: I'm not following this thread.)
I don't use Emacs 28, with `repeat-mode'. But surely
that should let you use its "machinery" conveniently,
no? Wasn't that the idea behind adding it?
Anyway, this alternative is straightforward and works
fine, as a way to get a "self-repeating" command from
one that isn't.
(defun repeat-command (command)
"Repeat COMMAND."
(require 'repeat) ; Define its vars before we let-bind them.
(let ((repeat-previous-repeated-command command)
(repeat-message-function #'ignore)
(last-repeatable-command 'repeat))
(repeat nil)))
(defun next-buffer-repeat ()
"Switch to the next buffer in the selected window.
You can repeat this by hitting the last key again..."
(interactive)
(require 'repeat)
(repeat-command 'next-buffer))
(defun enlarge-window-repeat ()
"Enlarge selected window vertically by one line.
You can repeat this by hitting the last key again..."
(interactive)
(require 'repeat)
(repeat-command 'enlarge-window))
(defun isearch-yank-line-repeat ()
"Yank buffer text till end of line onto search string.
You can repeat this by hitting the last key again..."
(interactive)
(repeat-command 'isearch-yank-line))
...
(You can also use `transient', but that's kinda
overkill for such simple behavior.)