Skip to content

Commit 618c71a

Browse files
committed
Add :meow-state keyword for use-package declarations
1 parent d180d47 commit 618c71a

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

CUSTOMIZATIONS.org

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,3 +358,18 @@ change the variable =meow-cursor-type-insert=.
358358

359359
Association list of symbols to their corresponding keymaps. Used
360360
to generate =meow-*-define-key= helpers.
361+
362+
* Integration to other packages
363+
** :meow-state use-package keyword
364+
365+
Simple keyword ~:meow-state~ added to [[https://github.com/jwiegley/use-package][use-package]] declarations. Used to help
366+
populate ~meow-mode-state-list~, as follows:
367+
368+
#+begin_src emacs-lisp
369+
(use-package sly
370+
:meow-state ((sly-inspector-mode . motion)
371+
(sly-db-mode . motion)))
372+
#+end_src
373+
374+
The above would make the ~sly-inspector~ and ~sly-db~ modes start in Meow's
375+
~motion~ state.

meow-shims.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,21 @@ Argument ENABLE non-nil means turn on."
266266
;; These vars allow us the select through the polymode chunk
267267
(add-to-list 'polymode-move-these-vars-from-old-buffer v))))
268268

269+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
270+
;; use-package
271+
272+
(when (fboundp #'use-package)
273+
(add-to-list 'use-package-keywords ':meow-state 'append)
274+
;; We re-use the normalize method from :hook. This way we get the parsing of
275+
;; both a single cons, and a list of several.
276+
(defalias 'use-package-normalize/:meow-state #'use-package-normalize/:hook)
277+
278+
(defun use-package-handler/:meow-state (name-symbol keyword args rest state)
279+
(use-package-concat
280+
(use-package-process-keywords name-symbol rest state)
281+
`(,@(cl-loop for arg in args
282+
collect `(add-to-list 'meow-mode-state-list ',arg))))))
283+
269284
;; Enable / Disable shims
270285

271286
(defun meow--enable-shims ()

0 commit comments

Comments
 (0)