use-package on v28 is going to kill me
The :config doesn't always run!?
This commit is contained in:
parent
530a7b6b5a
commit
4bf3d05e07
1 changed files with 10 additions and 10 deletions
|
@ -131,20 +131,20 @@ Seems the best [[https://github.com/hlissner/doom-snippets][collection of snippe
|
||||||
** Auto Insert Templates
|
** Auto Insert Templates
|
||||||
The [[https://www.emacswiki.org/emacs/AutoInsertMode][auto-insert]] feature is a wee bit complicated. All I want is to associate a filename regular expression with a YASnippet template. I'm stealing some ideas from Henrik Lissner's [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/file-templates/autoload.el][set-file-template!]] macro, but simpler?
|
The [[https://www.emacswiki.org/emacs/AutoInsertMode][auto-insert]] feature is a wee bit complicated. All I want is to associate a filename regular expression with a YASnippet template. I'm stealing some ideas from Henrik Lissner's [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/file-templates/autoload.el][set-file-template!]] macro, but simpler?
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package autoinsert
|
(use-package autoinsert
|
||||||
:init
|
:init
|
||||||
(setq auto-insert-directory (expand-file-name "templates" user-emacs-directory))
|
(setq auto-insert-directory (expand-file-name "templates" user-emacs-directory))
|
||||||
;; Don't prompt before insertion:
|
;; Don't prompt before insertion:
|
||||||
(setq auto-insert-query nil)
|
(setq auto-insert-query nil)
|
||||||
|
|
||||||
(add-hook 'find-file-hook 'auto-insert)
|
(add-hook 'find-file-hook 'auto-insert)
|
||||||
(auto-insert-mode t))
|
(auto-insert-mode t))
|
||||||
#+end_src
|
#+end_src
|
||||||
Since auto insertion requires entering data for particular fields, and for that Yasnippet is better, so in this case, we combine them:
|
Since auto insertion requires entering data for particular fields, and for that Yasnippet is better, so in this case, we combine them:
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun ha-autoinsert-yas-expand()
|
(defun ha-autoinsert-yas-expand()
|
||||||
"Replace text in yasnippet template."
|
"Replace text in yasnippet template."
|
||||||
(yas-expand-snippet (buffer-string) (point-min) (point-max)))
|
(yas-expand-snippet (buffer-string) (point-min) (point-max)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
And since I'll be associating snippets with new files all over my configuration, let's make a helper function:
|
And since I'll be associating snippets with new files all over my configuration, let's make a helper function:
|
||||||
|
|
Loading…
Reference in a new issue