From c3c282f0a4f99945288f9e656b7684c0e970b630 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 9 Jul 2019 02:33:31 +0200 Subject: [PATCH] =?UTF-8?q?Add=20=CE=BB!!=20(lambda!!)=20macro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For quick inline commands for keybinds that simply call a command (interactively) with a prefix argument. --- core/core-lib.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core-lib.el b/core/core-lib.el index 60c9c2c9f..f698014a5 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -157,7 +157,15 @@ Accepts the same arguments as `message'." (declare (doc-string 1)) `(lambda () (interactive) ,@body)) +(defmacro λ!! (command &optional arg) + "Expands to a command that interactively calls COMMAND with prefix ARG." + (declare (doc-string 1)) + `(lambda () (interactive) + (let ((current-prefix-arg ,arg)) + (call-interactively ,command)))) + (defalias 'lambda! 'λ!) +(defalias 'lambda!! 'λ!!) (defmacro pushnew! (place &rest values) "Like `cl-pushnew', but will prepend VALUES to PLACE.