Update emacs config

This commit is contained in:
2022-02-06 21:49:32 +01:00
parent 10eeb3efc8
commit 764fd0e0dc
2 changed files with 178 additions and 118 deletions

View File

@@ -330,7 +330,7 @@ $0
#+name: tab:${1:table_name}
#+caption: ${2:Table caption}
#+attr_latex: :environment tabularx :width ${3:\linewidth} :align ${4:lXX}
#+attr_latex: :center t :booktabs t :float t
#+attr_latex: :center t :booktabs t
| $0 | | |
|---+---+---|
| | | |
@@ -418,6 +418,25 @@ $1
$0
#+end_src
** Python Specific
*** Pfigure
#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/pfigure
#contributor : Thomas Dehaeze <dehaeze.thomas@gmail.com>
#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 <dehaeze.thomas@gmail.com>
#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 <dehaeze.thomas@gmail.com>
#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 <yglez@uh.cu>
# contributor: Tibor Simko <tibor.simko@cern.ch>
# --
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