Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lower the priority of normal keymap and remove some shims #664

Merged
merged 1 commit into from
Nov 10, 2024
Merged
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
2 changes: 0 additions & 2 deletions meow-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
117 changes: 3 additions & 114 deletions meow-shims.el
Original file line number Diff line number Diff line change
Expand Up @@ -82,51 +82,7 @@
(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.")
Expand Down Expand Up @@ -215,63 +171,6 @@
(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)

Expand Down Expand Up @@ -480,22 +379,17 @@
(meow--setup-eldoc t)
(meow--setup-rectangle-mark t)

(eval-after-load "macrostep" (lambda () (meow--setup-macrostep t)))

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 382 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "wdired" (lambda () (meow--setup-wdired t)))

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 383 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(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)))

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 384 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(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)))

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 385 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "cider" (lambda () (meow--setup-cider t)))
(eval-after-load "sly" (lambda () (meow--setup-sly t)))

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 386 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "realgud" (lambda () (meow--setup-realgud t)))

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (26.3, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 387 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "which-key" (lambda () (meow--setup-which-key t)))

Check warning on line 388 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 388 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 388 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 388 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "undo-tree" (lambda () (meow--setup-undo-tree t)))

Check warning on line 389 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 389 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 389 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 389 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(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)))

Check warning on line 391 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 391 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 391 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 391 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.
(eval-after-load "skk" (lambda () (meow--setup-ddskk t))))

Check warning on line 392 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 392 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 392 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (28.2, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

Check warning on line 392 in meow-shims.el

View workflow job for this annotation

GitHub Actions / check (27.1, true)

`eval-after-load' is for use in configurations, and should rarely be used in packages.

(defun meow--disable-shims ()
"Remove shim setups."
Expand All @@ -504,17 +398,12 @@
(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)))

;;; meow-shims.el ends here
(provide 'meow-shims)
Loading