Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions meow-keypad.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@
"Lookup the command which is bound at KEYS."
(let* ((keybind (if meow--keypad-base-keymap
(lookup-key meow--keypad-base-keymap keys)
(key-binding keys))))
(unless (and (meow--is-self-insertp keybind)
(not meow-keypad-self-insert-undefined))
keybind)))
(key-binding keys))))
keybind))

(defun meow--keypad-has-sub-meta-keymap-p ()
"Check if there's a keymap belongs to Meta prefix.
Expand Down Expand Up @@ -392,6 +390,7 @@ Returning DEF will result in a generated title."
"Execute the COMMAND.

If there are beacons, execute it at every beacon."
(setq last-command-event last-input-event)
(if (meow--keypad-in-beacon-p)
(cond
((member command '(kmacro-start-macro kmacro-start-macro-or-insert-counter))
Expand Down Expand Up @@ -439,7 +438,11 @@ try replacing the last modifier and try again."
(meow--keypad-try-execute))
(t
(setq meow--prefix-arg nil)
(message "%s is undefined" (meow--keypad-format-keys nil))
(if meow-keypad-self-insert-undefined
(progn
(undo-boundary)
(meow--keypad-execute 'self-insert-command))
(message "%s is undefined" (meow--keypad-format-keys nil)))
(meow--keypad-quit)
t)))))

Expand Down Expand Up @@ -500,6 +503,13 @@ command when there's one available on current key sequence."
(setq meow--keypad-keys (meow--parse-string-to-keypad-keys meow-keypad-leader-dispatch)))
(push (cons 'literal key) meow--keypad-keys))))

(when meow--keypad-keys ;; Last key may be a meta modifier and won't set keypad-keys
(setq last-input-event (thread-first
(car meow--keypad-keys)
(meow--keypad-format-key-1)
(kbd)
(aref 0))))

;; Try execute if the input is valid.
(if (or meow--use-literal
meow--use-meta
Expand Down