diff --git a/init.el b/init.el index 07c76a9..934101f 100644 --- a/init.el +++ b/init.el @@ -48,15 +48,15 @@ (global-set-key (kbd "C-z") #'undo-fu-only-undo) (global-set-key (kbd "C-S-z") #'undo-fu-only-redo)) -(defun my-meow-undo (arg) - "Same as meow-undo, but uses undo-fu to redo if negative prefix." - (interactive "P") - (when (region-active-p) - (meow--cancel-selection)) - (let ((numeric-prefix (prefix-numeric-value arg))) - (if (meow--with-negative-argument-p arg) - (undo-fu-only-redo (abs numeric-prefix)) - (undo-fu-only-undo numeric-prefix)))) +(cl-defun my-meow-undo (arg) + "Uses undo-fu to undo, but cancels region first unless negative prefix." + (interactive "*p") + (let ((undo-fu-allow-undo-in-region t)) + (pcase (cons (< arg 0) (region-active-p)) + ('(t . t) (setq arg (abs arg))) + ('(t . nil) (cl-return-from my-meow-undo)) + ('(nil . t) (setq undo-fu-allow-undo-in-region nil))) + (undo-fu-only-undo arg))) (defun my-meow-forward-paragraph () (interactive) (meow--execute-kbd-macro "M-}")) @@ -146,7 +146,7 @@ '("s" . meow-kill) '("t" . meow-till) '("u" . my-meow-undo) - '("U" . meow-undo-in-selection) + '("U" . undo-fu-only-redo) '("v" . meow-page-down) '("V" . meow-page-up) '("w" . meow-mark-word) @@ -179,7 +179,7 @@ :inherit unspecified)))) (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 (cons (lambda () (and (meow-insert-mode-p) (not (display-graphic-p)))) (lambda () (meow--set-cursor-type '(hbar 2))))))