diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-09-27 21:56:52 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-09-27 21:56:52 +0100 |
commit | 356931d9e332e06ffcc1d23e2e47c94337292980 (patch) | |
tree | e6e3bd27333ed9bf68f0645398d65cb710b632d5 /Emacs/.config/emacs | |
parent | 113a39f5bb634f972c76472cb2b1a91fcf65d20e (diff) | |
download | dotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.tar.gz dotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.tar.bz2 dotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.zip |
(Emacs)+config for abbrevs
Adds a macro to make abbrevs easier to insert
Diffstat (limited to 'Emacs/.config/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 |