Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 11 additions & 6 deletions meow-keypad.el
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Argument CONTROL, non-nils stands for current input is prefixed with Control."
(suppress-keymap km t)
(map-keymap
(lambda (key def)
(when (and (not (member 'control (event-modifiers key)))
(when (and (if meow-keypad-capital-letter-add-ctrl t (not (member 'control (event-modifiers key))))
(not (member key (list meow-keypad-meta-prefix
meow-keypad-ctrl-meta-prefix
meow-keypad-literal-prefix)))
Expand All @@ -211,7 +211,7 @@ Argument CONTROL, non-nils stands for current input is prefixed with Control."
(suppress-keymap km t)
(map-keymap
(lambda (key def)
(when (member 'control (event-modifiers key))
(when (if meow-keypad-capital-letter-add-ctrl t (member 'control (event-modifiers key)))
(unless (member (meow--event-key key) ignores)
(when def
(let ((k (vector (meow--get-event-key key))))
Expand All @@ -220,7 +220,7 @@ Argument CONTROL, non-nils stands for current input is prefixed with Control."
keymap)
(map-keymap
(lambda (key def)
(unless (member 'control (event-modifiers key))
(unless (if meow-keypad-capital-letter-add-ctrl nil (member 'control (event-modifiers key)))
(unless (member key ignores)
(let ((k (vector (meow--get-event-key key))))
(unless (lookup-key km k)
Expand Down Expand Up @@ -499,7 +499,11 @@ command when there's one available on current key sequence."
meow--keypad-keys)
(setq meow--use-literal t))
(meow--keypad-keys
(push (cons 'control key) meow--keypad-keys))
(if (and meow-keypad-capital-letter-add-ctrl (equal 'control (caar (last meow--keypad-keys))))
(if (and (equal (upcase key) key) (= (length key) 1))
(push (cons 'control (downcase key)) meow--keypad-keys)
(push (cons 'literal key) meow--keypad-keys))
(push (cons 'control key) meow--keypad-keys)))
((alist-get input-event meow-keypad-start-keys)
(push (cons 'control (meow--parse-input-event
(alist-get input-event meow-keypad-start-keys)))
Expand All @@ -508,8 +512,9 @@ command when there's one available on current key sequence."
(if-let* ((keymap (meow--get-leader-keymap)))
(setq meow--keypad-base-keymap keymap)
(setq meow--keypad-keys (meow--parse-string-to-keypad-keys meow-keypad-leader-dispatch)))
(push (cons 'literal key) meow--keypad-keys))))

(if (and meow-keypad-capital-letter-add-ctrl (equal (upcase key) key) (= (length key) 1))
(push (cons 'control (downcase key)) meow--keypad-keys)
(push (cons 'literal key) meow--keypad-keys)))))
;; Try execute if the input is valid.
(if (or meow--use-literal
meow--use-meta
Expand Down
9 changes: 8 additions & 1 deletion meow-util.el
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,14 @@ Looks up the state in meow-replace-state-name-list"
(if (and (integerp (event-basic-type e))
(member 'shift (event-modifiers e)))
(upcase (event-basic-type e))
(event-basic-type e)))
(let ((key-des (key-description (vector e))))
(if (and meow-keypad-capital-letter-add-ctrl (string-prefix-p "C-" key-des) (characterp (event-basic-type e)))
(upcase (event-basic-type e))
(if (string-equal-ignore-case key-des "tab")
key-des
(event-basic-type e)
)
))))

(defun meow--ensure-visible ()
(let ((overlays (overlays-at (1- (point))))
Expand Down
6 changes: 6 additions & 0 deletions meow-var.el
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ Nil stands for taking leader keymap from `meow-keymap-alist'."
:type '(choice (string :tag "Keys")
(variable :tag "Keymap")
(const nil)))
(defcustom meow-keypad-capital-letter-add-ctrl nil
"Whether to enter a capital letter, add ctrol in front of it and change
the capital letter to lowercase.input uppercase letter add ctrol before.
For example use `SPC x F' to execute `C-x C-f' ."
:group 'meow
:type 'boolean)

(defcustom meow-keypad-meta-prefix ?m
"The prefix represent M- in KEYPAD state."
Expand Down