(Emacs)-remove insert macro, +hook after-init-hook auto-insert-mode
define-autoinsert basically does what my macro does anyway, also add an auto insert for org mode.
This commit is contained in:
@@ -839,30 +839,15 @@ Defining some basic skeletons
|
|||||||
""
|
""
|
||||||
,@skeleton)
|
,@skeleton)
|
||||||
(define-abbrev ,table
|
(define-abbrev ,table
|
||||||
,abbrev-name
|
,abbrev
|
||||||
""
|
""
|
||||||
',skeleton-name)))))
|
',skeleton-name)))))
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Auto insertion
|
*** Auto insert
|
||||||
Inserting text into new file buffers because templates are cool.
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package auto-insert
|
(use-package autoinsert
|
||||||
:straight nil
|
:straight nil
|
||||||
:hook (find-file-hook . auto-insert)
|
:hook (after-init-hook . auto-insert-mode))
|
||||||
:config
|
|
||||||
(defmacro +autotyping/create-auto-insert (REGEX DESC SKEL-NAME &rest SKELETON)
|
|
||||||
"For a given REGEX with a possible DESC, define a skeleton
|
|
||||||
with SKEL-NAME and SKELETON body and bind it to the
|
|
||||||
auto-insert-alist"
|
|
||||||
`(progn
|
|
||||||
(define-skeleton
|
|
||||||
,SKEL-NAME
|
|
||||||
""
|
|
||||||
,@SKELETON)
|
|
||||||
(add-to-list
|
|
||||||
'auto-insert-alist
|
|
||||||
'((,REGEX . ,DESC)
|
|
||||||
,SKEL-NAME)))))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
*** Yasnippet default
|
*** Yasnippet default
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
@@ -1638,7 +1623,7 @@ use the current buffer?) but it works out.
|
|||||||
** Org
|
** Org
|
||||||
*** Org Core Configuration
|
*** Org Core Configuration
|
||||||
Hooks, prettify-symbols and my =+org/swiper-goto= to replace the
|
Hooks, prettify-symbols and my =+org/swiper-goto= to replace the
|
||||||
vanilla =org-goto=
|
vanilla =org-goto=. Also records for auto insertion.
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(use-package org
|
(use-package org
|
||||||
:hook
|
:hook
|
||||||
@@ -1649,6 +1634,20 @@ vanilla =org-goto=
|
|||||||
org-mode-hook
|
org-mode-hook
|
||||||
("#+begin_src" . "≫")
|
("#+begin_src" . "≫")
|
||||||
("#+end_src" . "≪")))
|
("#+end_src" . "≪")))
|
||||||
|
(with-eval-after-load "autoinsert"
|
||||||
|
(define-auto-insert '("\\.org" . "Org skeleton")
|
||||||
|
'("Enter title: "
|
||||||
|
"#+title: " str | (buffer-file-name) "\n"
|
||||||
|
"#+author: " user-full-name "\n"
|
||||||
|
"#+description: " (setq v1 (read-string "Enter description: ")) | "Description" "\n"
|
||||||
|
"#+options: toc:nil\n\n"
|
||||||
|
"#+begin_center\n"
|
||||||
|
(read-string "Enter further preamble: ")
|
||||||
|
"#+end_center\n"
|
||||||
|
"#+latex: \clearpage\n"
|
||||||
|
"#+toc: headlines\n"
|
||||||
|
"#+latex: \clearpage\n\n"
|
||||||
|
"* " _)))
|
||||||
:config
|
:config
|
||||||
(with-eval-after-load "swiper"
|
(with-eval-after-load "swiper"
|
||||||
(defun +org/swiper-goto ()
|
(defun +org/swiper-goto ()
|
||||||
|
|||||||
Reference in New Issue
Block a user