[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: repeatable vs. non-repeatable commands
From: |
Stefan Monnier |
Subject: |
Re: repeatable vs. non-repeatable commands |
Date: |
Sat, 24 Jun 2017 09:23:29 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> FWIW, my idea was consulting `this-command-keys', but due to bug#27470,
> I can't use it in my case.
I just sent a workaround for bug#27470 that you might be able to use
(i.e. call this-command-keys(-vector) at the very beginning).
E.g.
(defun el-search--repeatable-binding-p ()
"Return non-nil if the last command's binding should be repeatable.
Beware: this should be called before any other user-interaction."
(let ((keys (this-command-keys-vector)))
(> (length keys)
;; Meta is often turned into a separate ESC byte in
;; terminal emulators.
(if (eq ?\e (aref keys 0)) 2 1))))
(defun my-el-search-foo (arg1 arg &optional repeat)
(interactive
(let ((repeat (el-search--repeatable-binding-p)))
...
(list ... repeat)))
[...]
(when repeat
(set-transient-map ...)))
Stefan