diff options
Diffstat (limited to 'Emacs')
-rw-r--r-- | Emacs/.config/emacs/config.org | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 9f1f4af..8ade726 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -849,6 +849,46 @@ are for simple expressions wherein there is only one user input (say, getting today's time which only requires you asking for it). They provide a lot of inbuilt functionality and are quite useful. Skeletons, on the other hand, are for higher level insertions +*** Abbrevs +Just define a few abbrevs for various date-time operations. Also +define a macro that will assume a function for the expansion, helping +with abstracting a few things away. +#+begin_src emacs-lisp +(use-package abbrev + :straight nil + :hook + (prog-mode-hook . abbrev-mode) + (text-mode-hook . abbrev-mode) + :init + (defmacro +snippets/deff-abbrev (ABBREV-TABLE ABBREV EXPANSION) + "Wraps around define-abbrev to fill in some repeated stuff + when expansion is a function." + `(define-abbrev + ,ABBREV-TABLE + ,ABBREV + "" + (proc (insert ,EXPANSION)))) + :config + (+snippets/deff-abbrev + global-abbrev-table + "fdate" + (format-time-string "%Y-%m-%d" (current-time))) + + (+snippets/deff-abbrev + global-abbrev-table + "ftime" + (format-time-string "%H:%M:%S" (current-time))) + + (+snippets/deff-abbrev + text-mode-abbrev-table + "fday" + (format-time-string "%A" (current-time))) + + (+snippets/deff-abbrev + text-mode-abbrev-table + "fmonth" + (format-time-string "%B" (current-time)))) +#+end_src *** Yasnippet default :PROPERTIES: :header-args:emacs-lisp: :tangle no |