[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/meow 8ae8b2cfa8 3/8: Use loop with read-event in keypad (#
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/meow 8ae8b2cfa8 3/8: Use loop with read-event in keypad (#680) |
Date: |
Sun, 1 Dec 2024 07:00:22 -0500 (EST) |
branch: elpa/meow
commit 8ae8b2cfa801a5b041d8290a749fbef305238537
Author: tianshu <doglooksgood@hotmail.com>
Commit: GitHub <noreply@github.com>
Use loop with read-event in keypad (#680)
* Use loop with read-event in keypad
* Display popup right after switching to keypad
* Fix non-ascii key handling in keypad
* Fix meow-keypad-start, meow-keypad-start-with and meow-keypad-describe-key
* Remove keymap-lookup usage
* Fix some docs
---
meow-cheatsheet.el | 8 +--
meow-command.el | 26 ---------
meow-core.el | 10 +---
meow-helpers.el | 3 +-
meow-keymap.el | 41 +++-----------
meow-keypad.el | 162 ++++++++++++++++++++++++++++++-----------------------
meow-shims.el | 24 ++++++--
meow-var.el | 8 ++-
8 files changed, 136 insertions(+), 146 deletions(-)
diff --git a/meow-cheatsheet.el b/meow-cheatsheet.el
index 6ca2790d35..855023df72 100644
--- a/meow-cheatsheet.el
+++ b/meow-cheatsheet.el
@@ -80,19 +80,19 @@ Currently `meow-cheatsheet-layout-qwerty',
`meow-cheatsheet-layout-dvorak',
(goto-char (point-min))
(when (search-forward tgt nil t)
(let ((x (- (point) (line-beginning-position))))
- (backward-delete-char 9)
+ (delete-char -9)
(insert (concat " " upper " "))
(forward-line 1)
(forward-char x)
- (backward-delete-char 9)
+ (delete-char -9)
(insert (propertize (meow--short-command-name upper-cmd) 'face
'meow-cheatsheet-highlight))
(forward-line 2)
(forward-char x)
- (backward-delete-char 9)
+ (delete-char -9)
(insert (concat " " lower " "))
(forward-line 1)
(forward-char x)
- (backward-delete-char 9)
+ (delete-char -9)
(insert (propertize (meow--short-command-name lower-cmd) 'face
'meow-cheatsheet-highlight)))))))
(defun meow--cheatsheet-render-char-thing-table (&optional key-face)
diff --git a/meow-command.el b/meow-command.el
index 9120ca06c9..816eb97221 100644
--- a/meow-command.el
+++ b/meow-command.el
@@ -1734,30 +1734,6 @@ Use negative argument for backward application."
(goto-char (max (point) (overlay-end ov))))
(delete-overlay ov))))))))
-(defun meow-start-kmacro ()
- "Start kmacro.
-
-This command is a replacement for built-in `kmacro-start-macro'."
- (interactive)
- (cond
- ((or (meow-normal-mode-p) (meow-motion-mode-p))
- (call-interactively #'kmacro-start-macro))
- (t
- (message "Can only start recording in NORMAL or MOTION state."))))
-
-(defun meow-start-kmacro-or-insert-counter ()
- "Start kmacro or insert counter.
-
-This command is a replacement for built-in
- `kmacro-start-macro-or-insert-counter'."
- (interactive)
- (cond
- ((or defining-kbd-macro executing-kbd-macro)
- (call-interactively #'kmacro-insert-counter))
- ((or (meow-normal-mode-p) (meow-motion-mode-p))
- (call-interactively #'kmacro-start-macro-or-insert-counter))
- (t (message "Can only start recording in NORMAL or MOTION state."))))
-
(defun meow-end-or-call-kmacro ()
"End kmacro recording or call macro.
@@ -1781,8 +1757,6 @@ This command is a replacement for built-in
`kmacro-end-or-call-macro'."
This command is a replacement for built-in `kmacro-end-macro'."
(interactive)
(cond
- (meow--keypad-this-command
- (message "Can't end kmacro with KEYPAD command"))
((or (meow-normal-mode-p)
(meow-motion-mode-p))
(call-interactively #'kmacro-end-or-call-macro))
diff --git a/meow-core.el b/meow-core.el
index 942c289007..3fd662a417 100644
--- a/meow-core.el
+++ b/meow-core.el
@@ -68,14 +68,12 @@
(meow-define-state keypad
"Meow KEYPAD state minor mode."
:lighter " [K]"
- :keymap meow-keypad-state-keymap
:face meow-keypad-cursor
(when meow-keypad-mode
(setq meow--prefix-arg current-prefix-arg
- meow--keypad-keymap-description-activated nil
- meow--keypad-allow-quick-dispatch t
+ meow--keypad-keymap-description-activated nil
+ meow--keypad-allow-quick-dispatch t
meow--keypad-base-keymap nil
- meow--keypad-keys nil
meow--use-literal nil
meow--use-meta nil
meow--use-both nil)))
@@ -162,7 +160,7 @@ there's no chance for meow to call an init function."
(meow--cancel-second-selection)))
(defun meow--enable-theme-advice (theme)
- "Prepare face if the theme to enable is `user'."
+ "Prepare face if the THEME to enable is `user'."
(when (eq theme 'user)
(meow--prepare-face)))
@@ -187,8 +185,6 @@ there's no chance for meow to call an init function."
`((meow-motion-mode . ,meow-motion-state-keymap)))
(add-to-ordered-list 'emulation-mode-map-alists
`((meow-normal-mode . ,meow-normal-state-keymap)))
- (add-to-ordered-list 'emulation-mode-map-alists
- `((meow-keypad-mode . ,meow-keypad-state-keymap)))
(add-to-ordered-list 'emulation-mode-map-alists
`((meow-beacon-mode . ,meow-beacon-state-keymap)))
(when meow-use-cursor-position-hack
diff --git a/meow-helpers.el b/meow-helpers.el
index 88eeb0328b..afda9a70d0 100644
--- a/meow-helpers.el
+++ b/meow-helpers.el
@@ -171,7 +171,8 @@ meow--set-cursor-type and meow--set-cursor-color."
`(,name . ,(upcase (symbol-name name))))
(add-to-list 'meow-update-cursor-functions-alist
`(,activep . ,cursorf))
- (add-to-list 'meow-keymap-alist `(,name . ,keymap)))
+ (when keymap
+ (add-to-list 'meow-keymap-alist `(,name . ,keymap))))
;;;###autoload
(defmacro meow-define-state (name-sym
diff --git a/meow-keymap.el b/meow-keymap.el
index 0aca7574cf..a38600652a 100644
--- a/meow-keymap.el
+++ b/meow-keymap.el
@@ -24,6 +24,10 @@
(require 'meow-var)
+(declare-function meow-describe-key "meow-command")
+(declare-function meow-end-or-call-kmacro "meow-command")
+(declare-function meow-end-kmacro "meow-command")
+
(defvar meow-keymap
(let ((keymap (make-sparse-keymap)))
(define-key keymap [remap describe-key] #'meow-describe-key)
@@ -33,8 +37,6 @@
(defvar meow-insert-state-keymap
(let ((keymap (make-keymap)))
(define-key keymap [escape] 'meow-insert-exit)
- (define-key keymap [remap kmacro-start-macro] #'meow-start-kmacro)
- (define-key keymap [remap kmacro-start-macro-or-insert-counter]
#'meow-start-kmacro-or-insert-counter)
(define-key keymap [remap kmacro-end-or-call-macro]
#'meow-end-or-call-kmacro)
(define-key keymap [remap kmacro-end-macro] #'meow-end-kmacro)
keymap)
@@ -60,8 +62,6 @@
(define-key keymap (kbd "SPC") 'meow-keypad)
(define-key keymap (kbd "i") 'meow-insert)
(define-key keymap (kbd "a") 'meow-append)
- (define-key keymap [remap kmacro-start-macro] #'meow-start-kmacro)
- (define-key keymap [remap kmacro-start-macro-or-insert-counter]
#'meow-start-kmacro-or-insert-counter)
(define-key keymap [remap kmacro-end-or-call-macro]
#'meow-end-or-call-kmacro)
(define-key keymap [remap kmacro-end-macro] #'meow-end-kmacro)
keymap)
@@ -77,33 +77,13 @@
(defvar meow-keypad-state-keymap
(let ((map (make-sparse-keymap)))
(suppress-keymap map t)
- (define-key map [remap self-insert-command] 'meow-keypad-self-insert)
- (define-key map [remap kmacro-start-macro] #'meow-start-kmacro)
- (define-key map [remap kmacro-start-macro-or-insert-counter]
#'meow-start-kmacro-or-insert-counter)
(define-key map [remap kmacro-end-or-call-macro] #'meow-end-or-call-kmacro)
(define-key map [remap kmacro-end-macro] #'meow-end-kmacro)
- (let ((i ?\s))
- (while (< i 256)
- (define-key map (vector i) 'meow-keypad-self-insert)
- (setq i (1+ i)))
- (define-key map (kbd "DEL") 'meow-keypad-undo)
- (define-key map (kbd "<backspace>") 'meow-keypad-undo)
- (define-key map (kbd "<escape>") 'meow-keypad-quit)
- (define-key map [remap keyboard-quit] 'meow-keypad-quit)
- (define-key map (kbd "<deletechar>") 'meow-keypad-self-insert)
- (define-key map (kbd "<tab>") 'meow-keypad-self-insert)
- (define-key map (kbd "TAB") 'meow-keypad-self-insert)
- (define-key map (kbd "<return>") 'meow-keypad-self-insert)
- (define-key map (kbd "<up>") 'meow-keypad-self-insert)
- (define-key map (kbd "<down>") 'meow-keypad-self-insert)
- (define-key map (kbd "<left>") 'meow-keypad-self-insert)
- (define-key map (kbd "<right>") 'meow-keypad-self-insert)
- (define-key map (kbd "<home>") 'meow-keypad-self-insert)
- (define-key map (kbd "<end>") 'meow-keypad-self-insert)
- (define-key map (kbd "<next>") 'meow-keypad-self-insert)
- (define-key map (kbd "<prior>") 'meow-keypad-self-insert)
- (define-key map (kbd "<insert>") 'meow-keypad-self-insert)
- (define-key map (kbd "RET") 'meow-keypad-self-insert))
+ (define-key map (kbd "DEL") 'meow-keypad-undo)
+ (define-key map (kbd "<backspace>") 'meow-keypad-undo)
+ (define-key map (kbd "<escape>") 'meow-keypad-quit)
+ (define-key map (kbd "ESC") 'meow-keypad-quit)
+ (define-key map [remap keyboard-quit] 'meow-keypad-quit)
map)
"Keymap for Meow keypad state.")
@@ -123,9 +103,6 @@
(define-key map [remap kmacro-end-or-call-macro] 'meow-beacon-apply-kmacro)
(define-key map [remap kmacro-start-macro-or-insert-counter]
'meow-beacon-start)
(define-key map [remap kmacro-start-macro] 'meow-beacon-start)
-
- (define-key map [remap meow-start-kmacro] 'meow-beacon-start)
- (define-key map [remap meow-start-kmacro-or-insert-counter]
'meow-beacon-start)
(define-key map [remap meow-end-or-call-kmacro] 'meow-beacon-apply-kmacro)
;; noops
diff --git a/meow-keypad.el b/meow-keypad.el
index fd71f53a93..02d17d2a94 100644
--- a/meow-keypad.el
+++ b/meow-keypad.el
@@ -19,21 +19,15 @@
;;; Commentary:
;; Keypad state is a special state to simulate C-x and C-c key sequences.
-;; There are three commands:
+;;
+;; Useful commands:
+;;
+;; meow-keypad
+;; Enter keypad state.
;;
;; meow-keypad-start
;; Enter keypad state, and simulate this key with Control modifier.
;;
-;; meow-keypad-self-insert
-;; This command is bound to every single key in keypad state.
-;; The rules,
-;; - If current key is SPC, the next will be considered without modifier.
-;; - If current key is m, the next will be considered with Meta modifier.
-;; - Other keys, or SPC and m after a prefix, means append a key input, by
default, with Control modifier.
-;;
-;; meow-keypad-undo
-;; Remove the last input, if there's no input in the sequence, exit the keypad
state.
-
;;; Code:
(require 'subr-x)
@@ -43,7 +37,7 @@
(require 'meow-beacon)
(defun meow--keypad-format-upcase (k)
- "Return S-k for upcase k."
+ "Return S-k for upcase K."
(let ((case-fold-search nil))
(if (and (stringp k)
(string-match-p "^[A-Z]$" k))
@@ -68,6 +62,7 @@
(t "")))
(defun meow--keypad-lookup-key (keys)
+ "Lookup the command which is bound at KEYS."
(let* ((overriding-local-map meow--keypad-base-keymap)
(keybind (key-binding keys)))
(unless (and (meow--is-self-insertp keybind)
@@ -75,6 +70,9 @@
keybind)))
(defun meow--keypad-has-sub-meta-keymap-p ()
+ "Check if there's a keymap belongs to Meta prefix.
+
+A key sequences starts with ESC is accessible via Meta key."
(and (not meow--use-literal)
(not meow--use-both)
(not meow--use-meta)
@@ -85,7 +83,9 @@
(lookup-key keymap ""))))))
(defun meow--keypad-format-keys (&optional prompt)
- "Return a display format for current input keys."
+ "Return a display format for current input keys.
+
+The message is prepended with an optional PROMPT."
(let ((result ""))
(setq result
(thread-first
@@ -118,7 +118,10 @@
meow--use-both nil
meow--keypad-help nil)
(setq overriding-local-map nil)
- (meow--exit-keypad-state))
+ (meow--keypad-clear-message)
+ (meow--exit-keypad-state)
+ ;; Return t to indicate the keypad loop should be stopped
+ t)
(defun meow-keypad-quit ()
"Quit keypad state."
@@ -129,6 +132,9 @@
(meow--keypad-quit))
(defun meow--make-keymap-for-describe (keymap control)
+ "Parse the KEYMAP to make it suitable for describe.
+
+Argument CONTROL, non-nils stands for current input is prefixed with Control."
(let ((km (make-keymap)))
(suppress-keymap km t)
(when (keymapp keymap)
@@ -143,6 +149,7 @@
km))
(defun meow--keypad-get-keymap-for-describe ()
+ "Get a keymap for describe."
(let* ((input (thread-first
(mapcar #'meow--keypad-format-key-1 meow--keypad-keys)
(reverse)
@@ -222,7 +229,12 @@
keymap)
km)))))))
+(defun meow--keypad-clear-message ()
+ "Clear displayed message by calling
`meow-keypad-clear-describe-keymap-function'."
+ (funcall meow-keypad-clear-describe-keymap-function))
+
(defun meow--keypad-display-message ()
+ "Display a message for current input state."
(let (overriding-local-map)
(when meow-keypad-describe-keymap-function
(when (or
@@ -359,6 +371,7 @@ Returning DEF will result in a generated title."
(meow--keypad-quit)))
(defun meow--keypad-show-message ()
+ "Show message for current keypad input."
(let ((message-log-max))
(message "KEYPAD%s: %s%s"
(if meow--keypad-help " describe key" "")
@@ -368,24 +381,31 @@ 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-in-beacon-p ()
+ "Return whether keypad is started from BEACON state."
+ (and (meow--beacon-inside-secondary-selection)
+ meow--beacon-overlays))
+
(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))))
+ (if (meow--keypad-in-beacon-p)
+ (cond
+ ((member command '(kmacro-start-macro
kmacro-start-macro-or-insert-counter))
+ (call-interactively 'meow-beacon-start))
+ ((member command '(kmacro-end-macro meow-end-kmacro))
+ (call-interactively 'meow-beacon-end-and-apply-kmacro))
+ ((and (not defining-kbd-macro)
+ (not executing-kbd-macro)
+ meow-keypad-execute-on-beacons)
+ (call-interactively command)
+ (meow--beacon-apply-command command)))
+ (call-interactively command)))
(defun meow--keypad-try-execute ()
- "Try execute command.
+ "Try execute command, return t when the translation progress can be ended.
If there is a command available on the current key binding,
try replacing the last modifier and try again."
@@ -393,7 +413,7 @@ try replacing the last modifier and try again."
meow--use-meta
meow--use-both)
(let* ((key-str (meow--keypad-format-keys nil))
- (cmd (meow--keypad-lookup-key (read-kbd-macro key-str))))
+ (cmd (key-binding (kbd key-str))))
(cond
((commandp cmd t)
(setq current-prefix-arg meow--prefix-arg
@@ -401,29 +421,39 @@ try replacing the last modifier and try again."
(if meow--keypad-help
(progn
(meow--keypad-quit)
- (describe-function cmd))
+ (describe-function cmd)
+ t)
(let ((meow--keypad-this-command cmd))
(meow--keypad-quit)
(setq real-this-command cmd
this-command cmd)
- (meow--keypad-execute cmd))))
+ (meow--keypad-execute cmd)
+ t)))
((keymapp cmd)
(when meow-keypad-message (meow--keypad-show-message))
- (meow--keypad-display-message))
+ (meow--keypad-display-message)
+ nil)
((equal 'control (caar meow--keypad-keys))
(setcar meow--keypad-keys (cons 'literal (cdar meow--keypad-keys)))
(meow--keypad-try-execute))
(t
(setq meow--prefix-arg nil)
(message "%s is undefined" (meow--keypad-format-keys nil))
- (meow--keypad-quit))))))
-
-(defun meow-keypad-self-insert ()
- "Default command when keypad state is enabled."
- (interactive)
- (setq this-command last-command)
- (when-let* ((e (meow--event-key last-input-event))
- (key (meow--parse-input-event e)))
+ (meow--keypad-quit)
+ t)))))
+
+(defun meow--keypad-handle-input-with-keymap (input-event)
+ "Handle INPUT-EVENT with `meow-keypad-state-keymap'."
+ (let* ((k (kbd (single-key-description input-event)))
+ (cmd (lookup-key meow-keypad-state-keymap k)))
+ (if cmd
+ (call-interactively cmd)
+ (meow--keypad-handle-input-event input-event))))
+
+(defun meow--keypad-handle-input-event (input-event)
+ ""
+ (meow--keypad-clear-message)
+ (when-let* ((key (single-key-description input-event)))
(let ((has-sub-meta (meow--keypad-has-sub-meta-keymap-p)))
(cond
(meow--use-literal
@@ -436,23 +466,23 @@ try replacing the last modifier and try again."
(meow--use-meta
(push (cons 'meta key) meow--keypad-keys)
(setq meow--use-meta nil))
- ((and (equal e meow-keypad-meta-prefix)
+ ((and (equal input-event meow-keypad-meta-prefix)
(not meow--use-meta)
has-sub-meta)
(setq meow--use-meta t))
- ((and (equal e meow-keypad-ctrl-meta-prefix)
+ ((and (equal input-event meow-keypad-ctrl-meta-prefix)
(not meow--use-both)
has-sub-meta)
(setq meow--use-both t))
- ((and (equal e meow-keypad-literal-prefix)
+ ((and (equal input-event meow-keypad-literal-prefix)
(not meow--use-literal)
meow--keypad-keys)
(setq meow--use-literal t))
(meow--keypad-keys
(push (cons 'control key) meow--keypad-keys))
- ((alist-get e meow-keypad-start-keys)
+ ((alist-get input-event meow-keypad-start-keys)
(push (cons 'control (meow--parse-input-event
- (alist-get e meow-keypad-start-keys)))
+ (alist-get input-event meow-keypad-start-keys)))
meow--keypad-keys))
(meow--keypad-allow-quick-dispatch
(if-let* ((keymap (meow--get-leader-keymap)))
@@ -468,51 +498,45 @@ try replacing the last modifier and try again."
meow--use-both)
(progn
(when meow-keypad-message (meow--keypad-show-message))
- (meow--keypad-display-message))
+ (meow--keypad-display-message)
+ nil)
(meow--keypad-try-execute))))
(defun meow-keypad ()
- "Enter keypad state."
+ "Enter keypad state and convert inputs."
(interactive)
- (setq this-command last-command)
- (setq meow--keypad-previous-state (meow--current-state))
- (meow--switch-state 'keypad)
- (setq overriding-local-map meow-keypad-state-keymap
- overriding-terminal-local-map nil)
- (meow--keypad-display-message))
+ (meow-keypad-start-with nil))
(defun meow-keypad-start ()
"Enter keypad state with current input as initial key sequences."
(interactive)
- (setq this-command last-command)
- (setq meow--keypad-previous-state (meow--current-state))
+ (setq this-command last-command
+ meow--keypad-keys nil
+ meow--keypad-previous-state (meow--current-state)
+ meow--prefix-arg current-prefix-arg)
(meow--switch-state 'keypad)
- (setq overriding-local-map meow-keypad-state-keymap
- overriding-terminal-local-map nil
- meow--keypad-allow-quick-dispatch nil)
- (call-interactively 'meow-keypad-self-insert))
+ (meow--keypad-handle-input-with-keymap last-input-event)
+ (while (not (meow--keypad-handle-input-with-keymap (read-key)))))
(defun meow-keypad-start-with (input)
"Enter keypad state with INPUT.
-INPUT is a string, stands for initial keys."
- (setq meow--keypad-previous-state (meow--current-state))
+A string INPUT, stands for initial keys.
+When INPUT is nil, start without initial keys."
+ (setq this-command last-command
+ meow--keypad-keys (when input (meow--parse-string-to-keypad-keys
input))
+ meow--keypad-previous-state (meow--current-state)
+ meow--prefix-arg current-prefix-arg)
(meow--switch-state 'keypad)
- (setq meow--keypad-keys (meow--parse-string-to-keypad-keys input)
- overriding-terminal-local-map nil
- overriding-local-map meow-keypad-state-keymap)
- (meow--keypad-try-execute))
+ (meow--keypad-show-message)
+ (meow--keypad-display-message)
+ (while (not (meow--keypad-handle-input-with-keymap (read-key)))))
(defun meow-keypad-describe-key ()
"Describe key via KEYPAD input."
(interactive)
- (setq this-command last-command)
- (setq overriding-local-map meow-keypad-state-keymap
- meow--keypad-help t
- meow--keypad-previous-state (meow--current-state))
- (meow--switch-state 'keypad)
- (meow--keypad-show-message)
- (meow--keypad-display-message))
+ (setq meow--keypad-help t)
+ (meow-keypad))
(provide 'meow-keypad)
;;; meow-keypad.el ends here
diff --git a/meow-shims.el b/meow-shims.el
index 6405f91a17..ab55593f82 100644
--- a/meow-shims.el
+++ b/meow-shims.el
@@ -240,7 +240,7 @@ Argument ENABLE non-nil means turn on."
(defvar meow--magit-setup nil)
(defun meow--magit-blame-hook-function ()
- "Switch meow state when entering/leaving magit-blame-read-only-mode."
+ "Switch meow state when entering/leaving `magit-blame-read-only-mode'."
(if (bound-and-true-p magit-blame-read-only-mode)
(meow--switch-to-motion)
(meow--switch-to-normal)))
@@ -393,13 +393,19 @@ Argument ENABLE non-nil means turn on."
(defvar meow--which-key-setup nil)
(defun meow--which-key-describe-keymap ()
+ "Use which-key for keypad popup."
(if which-key-mode
(setq meow-keypad-describe-keymap-function
(lambda (keymap)
- (which-key--create-buffer-and-show nil keymap nil (concat "Meow: "
(meow--keypad-format-keys)))))
- (setq meow-keypad-describe-keymap-function 'meow-describe-keymap)))
+ (which-key--create-buffer-and-show nil keymap nil (concat "Meow: "
(meow--keypad-format-keys))))
+ meow-keypad-clear-describe-keymap-function 'which-key--hide-popup)
+
+ (setq meow-keypad-describe-keymap-function 'meow-describe-keymap
+ meow-keypad-clear-describe-keymap-function nil)))
(defun meow--setup-which-key (enable)
+ "Setup which-key.
+Argument ENABLE non-nil means turn on."
(setq meow--which-key-setup enable)
(if enable
(add-hook 'which-key-mode-hook 'meow--which-key-describe-keymap)
@@ -413,10 +419,14 @@ Argument ENABLE non-nil means turn on."
(defun meow--input-method-advice (fnc key)
"Advice for `quail-input-method'.
-Only use the input method in insert mode."
+Only use the input method in insert mode.
+Argument FNC, input method function.
+Argument KEY, the current input."
(funcall (if (and (boundp 'meow-mode) meow-mode (not (meow-insert-mode-p)))
#'list fnc) key))
(defun meow--setup-input-method (enable)
+ "Setup input-method.
+Argument ENABLE non-nil means turn on."
(setq meow--input-method-setup enable)
(if enable
(advice-add 'quail-input-method :around 'meow--input-method-advice)
@@ -479,11 +489,13 @@ Argument ENABLE non-nil means turn on."
(declare-function eat-eshell-semi-char-mode "eat")
(declare-function eat-eshell-char-mode "eat")
+(declare-function meow-insert-mode "meow-core")
+
(defun meow--eat-eshell-mode-override-enable ()
(setq-local meow--eat-eshell-mode-override t)
(add-hook 'meow-insert-enter-hook #'eat-eshell-char-mode nil t)
(add-hook 'meow-insert-exit-hook #'eat-eshell-emacs-mode nil t)
- (if meow-insert-mode
+ (if (bound-and-true-p meow-insert-mode)
(eat-eshell-char-mode)
(eat-eshell-emacs-mode)))
@@ -508,6 +520,8 @@ Argument ENABLE non-nil means turn on."
(defvar meow--ediff-setup nil)
(defun meow--setup-ediff (enable)
+ "Setup Ediff.
+Argument ENABLE, non-nil means turn on."
(if enable
(add-hook 'ediff-mode-hook 'meow-motion-mode)
(remove-hook 'ediff-mode-hook 'meow-motion-mode)))
diff --git a/meow-var.el b/meow-var.el
index 922cb23b15..e7047daf50 100644
--- a/meow-var.el
+++ b/meow-var.el
@@ -113,8 +113,9 @@ This doesn't affect how keypad works on recording or
executing a kmacro."
Each item is a (THING FORWARD_SYNTAX_TO_INCLUDE BACKWARD-SYNTAX_TO_INCLUDE)."
:group 'meow
- :type '(list :key-type (symbol :tag "Thing")
- :value-type (list string)))
+ :type '(repeat (list (symbol :tag "Thing")
+ (string :tag "Forward Syntax")
+ (string :tag "Backward Syntax"))))
(defcustom meow-expand-hint-counts
'((word . 30)
@@ -353,6 +354,9 @@ Currently, keypad is not working well with which-key,
so Meow ships a default `meow-describe-keymap'.
Use (setq meow-keypad-describe-keymap-function \\='nil) to disable popup.")
+(defvar meow-keypad-clear-describe-keymap-function nil
+ "The function used to clear the effect of
`meow-keypad-describe-keymap-function'.")
+
(defvar meow-keypad-get-title-function 'meow-keypad-get-title
"The function used to get the title of a keymap or command.")
- [nongnu] elpa/meow updated (74fc0e50e9 -> 96bc722734), ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 8ae8b2cfa8 3/8: Use loop with read-event in keypad (#680),
ELPA Syncer <=
- [nongnu] elpa/meow cde5f4c57b 2/8: Check the version before using buttonize, ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 37990e5323 1/8: Add meow-pop-to-global-mark (#679), ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 024f8e9196 6/8: Remove (kbd "ESC"), ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 5c18500b87 7/8: Fix the warning on (kbd "ESC"), ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 2c2d797b92 5/8: Use a copy of button--properties, ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow ec5a2cf00a 4/8: Use a copy of buttonize, ELPA Syncer, 2024/12/01
- [nongnu] elpa/meow 96bc722734 8/8: Remove emacs version 26.3 from CI, ELPA Syncer, 2024/12/01