(Emacs)+config for abbrevs
Adds a macro to make abbrevs easier to insert
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user