From 46b80367c1b796a93cd39ac2eb16265d05813d6f Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 27 Sep 2020 21:57:18 +0100 Subject: (Emacs)+config for skeletons Macro to generate an abbrev as well as a skeleton --- Emacs/.config/emacs/config.org | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 8ade726..63e23b2 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -889,6 +889,26 @@ with abstracting a few things away. "fmonth" (format-time-string "%B" (current-time)))) #+end_src +*** Skeletons +Defining some basic skeletons +#+begin_src emacs-lisp +(use-package skeleton + :straight nil + :after abbrev + :config + (defmacro +snippets/gen-skeleton-abbrev (mode abbrev &rest skeleton) + (let* ((table (intern (concat (symbol-name mode) "-abbrev-table"))) + (skeleton-name (intern (concat "+" "skeleton/" (symbol-name mode) "/" abbrev)))) + `(progn + (define-skeleton + ,skeleton-name + "" + ,@skeleton) + (define-abbrev ,table + ,abbrev-name + "" + ',skeleton-name))))) +#+end_src *** Yasnippet default :PROPERTIES: :header-args:emacs-lisp: :tangle no -- cgit v1.2.3-13-gbd6f