aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2020-09-27 21:56:52 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2020-09-27 21:56:52 +0100
commit356931d9e332e06ffcc1d23e2e47c94337292980 (patch)
treee6e3bd27333ed9bf68f0645398d65cb710b632d5
parent113a39f5bb634f972c76472cb2b1a91fcf65d20e (diff)
downloaddotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.tar.gz
dotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.tar.bz2
dotfiles-356931d9e332e06ffcc1d23e2e47c94337292980.zip
(Emacs)+config for abbrevs
Adds a macro to make abbrevs easier to insert
-rw-r--r--Emacs/.config/emacs/config.org40
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