mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
Allow set-yas-minor-mode! to accept multiple modes
This commit is contained in:
@ -1,13 +1,16 @@
|
|||||||
;;; feature/snippets/autoload/settings.el -*- lexical-binding: t; -*-
|
;;; feature/snippets/autoload/settings.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;;;###autodef
|
;;;###autodef
|
||||||
(defun set-yas-minor-mode! (mode)
|
(defun set-yas-minor-mode! (modes)
|
||||||
"Register a minor MODE with yasnippet so it can have its own snippets
|
"Register minor MODES (one mode symbol or a list of them) with yasnippet so it
|
||||||
category, if the folder exists."
|
can have its own snippets category, if the folder exists."
|
||||||
(after! yasnippet
|
(let ((fn (intern (format "+snippets|register-%s" mode))))
|
||||||
(let ((fn (intern (format "+snippets|register-%s" mode))))
|
(fset fn (lambda ()
|
||||||
(fset fn (lambda () (+snippets|enable-project-modes mode)))
|
(make-local-variable 'yas--extra-modes)
|
||||||
(add-hook (intern (format "%s-hook" mode)) fn))))
|
(dolist (mode (doom-enlist modes))
|
||||||
|
(add-to-list 'yas--extra-modes mode nil #'eq))
|
||||||
|
(yas--load-pending-jits)))
|
||||||
|
(add-hook (intern (format "%s-hook" mode)) fn)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(def-setting! :yas-minor-mode (mode)
|
(def-setting! :yas-minor-mode (mode)
|
||||||
|
Reference in New Issue
Block a user