Skip to content

Instantly share code, notes, and snippets.

@todokr
Created April 19, 2019 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todokr/17c44953a865960a53a55644628a4462 to your computer and use it in GitHub Desktop.
Save todokr/17c44953a865960a53a55644628a4462 to your computer and use it in GitHub Desktop.
(use-package auto-insert-mode)
(auto-insert-mode t)
;; テンプレート置き場
(setq auto-insert-directory "~/.emacs.d/insert/")
;; "~nippo.md"というファイルをテンプレートの挿入対象に設定
(define-auto-insert "_nippo\\.md$" "nippo-template.md")
;; 日報の雛形をいい感じに生成するぞ!
(defun gen-nippo-template ()
(interactive)
(let* ((file (expand-file-name
(format-time-string
"%Y-%m-%d_nippo.md" (current-time)) ;; ex) 2019-04-19_nippo.md
"~/nippo/"))
(dir (file-name-directory file)))
(make-directory dir t)
(find-file-other-window file)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment