diff --git a/config.org b/config.org index c4f6caa..5a62d9e 100644 --- a/config.org +++ b/config.org @@ -4,34 +4,44 @@ * Doom theme ** Use nerd-font in Emacs (for better support in vterm to liquidprompt) -#+begin_src emacs-lisp :tangle yes -(setq doom-font (font-spec :family "Fira Code Nerd Font" :size 12) - doom-big-font (font-spec :family "Fira Code Nerd Font" :size 24) - doom-variable-pitch-font (font-spec :family "Fira Code Nerd Font" :size 12) - doom-unicode-font (font-spec :family "Fira Code Nerd Font") - doom-serif-font (font-spec :family "Fira Code Nerd Font" :size 12 :weight 'light)) +#+begin_src emacs-lisp +(setq doom-font (font-spec :family "FiraCode Nerd Font Mono" :size 12) + doom-big-font (font-spec :family "FiraCode Nerd Font Mono" :size 24) + doom-variable-pitch-font (font-spec :family "FiraCode Nerd Font Mono" :size 12) + doom-unicode-font (font-spec :family "FiraCode Nerd Font Mono") + doom-serif-font (font-spec :family "FiraCode Nerd Font Mono" :size 12 :weight 'light)) #+end_src + * UI -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (setq confirm-kill-emacs nil) #+end_src ** Expand initial Frame -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (add-hook 'window-setup-hook 'toggle-frame-maximized t) #+end_src + * Edition modes ** Quarto -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (require 'quarto-mode) ;;(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . poly-quarto-mode)) #+end_src ** LaTeX -#+begin_src emacs-lisp :tangle yes + +*** Enable LaTeX-mode by default + +#+begin_src emacs-lisp +(setq TeX-default-mode #'LaTeX-mode ;; should already be the default mode + TeX-force-default-mode t) +#+end_src + +#+begin_src emacs-lisp (setq TeX-quote-after-quote t) #+end_src @@ -40,12 +50,12 @@ I want my back quotes back. #+end_quote -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (setq cdlatex-math-symbol-prefix [f12]) #+end_src Add custom LaTeX classes to ox-latex class. -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (defun custom-latex-classes () (add-to-list 'org-latex-classes '("scrartcl" "\\documentclass{scrartcl}" @@ -90,12 +100,12 @@ Add custom LaTeX classes to ox-latex class. #'custom-latex-classes) #+end_src -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (setq org-latex-compiler "lualatex") #+end_src Use minted for code listings: -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (setq org-latex-listings 'minted org-latex-packages-alist '(("" "minted")) org-latex-pdf-process @@ -103,18 +113,24 @@ Use minted for code listings: "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f")) #+end_src Disable LateX preview in Org-mode by default -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp :tangle no (setq org-startup-with-latex-preview nil) #+end_src +#+begin_src emacs-lisp +(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 :tangle yes +#+begin_src emacs-lisp (add-hook 'org-export-before-processing-hook #'org-babel-tangle) #+end_src + + *** Syntax highlighting in Org-mode -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp ; (setq org-highlight-latex-and-related '(latex script entities)) (setq org-highlight-latex-and-related '(native)) ;; (add-hook 'org-mode-hook #'turn-on-org-cdlatex) @@ -124,10 +140,11 @@ Disable LateX preview in Org-mode by default \(i \in \mathbf{N}\) *** Proper indentation in algorithmic -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (with-eval-after-load 'latex (add-to-list 'LaTeX-indent-environment-list '("algorithmic" current-indentation))) #+end_src + ** Enable conda environment in a Org-mode #+begin_src emacs-lisp :tangle no @@ -191,7 +208,7 @@ systemctl --user enable --now emacs * PlantUML -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (setq plantuml-default-exec-mode 'executable) ;; (setq plantuml-default-exec-mode 'jar) (setq plantuml-executable-path "/usr/bin/plantuml") @@ -210,7 +227,7 @@ systemctl --user enable --now emacs * Org-ref-acronyms -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (after! org (require 'org-ref) (add-to-list 'org-latex-classes @@ -236,7 +253,7 @@ systemctl --user enable --now emacs | org-ref-glossary-before-parsing | org-ref-acronyms-before-parsing | org-attach-expand-links | | org-ref-glossary-before-parsing | org-ref-acronyms-before-parsing | org-attach-expand-links | -#+begin_src emacs-lisp :tangle yes +#+begin_src emacs-lisp (after! org (org-add-link-type "latex" nil (lambda (path desc format) @@ -246,3 +263,12 @@ systemctl --user enable --now emacs ((eq format 'latex) (format "\\%s{%s}" path desc)))))) #+end_src + + +#+begin_src emacs-lisp +(global-set-key [(meta up)] 'transpose-line-up) +(global-set-key [(meta down)] 'transpose-line-down) +#+end_src + +#+RESULTS: +: transpose-line-down diff --git a/custom.el b/custom.el new file mode 100644 index 0000000..0cdcfa5 --- /dev/null +++ b/custom.el @@ -0,0 +1,26 @@ +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(warning-suppress-log-types + '(((ox-latex)) + ((ox-latex)) + ((ox-latex)) + ((ox-latex)) + ((ox-latex)) + (defvaralias) + (lexical-binding))) + '(warning-suppress-types + '(((ox-latex)) + ((ox-latex)) + ((ox-latex)) + ((ox-latex)) + (defvaralias) + (lexical-binding)))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) diff --git a/init.el b/init.el index 5b108d1..940d3cd 100644 --- a/init.el +++ b/init.el @@ -31,24 +31,24 @@ ;;deft ; notational velocity for Emacs doom ; what makes DOOM look the way it does doom-dashboard ; a nifty splash screen for Emacs - ;;doom-quit ; DOOM quit-message prompts when you quit Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs (emoji +unicode) ; 🙂 hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra indent-guides ; highlighted indent columns - ;;ligatures ; ligatures and symbols to make your code pretty again + ligatures ; ligatures and symbols to make your code pretty again ;;minimap ; show a map of the code on the side modeline ; snazzy, Atom-inspired modeline, plus API ;;nav-flash ; blink cursor line after big motions ;;neotree ; a project drawer, like NERDTree for vim ophints ; highlight the region an operation acts on (popup +defaults) ; tame sudden yet inevitable temporary windows - ;;tabs ; a tab bar for Emacs + tabs ; a tab bar for Emacs treemacs ; a project drawer, like neotree but cooler unicode ; extended unicode support for various languages (vc-gutter +pretty) ; vcs diff in the fringe vi-tilde-fringe ; fringe tildes to mark beyond EOB - ;;window-select ; visually switch windows + window-select ; visually switch windows workspaces ; tab emulation, persistence & separate workspaces ;;zen ; distraction-free coding or writing @@ -56,7 +56,7 @@ (evil +everywhere); come to the dark side, we have cookies file-templates ; auto-snippets for empty files fold ; (nigh) universal code folding - (format +onsave) ; automated prettiness + format ; automated prettiness ;;god ; run Emacs commands without modifier keys ;;lispy ; vim for lisp, for people who don't like vim ;;multiple-cursors ; editing in many places at once @@ -85,14 +85,14 @@ ;;grammar ; tasing grammar mistake every you make :tools - ;;ansible + ansible biblio ; Writes a PhD for you (citation needed) ;;collab ; buffers with friends ;;debugger ; FIXME stepping through code, to help you add bugs ;;direnv - ;;docker + docker editorconfig ; let someone else argue about tabs vs spaces - ;;ein ; tame Jupyter notebooks with emacs + ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) ;;gist ; interacting with github gists lookup ; navigate your code and its documentation @@ -107,7 +107,7 @@ ;;terraform ; infrastructure as code ;;tmux ; an API for interacting with tmux tree-sitter ; syntax and parsing, sitting in a tree... - ;;upload ; map local to remote projects via ssh/ftp + upload ; map local to remote projects via ssh/ftp :os ;;(:if IS-MAC macos) ; improve compatibility with macOS @@ -136,7 +136,7 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect + (go +lsp) ; the hipster dialect (graphql +lsp) ; Give queries a REST (haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python @@ -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 +roam2 +hugo +pandoc +brain) ; organize your plain life in plain text + (org +hugo +pandoc +brain) ; organize your plain life in plain text php ; perl's insecure younger brother plantuml ; diagrams for confusing people more ;;purescript ; javascript, but functional @@ -175,7 +175,7 @@ ;;terra ; Earth and Moon in alignment for performance. web ; the tubes yaml ; JSON, but readable - ;;zig ; C, but simpler + zig ; C, but simpler :email ;;(mu4e +org +gmail) diff --git a/packages.el b/packages.el index 91229cd..7114c73 100644 --- a/packages.el +++ b/packages.el @@ -63,6 +63,10 @@ (package! ob-pasp :recipe (:host github :repo "samuelortion/ob-pasp")) +(package! ob-hy + :recipe (:host github :repo "brantou/ob-hy")) +(package! hy-mode) + ;; (package! ox-hugo) (package! groovy-mode) @@ -75,3 +79,5 @@ ;; (:host sourcehut :repo "meow_king/typst-ts-mode")) (package! org-ref) + +(package! cobol-mode) diff --git a/snippets/latex-mode/begin b/snippets/latex-mode/begin new file mode 100644 index 0000000..7e23241 --- /dev/null +++ b/snippets/latex-mode/begin @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: begin +# key: \begin +# condition: t +# -- +\begin{$1} +$2 +\end{$1} diff --git a/snippets/latex-mode/columns b/snippets/latex-mode/columns new file mode 100644 index 0000000..7009a4f --- /dev/null +++ b/snippets/latex-mode/columns @@ -0,0 +1,13 @@ +# -*- mode: snippet -*- +# name: columns +# key: columns +# condition: t +# -- +\begin{columns} +\begin{column}{0.5\textwidth} +$1 +\end{column} +\begin{column}{0.5\textwidth} +$2 +\end{column} +\end{columns} diff --git a/snippets/latex-mode/figure b/snippets/latex-mode/figure new file mode 100644 index 0000000..d82514e --- /dev/null +++ b/snippets/latex-mode/figure @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: figure +# key: figure +# condition: t +# -- +\begin{figure}[H] +\centering +\includegraphics[width=\columnwidth]{$1} +\caption{\label{fig:$2}$3} +\end{figure} \ No newline at end of file diff --git a/snippets/latex-mode/ispellfrench b/snippets/latex-mode/ispellfrench new file mode 100644 index 0000000..aff82f1 --- /dev/null +++ b/snippets/latex-mode/ispellfrench @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: ispellfrench +# key: ispellfrench +# condition: t +# -- +% Local Variables: +% ispell-local-dictionary: "fr" +% End: diff --git a/snippets/latex-mode/proof b/snippets/latex-mode/proof new file mode 100644 index 0000000..b746112 --- /dev/null +++ b/snippets/latex-mode/proof @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: proof +# key: proof +# condition: t +# -- +\begin{proof} + +\end{proof} \ No newline at end of file diff --git a/snippets/lisp-mode/readfile b/snippets/lisp-mode/readfile new file mode 100644 index 0000000..be9e0b8 --- /dev/null +++ b/snippets/lisp-mode/readfile @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: readfile +# key: readfile +# condition: t +# -- +(with-open-file (in "$1") + (do ((line (read-line in nil) + (read-line in nil))) + ((null line)) + $2)) diff --git a/snippets/org-mode/R b/snippets/org-mode/R new file mode 100644 index 0000000..7c1090d --- /dev/null +++ b/snippets/org-mode/R @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: R +# key: R +# condition: t +# -- +#+begin_src R :session *R* +$0 +#+end_src diff --git a/snippets/org-mode/align* b/snippets/org-mode/align* new file mode 100644 index 0000000..207c8ba --- /dev/null +++ b/snippets/org-mode/align* @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: align +# key: align +# -- +\begin{align*} + $1 +\end{align*} \ No newline at end of file diff --git a/snippets/org-mode/begin b/snippets/org-mode/begin new file mode 100644 index 0000000..7e23241 --- /dev/null +++ b/snippets/org-mode/begin @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: begin +# key: \begin +# condition: t +# -- +\begin{$1} +$2 +\end{$1} diff --git a/snippets/org-mode/cm b/snippets/org-mode/cm new file mode 100644 index 0000000..f892404 --- /dev/null +++ b/snippets/org-mode/cm @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: cm +# key: cm +# condition: t +# -- +#+title: $1 +#+author: Samuel Ortion +#+date: 2024 +#+LATEX_CLASS: scrartcl +#+LATEX_HEADER: \usepackage{mus} + +* $2 diff --git a/snippets/org-mode/definition b/snippets/org-mode/definition new file mode 100644 index 0000000..c22706e --- /dev/null +++ b/snippets/org-mode/definition @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: definition +# key: definition +# -- +\begin{definition}[$1] + +\end{definition} \ No newline at end of file diff --git a/snippets/org-mode/figure b/snippets/org-mode/figure new file mode 100644 index 0000000..d82514e --- /dev/null +++ b/snippets/org-mode/figure @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: figure +# key: figure +# condition: t +# -- +\begin{figure}[H] +\centering +\includegraphics[width=\columnwidth]{$1} +\caption{\label{fig:$2}$3} +\end{figure} \ No newline at end of file diff --git a/snippets/org-mode/frame b/snippets/org-mode/frame new file mode 100644 index 0000000..d53b786 --- /dev/null +++ b/snippets/org-mode/frame @@ -0,0 +1,7 @@ +# -*- mode: snippet -*- +# name: frame +# key: frame +# -- +\begin{frame}{$1} + +\end{frame} \ No newline at end of file diff --git a/snippets/org-mode/header b/snippets/org-mode/header new file mode 100644 index 0000000..eb14d26 --- /dev/null +++ b/snippets/org-mode/header @@ -0,0 +1,12 @@ +# -*- mode: snippet -*- +# name: header +# key: header +# condition: t +# -- +#+PROPERTY: HEADER-ARGS+ :eval no-export +#+title: $1 +#+author: Samuel Ortion +#+date: $2 +#+latex_class: scrartcl +#+latex_header: \usepackage{mus} +#+bibliography: ../references.bib diff --git a/snippets/org-mode/image-ggplot b/snippets/org-mode/image-ggplot new file mode 100644 index 0000000..00c6d68 --- /dev/null +++ b/snippets/org-mode/image-ggplot @@ -0,0 +1,17 @@ +# -*- mode: snippet -*- +# name: r image-ggplot +# key: r-imgg +# -- +#+begin_src R :session *R* :results output graphics file :file notebooks/plots/${1:file}.png +library(ggplot2) +library(scales) +data <- $2 +theme_set(theme_gray(base_size = 6)) +gg <- ggplot(data, aes()) +gg <- gg + +gg <- gg + scale_x_discrete("X title") +gg <- gg + scale_y_continuous("Y title") +gg <- gg + ggtitle("") +gg <- gg + theme(plot.title = element_text(hjust = 0.5)) +gg +#+end_src diff --git a/snippets/org-mode/image-python b/snippets/org-mode/image-python new file mode 100644 index 0000000..189f1f1 --- /dev/null +++ b/snippets/org-mode/image-python @@ -0,0 +1,14 @@ +# -*- mode: snippet -*- +# name: image-python +# key: image-python +# condition: t +# -- +#+begin_src python :session *Python* :results graphics file output :file "./plots/`(format-time-string "%Y%m%d")`_$1" :exports results +fig, ax = plt.subplots() + +data = $2 + +ax.plot(data, '.b') + +fig +#+end_src diff --git a/snippets/org-mode/ispellfrench b/snippets/org-mode/ispellfrench new file mode 100644 index 0000000..f0772be --- /dev/null +++ b/snippets/org-mode/ispellfrench @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: ispellfrench +# key: ispellfrench +# condition: t +# -- +# Local Variables: +# ispell-local-dictionary: "fr" +# End: diff --git a/snippets/org-mode/proof b/snippets/org-mode/proof new file mode 100644 index 0000000..b746112 --- /dev/null +++ b/snippets/org-mode/proof @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: proof +# key: proof +# condition: t +# -- +\begin{proof} + +\end{proof} \ No newline at end of file diff --git a/snippets/org-mode/pseudocode b/snippets/org-mode/pseudocode new file mode 100644 index 0000000..e3b34d3 --- /dev/null +++ b/snippets/org-mode/pseudocode @@ -0,0 +1,13 @@ +# -*- mode: snippet -*- +# name: pseudocode +# key: pseudocode +# -- +\begin{algorithm}[H] + \caption{$1} + \begin{algorithmic}[1] + \Function{$2}{} + $3 + \State \Return $4 + \EndFunction + \end{algorithmic} +\end{algorithm} diff --git a/snippets/org-mode/pyhead-lamme b/snippets/org-mode/pyhead-lamme new file mode 100644 index 0000000..1b9cd6a --- /dev/null +++ b/snippets/org-mode/pyhead-lamme @@ -0,0 +1,20 @@ +# -*- mode: snippet -*- +# name: pyhead-lamme +# key: pyhead +# condition: t +# -- +#+begin_src emacs-lisp :exports none +(pyvenv-activate "../.venv/lamme2025") +#+end_src + +#+RESULTS: + +#+begin_src python :session *Python* :results silent +import matplotlib.pyplot as plt +import pandas as pd +import numpy as np +#+end_src + +#+begin_src python :session *Python* :results silent +plt.style.use("lamme2025") +#+end_src diff --git a/snippets/org-mode/python b/snippets/org-mode/python new file mode 100644 index 0000000..58ec545 --- /dev/null +++ b/snippets/org-mode/python @@ -0,0 +1,8 @@ +# -*- mode: snippet -*- +# name: python +# key: python +# condition: t +# -- +#+begin_src python :session *Python* +$0 +#+end_src diff --git a/snippets/org-mode/tabulate b/snippets/org-mode/tabulate new file mode 100644 index 0000000..89c1061 --- /dev/null +++ b/snippets/org-mode/tabulate @@ -0,0 +1,9 @@ +# -*- mode: snippet -*- +# name: tabulate +# key: tabulate +# condition: t +# -- +tabulate( + df, + headers=df.columns, + tablefmt="orgtbl") diff --git a/snippets/org-mode/taocp b/snippets/org-mode/taocp new file mode 100644 index 0000000..1e35c2a --- /dev/null +++ b/snippets/org-mode/taocp @@ -0,0 +1,10 @@ +# -*- mode: snippet -*- +# name: myexercise +# key: myexercise +# -- +\begin{myexercise}{$1}{$2} + $4 + \begin{myanswer} + $5 + \end{myanswer} +\end{myexercise} \ No newline at end of file diff --git a/snippets/org-mode/tikzfig b/snippets/org-mode/tikzfig new file mode 100644 index 0000000..170dbd0 --- /dev/null +++ b/snippets/org-mode/tikzfig @@ -0,0 +1,15 @@ +# -*- mode: snippet -*- +# name: tikzfig +# key: tikzfig +# -- +\documentclass[tikz]{standalone} + +\usepackage{tikz} + +\begin{document} + +\begin{tikzpicture} +$0 +\end{tikzpicture} + +\end{document} diff --git a/snippets/snakemake-mode/rule b/snippets/snakemake-mode/rule new file mode 100644 index 0000000..db7ab84 --- /dev/null +++ b/snippets/snakemake-mode/rule @@ -0,0 +1,20 @@ +# -*- mode: snippet -*- +# name: Snakemake complete rule +# key: rule +# condition: t +# -- + +rule $1: + input: + $2 + output: + $3 + params: + $4 + log: + stdout="logs/$5.stdout", + stderr="logs/$6.stderr" + shell: + """ + $7 > "{log.stdout}" 2> "{log.stderr}" + """