templates (5079B)
1 ;; ~/.config/emacs/templates 2 3 fundamental-mode ;; Available everywhere 4 5 (today (format-time-string "%Y-%m-%d")) 6 7 prog-mode 8 9 (fixme (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "FIXME ") 10 (todo (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "TODO ") 11 (bug (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "BUG ") 12 (hack (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "HACK ") 13 14 lisp-mode emacs-lisp-mode ;; Specify multiple modes 15 16 (lambda "(lambda (" p ")" n> r> ")") 17 18 emacs-lisp-mode 19 20 (autoload ";;;###autoload") 21 (pt "(point)") 22 (var "(defvar " p "\n \"" p "\")") 23 (local "(defvar-local " p "\n \"" p "\")") 24 (const "(defconst " p "\n \"" p "\")") 25 (custom "(defcustom " p "\n \"" p "\"" n> ":type '" p ")") 26 (face "(defface " p " '((t :inherit " p "))\n \"" p "\")") 27 (group "(defgroup " p " nil\n \"" p "\"" n> ":group '" p n> ":prefix \"" p "-\")") 28 (macro "(defmacro " p " (" p ")\n \"" p "\"" n> r> ")") 29 (alias "(defalias '" p " '" p ")") 30 (fun "(defun " p " (" p ")\n \"" p "\"" n> r> ")") 31 (iflet "(if-let (" p ")" n> r> ")") 32 (whenlet "(when-let (" p ")" n> r> ")") 33 (whilelet "(while-let (" p ")" n> r> ")") 34 (andlet "(and-let* (" p ")" n> r> ")") 35 (cond "(cond" n "(" q "))" >) 36 (pcase "(pcase " (p "scrutinee") n "(" q "))" >) 37 (let "(let (" p ")" n> r> ")") 38 (lett "(let* (" p ")" n> r> ")") 39 (pcaselet "(pcase-let (" p ")" n> r> ")") 40 (pcaselett "(pcase-let* (" p ")" n> r> ")") 41 (rec "(letrec (" p ")" n> r> ")") 42 (dotimes "(dotimes (" p ")" n> r> ")") 43 (dolist "(dolist (" p ")" n> r> ")") 44 (loop "(cl-loop for " p " in " p " do" n> r> ")") 45 (command "(defun " p " (" p ")\n \"" p "\"" n> "(interactive" p ")" n> r> ")") 46 (advice "(defun " (p "adv" name) " (&rest app)" n> p n> "(apply app))" n> 47 "(advice-add #'" (p "fun") " " (p ":around") " #'" (s name) ")") 48 (header ";;; " (file-name-nondirectory (or (buffer-file-name) (buffer-name))) 49 " -- " p " -*- lexical-binding: t -*-" n 50 ";;; Commentary:" n ";;; Code:" n n) 51 (provide "(provide '" (file-name-base (or (buffer-file-name) (buffer-name))) ")" n 52 ";;; " (file-name-nondirectory (or (buffer-file-name) (buffer-name))) 53 " ends here" n) 54 (package ";;; " (file-name-base (or (buffer-file-name) (buffer-name))) " --- " p " -*- lexical-binding: t -*-" 55 n n 56 ";; Copyright (C) " (format-time-string "%Y") " Vincent Demeester" n 57 ";; Author: Vincent Demeester <vincent@sbr.pm>" n n 58 ";; This file is NOT part of GNU Emacs." n 59 ";;; Commentary:" n p n 60 ";;; Code:" n p n 61 "(provide '" (file-name-base (or (buffer-file-name) (buffer-name))) ")" n 62 ";;; " (file-name-nondirectory (or (buffer-file-name) (buffer-name))) " ends here" n) 63 64 eshell-mode 65 66 (for "for " (p "i") " in " p " { " q " }") 67 (while "while { " p " } { " q " }") 68 (until "until { " p " } { " q " }") 69 (if "if { " p " } { " q " }") 70 (ife "if { " p " } { " p " } { " q " }") 71 (unl "unless { " p " } { " q " }") 72 (unle "unless { " p " } { " p " } { " q " }") 73 74 text-mode 75 76 (box "┌─" (make-string (length str) ?─) "─┐" n 77 "│ " (s str) " │" n 78 "└─" (make-string (length str) ?─) "─┘" n) 79 (abox "+-" (make-string (length str) ?-) "-+" n 80 "| " (s str) " |" n 81 "+-" (make-string (length str) ?-) "-+" n) 82 (cut "--8<---------------cut here---------------start------------->8---" n r n 83 "--8<---------------cut here---------------end--------------->8---" n) 84 (rot13 (p "plain text" text) n "----" n (rot13 text)) 85 (calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula))) 86 87 org-mode 88 89 (caption "#+caption: ") 90 (drawer ":" p ":" n r ":end:") 91 (begin "#+begin_" (s name) n> r> n "#+end_" name) 92 (quote "#+begin_quote" n> r> n "#+end_quote") 93 (sidenote "#+begin_sidenote" n> r> n "#+end_sidenote") 94 (marginnote "#+begin_marginnote" n> r> n "#+end_marginnote") 95 (example "#+begin_example" n> r> n "#+end_example") 96 (center "#+begin_center" n> r> n "#+end_center") 97 (ascii "#+begin_export ascii" n> r> n "#+end_export") 98 (html "#+begin_export html" n> r> n "#+end_export") 99 (latex "#+begin_export latex" n> r> n "#+end_export") 100 (comment "#+begin_comment" n> r> n "#+end_comment") 101 (verse "#+begin_verse" n> r> n "#+end_verse") 102 (src "#+begin_src " q n r n "#+end_src") 103 (gnuplot "#+begin_src gnuplot :var data=" (p "table") " :file " (p "plot.png") n r n "#+end_src" :post (org-edit-src-code)) 104 (elisp "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code)) 105 (inlsrc "src_" p "{" q "}") 106 (title "#+title: " p n "#+author: Daniel Mendler" n "#+language: en") 107 (category "#+category: " (vde/org-category-from-buffer)) 108 (call & "#+call: " (p "name" name) "(" (s var) "=\"" (s value) "\")") 109 (/ "[/]" (org-update-statistics-cookies nil)) 110 (tsm p " :: " (with-temp-buffer (org-insert-time-stamp (current-time) t t))) 111 (pdeadline "#+PROJECT_DEADLINE: " (org-read-date)) 112 (ppath "#+PROJECT_PATHS: (" p " . " q ")") 113 (backlinks "#+BEGIN: denote-backlinks :sort-by-component nil :reverse-sort nil :id-only nil" n> "#+END:") 114 115 ;; Local Variables: 116 ;; mode: lisp-data 117 ;; outline-regexp: "[a-z]" 118 ;; End: