From b0aae95a5b5fd666251721a3ec127113a30e721f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 27 Sep 2020 22:20:38 +0100 Subject: (Emacs)+configuration for auto insertion systems --- Emacs/.config/emacs/config.org | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Emacs/.config/emacs') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index bf560ac..a7ff5bc 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -835,6 +835,27 @@ Defining some basic skeletons "" ',skeleton-name))))) #+end_src +*** Auto insertion +Inserting text into new file buffers because templates are cool. +#+begin_src emacs-lisp +(use-package auto-insert + :straight nil + :hook (find-file-hook . auto-insert) + :config + (defmacro +autotyping/create-auto-insert (REGEX DESC SKEL-NAME &rest SKELETON) + "For a given REGEX with a possible DESC, define a skeleton +with SKEL-NAME and SKELETON body and bind it to the +auto-insert-alist" + `(progn + (define-skeleton + ,SKEL-NAME + "" + ,@SKELETON) + (add-to-list + 'auto-insert-alist + '((,REGEX . ,DESC) + ,SKEL-NAME))))) +#+end_src *** Yasnippet default :PROPERTIES: :header-args:emacs-lisp: :tangle no -- cgit v1.2.3-13-gbd6f