From 764fd0e0dc069e219f7f0d8eeaff481cf9228ee6 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Sun, 6 Feb 2022 21:49:32 +0100 Subject: [PATCH] Update emacs config --- doom.org | 188 +++++++++++++++++++++++++-------------------- emacs-snippets.org | 108 +++++++++++++++++--------- 2 files changed, 178 insertions(+), 118 deletions(-) diff --git a/doom.org b/doom.org index ff3ddc9..52b8822 100644 --- a/doom.org +++ b/doom.org @@ -12,11 +12,6 @@ #+html_head: #+property: header-args:emacs-lisp :tangle ~/.config/doom/config.el :results none :padline no -* Installation -#+begin_src bash :tangle no -yay -Ss aspell aspell-fr aspell-en -#+end_src - * Introduction and Resources https://medium.com/urbint-engineering/emacs-doom-for-newbies-1f8038604e3b https://noelwelsh.com/posts/2019-01-10-doom-emacs.html @@ -241,7 +236,7 @@ Turn off auto-fill mode that add line breaks. ** Spell Check Switch from one language to an other ([[https://stackoverflow.com/questions/42159012/emacs-spell-check-on-fly-for-2-languages][link]]). #+begin_src emacs-lisp -(setq ispell-dictionary "en_US") +(setq ispell-dictionary "en") (setq ispell-program-name "aspell") #+end_src @@ -290,8 +285,6 @@ Switch from one language to an other ([[https://stackoverflow.com/questions/4215 (after! magit (setq magit-diff-refine-hunk 'all) - (setq magit-repository-directories `(("~/Cloud/thesis/matlab/" . 1) - ("~/Cloud/thesis/papers/" . 1))) (setq magit-repolist-columns '(("Name" 25 magit-repolist-column-ident nil) ("Status" 7 magit-repolist-column-flag) ("B +#name :Python-Figure +# -- +,#+begin_src jupyter-python :file ${2:filename}.png :results none +# Figure - ${1:description} +plt.figure(figsize=(${3:1200}/150, ${4:800}/150), dpi=150) +plt.clf +$0 +plt.savefig('figs/$2.pdf', transparent=True, bbox_inches='tight', pad_inches=0) +,#+end_src + +,#+name: fig:$2 +,#+caption: $1 +[[file:figs/$2.png]] +#+end_src + ** Matlab Specific *** Mconfig #+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mconfig @@ -436,49 +455,25 @@ $0 $0 #+end_src -*** Mdescription -#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mdescription -#contributor : Thomas Dehaeze -#name :Measurement-Description -# -- -,* Measurement description -,** Setup :ignore: -*Setup*: - -,** Goal :ignore: -*Goal*: - -,** Measurements :ignore: -*Measurements*: - -Three measurements are done: -| Measurement File | Description | -|-------------------------+------------------------------| -| =mat/data_${1:001}.mat= | $2 | - -Each of the measurement =mat= file contains one =data= array with 3 columns: -| Column number | Description | -|---------------+-------------------| -| 1 | $3 | -| 2 | $4 | -| 3 | Time | - -$0 -#+end_src - *** Mfigure #+begin_src conf :tangle ~/.config/doom/snippets/org-mode/mfigure #contributor : Thomas Dehaeze #name :Matlab-Figure # -- -,#+begin_src matlab :tangle no :exports results :results file replace - exportFig('figs/${1:filename}.pdf', 'width', '${2:full}', 'height', '${3:full}'); +,#+begin_src matlab :exports none :results none +%% ${1:description} +figure; +$0 ,#+end_src -,#+name: fig:$1 -,#+caption: $0 +,#+begin_src matlab :tangle no :exports results :results file replace +exportFig('figs/${2:filename}.pdf', 'width', '${3:full}', 'height', '${4:full}'); +,#+end_src + +,#+name: fig:$2 +,#+caption: $1 ,#+RESULTS: -[[file:figs/$1.png]] +[[file:figs/$2.png]] #+end_src *** Mfunction @@ -594,3 +589,44 @@ $0 $0 ,#+end_src #+end_src + +* Python +** Function +#+begin_src conf :tangle ~/.config/doom/snippets/python/de +# -*- coding: utf-8 -*- +# name: de +# contributor: Orestis Markou +# contributor: Yasser González Fernández +# contributor: Tibor Simko +# -- +def ${1:name}($2): + """ + $3 + ${2:$ + (let* ((indent + (concat "\n" (make-string (current-column) 32))) + (args + (mapconcat + '(lambda (x) + (if (not (string= (nth 0 x) "")) + (concat "@param " (nth 0 x) ": " indent + "@type " (nth 0 x) ": "))) + (mapcar + '(lambda (x) + (mapcar + '(lambda (x) + (replace-regexp-in-string "[[:blank:]]*$" "" + (replace-regexp-in-string "^[[:blank:]]*" "" x))) + x)) + (mapcar '(lambda (x) (split-string x "=")) + (split-string text ","))) + indent))) + (if (string= args "") + (concat indent "@return: " indent "@rtype: " indent (make-string 3 34)) + (mapconcat + 'identity + (list "" args "@return: " "@rtype: " (make-string 3 34)) + indent))) + } + $0 +#+end_src