Rework u/U negative argument configuration for Meow

This commit is contained in:
eriedaberrie 2023-04-08 22:46:40 -07:00
parent 9389b50b1f
commit 90e4eb03b4

22
init.el
View file

@ -48,15 +48,15 @@
(global-set-key (kbd "C-z") #'undo-fu-only-undo) (global-set-key (kbd "C-z") #'undo-fu-only-undo)
(global-set-key (kbd "C-S-z") #'undo-fu-only-redo)) (global-set-key (kbd "C-S-z") #'undo-fu-only-redo))
(defun my-meow-undo (arg) (cl-defun my-meow-undo (arg)
"Same as meow-undo, but uses undo-fu to redo if negative prefix." "Uses undo-fu to undo, but cancels region first unless negative prefix."
(interactive "P") (interactive "*p")
(when (region-active-p) (let ((undo-fu-allow-undo-in-region t))
(meow--cancel-selection)) (pcase (cons (< arg 0) (region-active-p))
(let ((numeric-prefix (prefix-numeric-value arg))) ('(t . t) (setq arg (abs arg)))
(if (meow--with-negative-argument-p arg) ('(t . nil) (cl-return-from my-meow-undo))
(undo-fu-only-redo (abs numeric-prefix)) ('(nil . t) (setq undo-fu-allow-undo-in-region nil)))
(undo-fu-only-undo numeric-prefix)))) (undo-fu-only-undo arg)))
(defun my-meow-forward-paragraph () (defun my-meow-forward-paragraph ()
(interactive) (interactive)
(meow--execute-kbd-macro "M-}")) (meow--execute-kbd-macro "M-}"))
@ -146,7 +146,7 @@
'("s" . meow-kill) '("s" . meow-kill)
'("t" . meow-till) '("t" . meow-till)
'("u" . my-meow-undo) '("u" . my-meow-undo)
'("U" . meow-undo-in-selection) '("U" . undo-fu-only-redo)
'("v" . meow-page-down) '("v" . meow-page-down)
'("V" . meow-page-up) '("V" . meow-page-up)
'("w" . meow-mark-word) '("w" . meow-mark-word)
@ -179,7 +179,7 @@
:inherit :inherit
unspecified)))) unspecified))))
(dolist (meow-cursor-face '(meow-normal-cursor meow-motion-cursor meow-beacon-cursor)) (dolist (meow-cursor-face '(meow-normal-cursor meow-motion-cursor meow-beacon-cursor))
(face-spec-set meow-cursor-face `((t (:inherit meow-unknown-cursor))))) (face-spec-set meow-cursor-face '((t (:inherit meow-unknown-cursor)))))
(add-to-list 'meow-update-cursor-functions-alist (add-to-list 'meow-update-cursor-functions-alist
(cons (lambda () (and (meow-insert-mode-p) (not (display-graphic-p)))) (cons (lambda () (and (meow-insert-mode-p) (not (display-graphic-p))))
(lambda () (meow--set-cursor-type '(hbar 2)))))) (lambda () (meow--set-cursor-type '(hbar 2))))))