From 574773e487e5f7d1f604e5025f17dea962abeec8 Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Sun, 10 Nov 2024 07:38:22 +0800 Subject: [PATCH] Add meow-keypad-execute-on-beacons --- meow-keypad.el | 19 ++++++++++++++++++- meow-var.el | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/meow-keypad.el b/meow-keypad.el index 25c3ff4..fd71f53 100644 --- a/meow-keypad.el +++ b/meow-keypad.el @@ -40,6 +40,7 @@ (require 'meow-var) (require 'meow-util) (require 'meow-helpers) +(require 'meow-beacon) (defun meow--keypad-format-upcase (k) "Return S-k for upcase k." @@ -367,6 +368,22 @@ Returning DEF will result in a generated title." (propertize pre 'face 'font-lock-comment-face))) (propertize (meow--keypad-format-keys nil) 'face 'font-lock-string-face)))) +(defun meow--keypad-execute (command) + "Execute the COMMAND. + +If there are beacons, execute it at every beacon." + (cond + ((and meow-keypad-execute-on-beacons + (not defining-kbd-macro) + (not executing-kbd-macro) + (meow--beacon-inside-secondary-selection) + meow--beacon-overlays) + (call-interactively command) + (meow--beacon-apply-command command)) + + (t + (call-interactively command)))) + (defun meow--keypad-try-execute () "Try execute command. @@ -389,7 +406,7 @@ try replacing the last modifier and try again." (meow--keypad-quit) (setq real-this-command cmd this-command cmd) - (call-interactively cmd)))) + (meow--keypad-execute cmd)))) ((keymapp cmd) (when meow-keypad-message (meow--keypad-show-message)) (meow--keypad-display-message)) diff --git a/meow-var.el b/meow-var.el index e5dc50c..0d8420f 100644 --- a/meow-var.el +++ b/meow-var.el @@ -46,6 +46,14 @@ This will affect how selection is displayed." :group 'meow :type '(repeat sexp)) +(defcustom meow-keypad-execute-on-beacons nil + "Execute keypad command directly on beacons when using it directly from +beacon state. + +This doesn't affect how keypad works on recording or executing a kmacro." + :group 'meow + :type 'boolean) + (defcustom meow-selection-command-fallback '((meow-change . meow-change-char) (meow-kill . meow-C-k)