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

Add :meow-state keyword for use-package declarations #350

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions CUSTOMIZATIONS.org
Original file line number Diff line number Diff line change
Expand Up @@ -358,3 +358,18 @@ change the variable =meow-cursor-type-insert=.

Association list of symbols to their corresponding keymaps. Used
to generate =meow-*-define-key= helpers.

* Integration to other packages
** :meow-state use-package keyword

Simple keyword ~:meow-state~ added to [[https://github.com/jwiegley/use-package][use-package]] declarations. Used to help
populate ~meow-mode-state-list~, as follows:

#+begin_src emacs-lisp
(use-package sly
:meow-state ((sly-inspector-mode . motion)
(sly-db-mode . motion)))
#+end_src

The above would make the ~sly-inspector~ and ~sly-db~ modes start in Meow's
~motion~ state.
15 changes: 15 additions & 0 deletions meow-shims.el
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,21 @@ 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))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; use-package

(when (fboundp #'use-package)
(add-to-list 'use-package-keywords ':meow-state 'append)
;; We re-use the normalize method from :hook. This way we get the parsing of
;; both a single cons, and a list of several.
(defalias 'use-package-normalize/:meow-state #'use-package-normalize/:hook)

(defun use-package-handler/:meow-state (name-symbol keyword args rest state)
(use-package-concat
(use-package-process-keywords name-symbol rest state)
`(,@(cl-loop for arg in args
collect `(add-to-list 'meow-mode-state-list ',arg))))))

;; Enable / Disable shims

(defun meow--enable-shims ()
Expand Down