emacs/templates

147 lines
6.2 KiB
Plaintext
Raw Normal View History

;; ~/.config/emacs/templates
prog-mode
(fixme (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "FIXME ")
(todo (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "TODO ")
(bug (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "BUG ")
(hack (if (derived-mode-p 'emacs-lisp-mode) ";; " comment-start) "HACK ")
latex-mode
(abstract "\\begin{abstract}\n" r> n> "\\end{abstract}")
(align "\\begin{align}\n" r> n> "\\end{align}")
(alignn "\\begin{align*}\n" r> n> "\\end{align*}")
(gather "\\begin{gather}\n" r> n> "\\end{gather}")
(gatherr "\\begin{gather*}\n" r> n> "\\end{gather*}")
(appendix "\\begin{appendix}\n" r> n> "\\end{appendix}")
(begin "\\begin{" (s env) "}" r> n> "\\end{" (s env) "}")
(center "\\begin{center}\n" r> n> "\\end{center}")
(displaymath "\\begin{displaymath}\n" r> n> "\\end{displaymath}")
(document "\\begin{document}\n" r> n> "\\end{document}")
(enumerate "\\begin{enumerate}\n\\item " r> n> "\\end{enumerate}")
(equation "\\begin{equation}" r> n> "\\end{equation}")
(flushleft "\\begin{flushleft}" r> n> "\\end{flushleft}")
(flushright "\\begin{flushright}" r> n> "\\end{flushright}")
(frac "\\frac{" p "}{" q "}")
(fussypar "\\begin{fussypar}" r> n> "\\end{fussypar}")
(itemize "\\begin{itemize}\n\\item " r> n> "\\end{itemize}")
(letter "\\begin{letter}\n" r> n> "\\end{letter}")
(math "\\begin{math}\n" r> n> "\\end{math}")
(minipage "\\begin{minipage}[t]{0.5\linewidth}\n" r> n> "\\end{minipage}")
(quotation "\\begin{quotation}\n" r> n> "\\end{quotation}")
(quote "\\begin{quote}\n" r> n> "\\end{quote}")
(sloppypar "\\begin{sloppypar}\n" r> n> "\\end{sloppypar}")
(theindex "\\begin{theindex}\n" r> n> "\\end{theindex}")
(trivlist "\\begin{trivlist}\n" r> n> "\\end{trivlist}")
(verbatim "\\begin{verbatim}\n" r> n> "\\end{verbatim}")
(verbatimm "\\begin{verbatim*}\n" r> n> "\\end{verbatim*}")
texinfo-mode
(defmac "@defmac " p n> r> "@end defmac")
(defun "@defun " p n> r> "@end defun")
(defvar "@defvar " p n> r> "@end defvar")
(example "@example " p n> r> "@end example")
(lisp "@lisp " p n> r> "@end lisp")
(bullet "@itemize @bullet{}" n> r> "@end itemize")
(code "@code{" p "}")
(var "@var{" p "}")
text-mode
(box "┌─" (make-string (length str) ?─) "─┐" n
"│ " (s str) " │" n
"└─" (make-string (length str) ?─) "─┘" n)
(abox "+-" (make-string (length str) ?-) "-+" n
"| " (s str) " |" n
"+-" (make-string (length str) ?-) "-+" n)
(cut "--8<---------------cut here---------------start------------->8---" n r n
"--8<---------------cut here---------------end--------------->8---" n)
(rot13 (p "plain text" text) n "----" n (rot13 text))
(calc (p "taylor(sin(x),x=0,3)" formula) n "----" n (format "%s" (calc-eval formula)))
2024-10-24 17:34:52 +01:00
(loadleveller "# @ executable = " (p "python3") n
"# @ arguments = " (p "./run.py") n
"# @ initialdir = " (p "/home/elitherl/") n
"# @ output = run.out" n
"# @ output = run.err" n
"# @ notify_user = elitherl" n
"# @ notification = complete" n
"# @ queue")
org-mode
(title "#+title: " p n "#+author: " p n "#+email: ")
(babel "#+property: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent")
(caption "#+caption: ")
(drawer ":" p ":" n r ":end:")
(begin "#+begin_" (s name) n> r> n "#+end_" name)
(quote "#+begin_quote" n> r> n "#+end_quote")
(sidenote "#+begin_sidenote" n> r> n "#+end_sidenote")
(marginnote "#+begin_marginnote" n> r> n "#+end_marginnote")
(example "#+begin_example" n> r> n "#+end_example")
(center "#+begin_center" n> r> n "#+end_center")
(ascii "#+begin_export ascii" n> r> n "#+end_export")
(html "#+begin_export html" n> r> n "#+end_export")
(latex "#+begin_export latex" n> r> n "#+end_export")
(comment "#+begin_comment" n> r> n "#+end_comment")
(verse "#+begin_verse" n> r> n "#+end_verse")
(src "#+begin_src " q n r n "#+end_src")
(gnuplot "#+begin_src gnuplot :var data=" (p "table") " :file " (p "plot.png") n r n "#+end_src" :post (org-edit-src-code))
(elisp "#+begin_src emacs-lisp" n r n "#+end_src" :post (org-edit-src-code))
nix-mode
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(pydefault "let" n
> "pkgs = import " (p "<nixpkgs>") " { };" n
2024-12-02 11:52:35 +00:00
> "pyproject-nix = import (builtins.fetchGit {" n
> "url = \"https://github.com/pyproject-nix/pyproject.nix.git\";" n
> "}) { inherit (pkgs) lib; };" n
> "python = pkgs." (p "python3") ";" n
> "project = pyproject-nix.lib.project.loadPoetryPyproject { projectRoot = ./.; };" n
"in" n
2024-12-02 11:52:35 +00:00
> "python.pkgs.buildPythonPackage (project.renderers.buildPythonPackage { inherit python; })")
2024-10-02 14:00:52 +01:00
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " { };" n
> "pyproject-nix = import (builtins.fetchGit {" n
> "url = \"https://github.com/pyproject-nix/pyproject.nix.git\";" n
> "}) { inherit (pkgs) lib; };" n
2024-12-02 11:52:35 +00:00
> "python = pkgs." (p "python3") ";" n
> "project = pyproject-nix.lib.project.loadPoetryPyproject { projectRoot = ./.; };" n
2024-12-02 11:52:35 +00:00
> "extraPackages = (ps: with ps; [" (p "flake8 isort mypy") "]);" n
> "pythonEnv = python3.withPackages (project.renderers.withPackages { inherit python extraPackages; });" n
"in" n
"pkgs.mkShellNoCC {" n
> "packages = [pythonEnv];" n
> "shellHook = ''" n
> "export PYTHONPATH=$(readlink -f " (p "./.") "):$PYTHONPATH" n
> "export MPLBACKEND=" (p "TkAgg") n
> "'';"n
"}")
(sal > "pkgs.fetchFromGitHub {" n
> "owner = \"pixelifytica\";" n
> "repo = \"simple-access-layer\";" n
> "rev = \"7a5d43959cd28d668f92b702e4cd955e27d7b220\";" n
> "hash = \"sha256-soZ1yDd3aVT7icXrifELJygPjNuzl0w26k/WOm5C1Gs=\";" n
> "}")
2024-10-02 17:12:02 +01:00
python-base-mode
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":" n
> q "return" n n
"if __name__ == \"__main__\":" n
> "main()")
(args "def parse_arguments() -> argparse.Namespace:" n
> "parser = argparse.ArgumentParser(description=\"" p "\")" n
> p n
> "return parser.parse_args()")
(logg "logger = logging.getLogger(__name__)")
(nimp "raise NotImplementedError")
;; Local Variables:
;; mode: lisp-data
;; outline-regexp: "[a-z]"
;; End: