(Emacs)~+snippets -> +autotyping

This commit is contained in:
2020-09-27 22:20:29 +01:00
parent 0fe6c046b2
commit 51fcea69fc

View File

@@ -786,31 +786,31 @@ with abstracting a few things away.
(prog-mode-hook . abbrev-mode) (prog-mode-hook . abbrev-mode)
(text-mode-hook . abbrev-mode) (text-mode-hook . abbrev-mode)
:init :init
(defmacro +snippets/deff-abbrev (ABBREV-TABLE ABBREV EXPANSION) (defmacro +autotyping/deff-abbrev (ABBREV-TABLE ABBREV EXPANSION)
"Wraps around define-abbrev to fill in some repeated stuff "Wraps around define-abbrev to fill in some repeated stuff
when expansion is a function." when expansion is a function."
`(define-abbrev `(define-abbrev
,ABBREV-TABLE ,ABBREV-TABLE
,ABBREV ,ABBREV
"" ""
(proc (insert ,EXPANSION)))) (proc (insert ,EXPANSION))))
:config :config
(+snippets/deff-abbrev (+autotyping/deff-abbrev
global-abbrev-table global-abbrev-table
"sdate" "sdate"
(format-time-string "%Y-%m-%d" (current-time))) (format-time-string "%Y-%m-%d" (current-time)))
(+snippets/deff-abbrev (+autotyping/deff-abbrev
global-abbrev-table global-abbrev-table
"stime" "stime"
(format-time-string "%H:%M:%S" (current-time))) (format-time-string "%H:%M:%S" (current-time)))
(+snippets/deff-abbrev (+autotyping/deff-abbrev
text-mode-abbrev-table text-mode-abbrev-table
"sday" "sday"
(format-time-string "%A" (current-time))) (format-time-string "%A" (current-time)))
(+snippets/deff-abbrev (+autotyping/deff-abbrev
text-mode-abbrev-table text-mode-abbrev-table
"smonth" "smonth"
(format-time-string "%B" (current-time)))) (format-time-string "%B" (current-time))))
@@ -822,7 +822,7 @@ Defining some basic skeletons
:straight nil :straight nil
:after abbrev :after abbrev
:config :config
(defmacro +snippets/gen-skeleton-abbrev (mode abbrev &rest skeleton) (defmacro +autotyping/gen-skeleton-abbrev (mode abbrev &rest skeleton)
(let* ((table (intern (concat (symbol-name mode) "-abbrev-table"))) (let* ((table (intern (concat (symbol-name mode) "-abbrev-table")))
(skeleton-name (intern (concat "+" "skeleton/" (symbol-name mode) "/" abbrev)))) (skeleton-name (intern (concat "+" "skeleton/" (symbol-name mode) "/" abbrev))))
`(progn `(progn