From 532b302bb2da843ac8ae1541e9017d50e20cfbe1 Mon Sep 17 00:00:00 2001 From: Daniel Arnqvist Date: Thu, 7 Nov 2024 00:20:40 +0100 Subject: [PATCH 01/10] Add shim for corfu (#662) --- meow-shims.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/meow-shims.el b/meow-shims.el index a6c18e4..d8d86eb 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -105,6 +105,24 @@ Argument ENABLE non-nil means turn on." (add-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice) (remove-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; corfu + +(defvar meow--corfu-setup nil + "Whether already setup corfu.") + +(defun meow--corfu-maybe-abort-advice () + "Adviced for `meow-insert-exit'." + (when corfu-mode (corfu-quit))) + +(defun meow--setup-corfu (enable) + "Setup for corfu. +Argument ENABLE non-nil means turn on." + (setq meow--corfu-setup enable) + (if enable + (add-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice) + (remove-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; repeat-map @@ -466,6 +484,7 @@ Argument ENABLE non-nil means turn on." (eval-after-load "magit" (lambda () (meow--setup-magit t))) (eval-after-load "wgrep" (lambda () (meow--setup-wgrep t))) (eval-after-load "company" (lambda () (meow--setup-company t))) + (eval-after-load "corfu" (lambda () (meow--setup-corfu t))) (eval-after-load "polymode" (lambda () (meow--setup-polymode t))) (eval-after-load "cider" (lambda () (meow--setup-cider t))) (eval-after-load "sly" (lambda () (meow--setup-sly t))) @@ -486,6 +505,7 @@ Argument ENABLE non-nil means turn on." (when meow--edebug-setup (meow--setup-edebug nil)) (when meow--magit-setup (meow--setup-magit nil)) (when meow--company-setup (meow--setup-company nil)) + (when meow--corfu-setup (meow--setup-corfu nil)) (when meow--wgrep-setup (meow--setup-wgrep nil)) (when meow--polymode-setup (meow--setup-polymode nil)) (when meow--cider-setup (meow--setup-cider nil)) From 36c86fb2e2801e79c18cd17f769b2cbe89476149 Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Thu, 7 Nov 2024 10:26:44 +0800 Subject: [PATCH 02/10] Update corfu shim --- meow-shims.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meow-shims.el b/meow-shims.el index d8d86eb..5b5c81c 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -108,12 +108,14 @@ Argument ENABLE non-nil means turn on." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; corfu +(declare-function corfu-quit "corfu") + (defvar meow--corfu-setup nil "Whether already setup corfu.") (defun meow--corfu-maybe-abort-advice () "Adviced for `meow-insert-exit'." - (when corfu-mode (corfu-quit))) + (when (bound-and-true-p corfu-mode) (corfu-quit))) (defun meow--setup-corfu (enable) "Setup for corfu. From 811849fe562cdb452b25051db9a2bf6be3dee164 Mon Sep 17 00:00:00 2001 From: 45mg <45mm.cartridge421@slmail.me> Date: Thu, 7 Nov 2024 08:42:02 +0000 Subject: [PATCH 03/10] docs: clarify setup with Doom module (#663) Some things are handled by the module. Ref: https://github.com/meow-edit/doom-meow/issues/3 Co-authored-by: 45mg <45mg@no.mail> --- GET_STARTED.org | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/GET_STARTED.org b/GET_STARTED.org index 10e84ec..8e542cd 100644 --- a/GET_STARTED.org +++ b/GET_STARTED.org @@ -40,7 +40,8 @@ You can write your own setup function from scratch or pick one from below as you - [[file:KEYBINDING_COLEMAK.org][Colemak layout]] * Enable meow globally -Add the following code to your configuration. +Add the following code to your configuration, assuming that your function to set +up bindings is called ~meow-setup~: #+begin_src emacs-lisp (require 'meow) @@ -48,6 +49,13 @@ Add the following code to your configuration. (meow-global-mode 1) #+end_src +NOTE: You don't need to do this if you use the [[https://github.com/meow-edit/doom-meow][Doom module]], as it takes care of +loading and enabling Meow. In addition the module defines ~+meow--setup-*~ +functions for all the example layouts included here, so that passing the +corresponding module flag is enough to set up those layouts. (If you want to use +a custom layout, you will need to define your own setup function and call it in +your configuration.) + * Tutorial in Emacs Now you can open the tutorial with ~M-x meow-tutor~. From 162f60bc686e9d106de93fa2057ce424393a66e8 Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Fri, 8 Nov 2024 20:50:16 +0800 Subject: [PATCH 04/10] A minor fix for meow-tutor --- meow-tutor.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meow-tutor.el b/meow-tutor.el index e23610f..28bc062 100644 --- a/meow-tutor.el +++ b/meow-tutor.el @@ -509,7 +509,7 @@ [| \"1\" |] [| \"2\" |] [| \"3\" |] 1. Move the cursor to the line below marked --> - 2. Select the whole line (you know how to do this) + 2. Select the \"1 2 3\" 3. Press \\[meow-grab] to grab the selection 4. Press \\[meow-back-word] to create fake cursors at the beginning of each word in the backwards direction. From 574773e487e5f7d1f604e5025f17dea962abeec8 Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Sun, 10 Nov 2024 07:38:22 +0800 Subject: [PATCH 05/10] Add meow-keypad-execute-on-beacons --- meow-keypad.el | 19 ++++++++++++++++++- meow-var.el | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/meow-keypad.el b/meow-keypad.el index 25c3ff4..fd71f53 100644 --- a/meow-keypad.el +++ b/meow-keypad.el @@ -40,6 +40,7 @@ (require 'meow-var) (require 'meow-util) (require 'meow-helpers) +(require 'meow-beacon) (defun meow--keypad-format-upcase (k) "Return S-k for upcase k." @@ -367,6 +368,22 @@ 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-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)))) + (defun meow--keypad-try-execute () "Try execute command. @@ -389,7 +406,7 @@ try replacing the last modifier and try again." (meow--keypad-quit) (setq real-this-command cmd this-command cmd) - (call-interactively cmd)))) + (meow--keypad-execute cmd)))) ((keymapp cmd) (when meow-keypad-message (meow--keypad-show-message)) (meow--keypad-display-message)) diff --git a/meow-var.el b/meow-var.el index e5dc50c..0d8420f 100644 --- a/meow-var.el +++ b/meow-var.el @@ -46,6 +46,14 @@ This will affect how selection is displayed." :group 'meow :type '(repeat sexp)) +(defcustom meow-keypad-execute-on-beacons nil + "Execute keypad command directly on beacons when using it directly from +beacon state. + +This doesn't affect how keypad works on recording or executing a kmacro." + :group 'meow + :type 'boolean) + (defcustom meow-selection-command-fallback '((meow-change . meow-change-char) (meow-kill . meow-C-k) From 38af7f1d233d84c6513aa8946a5a86c99c4e0865 Mon Sep 17 00:00:00 2001 From: tianshu Date: Sun, 10 Nov 2024 22:31:55 +0800 Subject: [PATCH 06/10] Lower the priority of normal keymap and remove some shims (#664) --- meow-core.el | 2 - meow-shims.el | 117 ++------------------------------------------------ 2 files changed, 3 insertions(+), 116 deletions(-) diff --git a/meow-core.el b/meow-core.el index 942c289..6a77c1b 100644 --- a/meow-core.el +++ b/meow-core.el @@ -185,8 +185,6 @@ there's no chance for meow to call an init function." ;; raise Meow keymap priority (add-to-ordered-list 'emulation-mode-map-alists `((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 diff --git a/meow-shims.el b/meow-shims.el index 5b5c81c..90a58c2 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -82,51 +82,7 @@ Argument ENABLE non-nill means turn on." (apply #'eldoc-remove-command meow--eldoc-commands))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; company - -(defvar meow--company-setup nil - "Whether already setup company.") - -(declare-function company--active-p "company") -(declare-function company-abort "company") - -(defvar company-candidates) - -(defun meow--company-maybe-abort-advice () - "Adviced for `meow-insert-exit'." - (when company-candidates - (company-abort))) - -(defun meow--setup-company (enable) - "Setup for company. -Argument ENABLE non-nil means turn on." - (setq meow--company-setup enable) - (if enable - (add-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice) - (remove-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; corfu - -(declare-function corfu-quit "corfu") - -(defvar meow--corfu-setup nil - "Whether already setup corfu.") - -(defun meow--corfu-maybe-abort-advice () - "Adviced for `meow-insert-exit'." - (when (bound-and-true-p corfu-mode) (corfu-quit))) - -(defun meow--setup-corfu (enable) - "Setup for corfu. -Argument ENABLE non-nil means turn on." - (setq meow--corfu-setup enable) - (if enable - (add-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice) - (remove-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; repeat-map +;; diff-hl (defvar meow--diff-hl-setup nil "Whether already setup diff-hl.") @@ -215,63 +171,6 @@ Argument ENABLE non-nil means turn on." (add-hook 'rectangle-mark-mode-hook 'meow--rectangle-mark-init) (remove-hook 'rectangle-mark-mode-hook 'meow--rectangle-mark-init))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; edebug - -(defvar meow--edebug-setup nil) - -(defun meow--edebug-hook-function () - "Switch meow state when entering/leaving edebug." - (if (bound-and-true-p edebug-mode) - (meow--switch-to-motion) - (meow--switch-to-normal))) - -(defun meow--setup-edebug (enable) - "Setup edebug. -Argument ENABLE non-nil means turn on." - (setq meow--edebug-setup enable) - (if enable - (add-hook 'edebug-mode-hook 'meow--edebug-hook-function) - (remove-hook 'edebug-mode-hook 'meow--edebug-hook-function))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; magit - -(defvar meow--magit-setup nil) - -(defun meow--magit-blame-hook-function () - "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))) - -(defun meow--setup-magit (enable) - "Setup magit. -Argument ENABLE non-nil means turn on." - (setq meow--magit-setup enable) - (if enable - (add-hook 'magit-blame-mode-hook 'meow--magit-blame-hook-function) - (remove-hook 'magit-blame-mode-hook 'meow--magit-blame-hook-function))) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; cider (debug) - -(defvar meow--cider-setup nil) - -(defun meow--cider-debug-hook-function () - "Switch meow state when entering/leaving cider debug." - (if (bound-and-true-p cider--debug-mode) - (meow--switch-to-motion) - (meow--switch-to-normal))) - -(defun meow--setup-cider (enable) - "Setup cider. -Argument ENABLE non-nil means turn on." - (setq meow--cider-setup enable) - (if enable - (add-hook 'cider--debug-mode-hook 'meow--cider-debug-hook-function) - (remove-hook 'cider--debug-mode-hook 'meow--cider-debug-hook-function))) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sly (db) @@ -482,18 +381,13 @@ Argument ENABLE non-nil means turn on." (eval-after-load "macrostep" (lambda () (meow--setup-macrostep t))) (eval-after-load "wdired" (lambda () (meow--setup-wdired t))) - (eval-after-load "edebug" (lambda () (meow--setup-edebug t))) - (eval-after-load "magit" (lambda () (meow--setup-magit t))) (eval-after-load "wgrep" (lambda () (meow--setup-wgrep t))) - (eval-after-load "company" (lambda () (meow--setup-company t))) - (eval-after-load "corfu" (lambda () (meow--setup-corfu t))) (eval-after-load "polymode" (lambda () (meow--setup-polymode t))) - (eval-after-load "cider" (lambda () (meow--setup-cider t))) (eval-after-load "sly" (lambda () (meow--setup-sly t))) (eval-after-load "realgud" (lambda () (meow--setup-realgud t))) (eval-after-load "which-key" (lambda () (meow--setup-which-key t))) (eval-after-load "undo-tree" (lambda () (meow--setup-undo-tree t))) - (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) + ;; (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) (eval-after-load "quail" (lambda () (meow--setup-input-method t))) (eval-after-load "skk" (lambda () (meow--setup-ddskk t)))) @@ -504,15 +398,10 @@ Argument ENABLE non-nil means turn on." (when meow--eldoc-setup (meow--setup-eldoc nil)) (when meow--rectangle-mark-setup (meow--setup-rectangle-mark nil)) (when meow--wdired-setup (meow--setup-wdired nil)) - (when meow--edebug-setup (meow--setup-edebug nil)) - (when meow--magit-setup (meow--setup-magit nil)) - (when meow--company-setup (meow--setup-company nil)) - (when meow--corfu-setup (meow--setup-corfu nil)) (when meow--wgrep-setup (meow--setup-wgrep nil)) (when meow--polymode-setup (meow--setup-polymode nil)) - (when meow--cider-setup (meow--setup-cider nil)) (when meow--which-key-setup (meow--setup-which-key nil)) - (when meow--diff-hl-setup (meow--setup-diff-hl nil)) + ;; (when meow--diff-hl-setup (meow--setup-diff-hl nil)) (when meow--input-method-setup (meow--setup-input-method nil)) (when meow--ddskk-setup (meow--setup-ddskk nil))) From c0985b3531ca14067d96ed3018bec80fe7eeb7db Mon Sep 17 00:00:00 2001 From: Daniel Arnqvist Date: Sun, 17 Nov 2024 03:01:16 +0100 Subject: [PATCH 07/10] Add eat-eshell shim (#668) * Add eat-eshell shim * Update eat-eshell shim to use eat-eshell-char-mode for insert. * Rewrite eat-eshell shim for fewer global modifications * Remove advice for handling eat-yank in eat-eshell-emacs-mode * Remove eat-eshell-emacs-mode yank function --- meow-shims.el | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/meow-shims.el b/meow-shims.el index 5b5c81c..95df85b 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -469,6 +469,40 @@ Argument ENABLE non-nil means turn on." ;; These vars allow us the select through the polymode chunk (add-to-list 'polymode-move-these-vars-from-old-buffer v)))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; eat-eshell + +(defvar meow--eat-eshell-setup nil) +(defvar meow--eat-eshell-mode-override nil) + +(declare-function eat-eshell-emacs-mode "eat") +(declare-function eat-eshell-semi-char-mode "eat") +(declare-function eat-eshell-char-mode "eat") + +(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 + (eat-eshell-char-mode) + (eat-eshell-emacs-mode))) + +(defun meow--eat-eshell-mode-override-disable () + (setq-local meow--eat-eshell-mode-override nil) + (remove-hook 'meow-insert-enter-hook #'eat-eshell-char-mode t) + (remove-hook 'meow-insert-exit-hook #'eat-eshell-emacs-mode t)) + +(defun meow--setup-eat-eshell (enable) + (setq meow--eat-eshell-setup enable) + (if enable + (progn (add-hook 'eat-eshell-exec-hook #'meow--eat-eshell-mode-override-enable) + (add-hook 'eat-eshell-exit-hook #'meow--eat-eshell-mode-override-disable) + (add-hook 'eat-eshell-exit-hook #'meow--update-cursor)) + + (remove-hook 'eat-eshell-exec-hook #'meow--eat-eshell-mode-override-enable) + (remove-hook 'eat-eshell-exit-hook #'meow--eat-eshell-mode-override-disable) + (remove-hook 'eat-eshell-exit-hook #'meow--update-cursor))) + ;; Enable / Disable shims (defun meow--enable-shims () @@ -495,7 +529,8 @@ Argument ENABLE non-nil means turn on." (eval-after-load "undo-tree" (lambda () (meow--setup-undo-tree t))) (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) (eval-after-load "quail" (lambda () (meow--setup-input-method t))) - (eval-after-load "skk" (lambda () (meow--setup-ddskk t)))) + (eval-after-load "skk" (lambda () (meow--setup-ddskk t))) + (eval-after-load "eat" (lambda () (meow--setup-eat-eshell t)))) (defun meow--disable-shims () "Remove shim setups." @@ -514,7 +549,8 @@ Argument ENABLE non-nil means turn on." (when meow--which-key-setup (meow--setup-which-key nil)) (when meow--diff-hl-setup (meow--setup-diff-hl nil)) (when meow--input-method-setup (meow--setup-input-method nil)) - (when meow--ddskk-setup (meow--setup-ddskk nil))) + (when meow--ddskk-setup (meow--setup-ddskk nil)) + (when meow--eat-eshell-setup (meow--setup-eat-eshell nil))) ;;; meow-shims.el ends here (provide 'meow-shims) From 4a9297d698e4bdc4376052a42401eb8df7ede621 Mon Sep 17 00:00:00 2001 From: Noel Errenil Date: Fri, 22 Nov 2024 00:19:32 +1100 Subject: [PATCH 08/10] Simplify the default `meow-mode-state-list` (#670) --- CUSTOMIZATIONS.org | 15 +++++++-------- meow-var.el | 32 ++++---------------------------- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/CUSTOMIZATIONS.org b/CUSTOMIZATIONS.org index f0c089e..9a39787 100644 --- a/CUSTOMIZATIONS.org +++ b/CUSTOMIZATIONS.org @@ -112,22 +112,21 @@ see the documentation for the internal function =meow-register-state=. Default: #+begin_src emacs-lisp - ((fundamental-mode . normal) - (text-mode . normal) + ((conf-mode . normal) + (fundamental-mode . normal) + (help-mode . motion) (prog-mode . normal) - (conf-mode . normal) - (json-mode . normal) - ...) + (text-mode . normal)) #+end_src -A list of rules to specify the initial Meow state for major mode. +A list of rules: each of which specifies the initial Meow state for a major mode. Value should be a list, each item is ~(major-mode . init-state)~. The ~init-state~ can be any state, including custom ones. -By default, Meow will use ~motion~ for special modes (in which none of +By default, Meow uses ~motion~ for special modes (in which none of the alphabet keys trigger a `self-insert` command), and ~normal~ for -other modes. +other modes. The default value aims to be general, minimal and sensible. ** meow-expand-exclude-mode-list diff --git a/meow-var.el b/meow-var.el index 0d8420f..2debe76 100644 --- a/meow-var.el +++ b/meow-var.el @@ -239,35 +239,11 @@ This option will affect the color of position hint and fake region cursor." :type 'boolean) (defcustom meow-mode-state-list - '((authinfo-mode . normal) - (beancount-mode . normal) - (bibtex-mode . normal) - (cider-repl-mode . normal) - (cider-test-report-mode . normal) - (cider-browse-spec-view-mode . motion) - (cargo-process-mode . motion) - (conf-mode . normal) - (deadgrep-edit-mode . normal) - (deft-mode . normal) - (diff-mode . normal) - (ediff-mode . motion) - (gud-mode . normal) - (haskell-interactive-mode . normal) - (help-mode . normal) - (helpful-mode . normal) - (json-mode . normal) - (jupyter-repl-mode . normal) - (mix-mode . normal) - (occur-edit-mode . normal) - (pass-view-mode . normal) + '((conf-mode . normal) + (fundamental-mode . normal) + (help-mode . motion) (prog-mode . normal) - (py-shell-mode . normal) - (restclient-mode . normal) - (telega-chat-mode . normal) - (term-mode . normal) - (text-mode . normal) - (vterm-mode . normal) - (Custom-mode . normal)) + (text-mode . normal)) "A list of rules, each is (major-mode . init-state). The init-state can be any state, including custom ones." From 813892013b971e6a938d2b443a2b50c68dc67d99 Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Sat, 23 Nov 2024 05:59:06 +0800 Subject: [PATCH 09/10] Revert "Merge branch 'elpa/meow' of https://git.sv.gnu.org/git/emacs/nongnu" This reverts commit 372130230dd64eab3d98f4468c6a17f345246846, reversing changes made to 4a9297d698e4bdc4376052a42401eb8df7ede621. --- meow-core.el | 2 + meow-shims.el | 117 ++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 116 insertions(+), 3 deletions(-) diff --git a/meow-core.el b/meow-core.el index 6a77c1b..942c289 100644 --- a/meow-core.el +++ b/meow-core.el @@ -185,6 +185,8 @@ there's no chance for meow to call an init function." ;; raise Meow keymap priority (add-to-ordered-list 'emulation-mode-map-alists `((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 diff --git a/meow-shims.el b/meow-shims.el index 0b95b93..95df85b 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -82,7 +82,51 @@ Argument ENABLE non-nill means turn on." (apply #'eldoc-remove-command meow--eldoc-commands))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; diff-hl +;; company + +(defvar meow--company-setup nil + "Whether already setup company.") + +(declare-function company--active-p "company") +(declare-function company-abort "company") + +(defvar company-candidates) + +(defun meow--company-maybe-abort-advice () + "Adviced for `meow-insert-exit'." + (when company-candidates + (company-abort))) + +(defun meow--setup-company (enable) + "Setup for company. +Argument ENABLE non-nil means turn on." + (setq meow--company-setup enable) + (if enable + (add-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice) + (remove-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; corfu + +(declare-function corfu-quit "corfu") + +(defvar meow--corfu-setup nil + "Whether already setup corfu.") + +(defun meow--corfu-maybe-abort-advice () + "Adviced for `meow-insert-exit'." + (when (bound-and-true-p corfu-mode) (corfu-quit))) + +(defun meow--setup-corfu (enable) + "Setup for corfu. +Argument ENABLE non-nil means turn on." + (setq meow--corfu-setup enable) + (if enable + (add-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice) + (remove-hook 'meow-insert-exit-hook #'meow--corfu-maybe-abort-advice))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; repeat-map (defvar meow--diff-hl-setup nil "Whether already setup diff-hl.") @@ -171,6 +215,63 @@ Argument ENABLE non-nil means turn on." (add-hook 'rectangle-mark-mode-hook 'meow--rectangle-mark-init) (remove-hook 'rectangle-mark-mode-hook 'meow--rectangle-mark-init))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; edebug + +(defvar meow--edebug-setup nil) + +(defun meow--edebug-hook-function () + "Switch meow state when entering/leaving edebug." + (if (bound-and-true-p edebug-mode) + (meow--switch-to-motion) + (meow--switch-to-normal))) + +(defun meow--setup-edebug (enable) + "Setup edebug. +Argument ENABLE non-nil means turn on." + (setq meow--edebug-setup enable) + (if enable + (add-hook 'edebug-mode-hook 'meow--edebug-hook-function) + (remove-hook 'edebug-mode-hook 'meow--edebug-hook-function))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; magit + +(defvar meow--magit-setup nil) + +(defun meow--magit-blame-hook-function () + "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))) + +(defun meow--setup-magit (enable) + "Setup magit. +Argument ENABLE non-nil means turn on." + (setq meow--magit-setup enable) + (if enable + (add-hook 'magit-blame-mode-hook 'meow--magit-blame-hook-function) + (remove-hook 'magit-blame-mode-hook 'meow--magit-blame-hook-function))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; cider (debug) + +(defvar meow--cider-setup nil) + +(defun meow--cider-debug-hook-function () + "Switch meow state when entering/leaving cider debug." + (if (bound-and-true-p cider--debug-mode) + (meow--switch-to-motion) + (meow--switch-to-normal))) + +(defun meow--setup-cider (enable) + "Setup cider. +Argument ENABLE non-nil means turn on." + (setq meow--cider-setup enable) + (if enable + (add-hook 'cider--debug-mode-hook 'meow--cider-debug-hook-function) + (remove-hook 'cider--debug-mode-hook 'meow--cider-debug-hook-function))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sly (db) @@ -415,13 +516,18 @@ Argument ENABLE non-nil means turn on." (eval-after-load "macrostep" (lambda () (meow--setup-macrostep t))) (eval-after-load "wdired" (lambda () (meow--setup-wdired t))) + (eval-after-load "edebug" (lambda () (meow--setup-edebug t))) + (eval-after-load "magit" (lambda () (meow--setup-magit t))) (eval-after-load "wgrep" (lambda () (meow--setup-wgrep t))) + (eval-after-load "company" (lambda () (meow--setup-company t))) + (eval-after-load "corfu" (lambda () (meow--setup-corfu t))) (eval-after-load "polymode" (lambda () (meow--setup-polymode t))) + (eval-after-load "cider" (lambda () (meow--setup-cider t))) (eval-after-load "sly" (lambda () (meow--setup-sly t))) (eval-after-load "realgud" (lambda () (meow--setup-realgud t))) (eval-after-load "which-key" (lambda () (meow--setup-which-key t))) (eval-after-load "undo-tree" (lambda () (meow--setup-undo-tree t))) - ;; (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) + (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) (eval-after-load "quail" (lambda () (meow--setup-input-method t))) (eval-after-load "skk" (lambda () (meow--setup-ddskk t))) (eval-after-load "eat" (lambda () (meow--setup-eat-eshell t)))) @@ -433,10 +539,15 @@ Argument ENABLE non-nil means turn on." (when meow--eldoc-setup (meow--setup-eldoc nil)) (when meow--rectangle-mark-setup (meow--setup-rectangle-mark nil)) (when meow--wdired-setup (meow--setup-wdired nil)) + (when meow--edebug-setup (meow--setup-edebug nil)) + (when meow--magit-setup (meow--setup-magit nil)) + (when meow--company-setup (meow--setup-company nil)) + (when meow--corfu-setup (meow--setup-corfu nil)) (when meow--wgrep-setup (meow--setup-wgrep nil)) (when meow--polymode-setup (meow--setup-polymode nil)) + (when meow--cider-setup (meow--setup-cider nil)) (when meow--which-key-setup (meow--setup-which-key nil)) - ;; (when meow--diff-hl-setup (meow--setup-diff-hl nil)) + (when meow--diff-hl-setup (meow--setup-diff-hl nil)) (when meow--input-method-setup (meow--setup-input-method nil)) (when meow--ddskk-setup (meow--setup-ddskk nil)) (when meow--eat-eshell-setup (meow--setup-eat-eshell nil))) From dd79ccc4261cf4c206aeb65824d48a567e6bf65f Mon Sep 17 00:00:00 2001 From: DogLooksGood Date: Mon, 25 Nov 2024 20:03:19 +0800 Subject: [PATCH 10/10] Add shim code for ediff --- meow-shims.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/meow-shims.el b/meow-shims.el index 95df85b..6405f91 100644 --- a/meow-shims.el +++ b/meow-shims.el @@ -503,6 +503,15 @@ Argument ENABLE non-nil means turn on." (remove-hook 'eat-eshell-exit-hook #'meow--eat-eshell-mode-override-disable) (remove-hook 'eat-eshell-exit-hook #'meow--update-cursor))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Ediff +(defvar meow--ediff-setup nil) + +(defun meow--setup-ediff (enable) + (if enable + (add-hook 'ediff-mode-hook 'meow-motion-mode) + (remove-hook 'ediff-mode-hook 'meow-motion-mode))) + ;; Enable / Disable shims (defun meow--enable-shims () @@ -530,7 +539,8 @@ Argument ENABLE non-nil means turn on." (eval-after-load "diff-hl" (lambda () (meow--setup-diff-hl t))) (eval-after-load "quail" (lambda () (meow--setup-input-method t))) (eval-after-load "skk" (lambda () (meow--setup-ddskk t))) - (eval-after-load "eat" (lambda () (meow--setup-eat-eshell t)))) + (eval-after-load "eat" (lambda () (meow--setup-eat-eshell t))) + (eval-after-load "ediff" (lambda () (meow--setup-ediff t)))) (defun meow--disable-shims () "Remove shim setups." @@ -550,7 +560,8 @@ Argument ENABLE non-nil means turn on." (when meow--diff-hl-setup (meow--setup-diff-hl nil)) (when meow--input-method-setup (meow--setup-input-method nil)) (when meow--ddskk-setup (meow--setup-ddskk nil)) - (when meow--eat-eshell-setup (meow--setup-eat-eshell nil))) + (when meow--eat-eshell-setup (meow--setup-eat-eshell nil)) + (when meow--ediff-setup (meow--setup-ediff nil))) ;;; meow-shims.el ends here (provide 'meow-shims)