From 80fa5b8e78e0f60f8a580c8391e2707b0086c9ea Mon Sep 17 00:00:00 2001 From: Samuel Ortion Date: Sat, 28 Jun 2025 19:31:23 +0200 Subject: [PATCH] Add new snippets --- config.org | 3 ++- init.el | 4 ++-- snippets/c++-mode/exception | 17 +++++++++++++++++ snippets/latex-mode/table | 17 +++++++++++++++++ 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 snippets/c++-mode/exception create mode 100644 snippets/latex-mode/table diff --git a/config.org b/config.org index 5a62d9e..b220dbf 100644 --- a/config.org +++ b/config.org @@ -112,7 +112,7 @@ Use minted for code listings: '("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f")) #+end_src -Disable LateX preview in Org-mode by default +Disable LaTeX preview in Org-mode by default #+begin_src emacs-lisp :tangle no (setq org-startup-with-latex-preview nil) #+end_src @@ -121,6 +121,7 @@ Disable LateX preview in Org-mode by default (setq org-highlight-latex-and-related '(native)) #+end_src + *** Add a hook so that the org file is tangled before the build #+begin_src emacs-lisp (add-hook 'org-export-before-processing-hook #'org-babel-tangle) diff --git a/init.el b/init.el index 940d3cd..a2b3384 100644 --- a/init.el +++ b/init.el @@ -82,7 +82,7 @@ :checkers syntax ; tasing you for every semicolon you forget (spell +flyspell) ; tasing you for misspelling mispelling - ;;grammar ; tasing grammar mistake every you make + grammar ; tasing grammar mistake every you make :tools ansible @@ -154,7 +154,7 @@ ;;nim ; python + lisp at the speed of c ;;nix ; I hereby declare "nix geht mehr!" (ocaml +lsp) ; an objective camel - (org +hugo +pandoc +brain) ; organize your plain life in plain text + (org +hugo +pandoc +brain +roam) ; organize your plain life in plain text php ; perl's insecure younger brother plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional diff --git a/snippets/c++-mode/exception b/snippets/c++-mode/exception new file mode 100644 index 0000000..e9de305 --- /dev/null +++ b/snippets/c++-mode/exception @@ -0,0 +1,17 @@ +# -*- mode: snippet -*- +# name: exception +# key: exception +# condition: t +# -- +class $0Exception : public std::exception { +private: + std::string m_message; +public: + + $0Exception(const char* message) : + m_message(message) {} + + const char* what() const noexcept { + return m_message.c_str(); + } +}; diff --git a/snippets/latex-mode/table b/snippets/latex-mode/table new file mode 100644 index 0000000..beddfcd --- /dev/null +++ b/snippets/latex-mode/table @@ -0,0 +1,17 @@ +# -*- mode: snippet -*- +# name: table +# key: table +# condition: t +# -- +\begin{table}[H] +\centering +\caption{$2} + \begin{tabular}{lr} + \toprule + \midrule + + \bottomrule + \end{tabular} + +\label{tab:$3} +\end{table}