Update emacs config
This commit is contained in:
parent
10eeb3efc8
commit
764fd0e0dc
188
doom.org
188
doom.org
@ -12,11 +12,6 @@
|
||||
#+html_head: <script type="text/javascript" src="./dist/script.js"></script>
|
||||
#+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<U" 3 magit-repolist-column-unpulled-from-upstream
|
||||
@ -396,17 +389,25 @@ Disable flycheck for now with orgmode buffers:
|
||||
|
||||
** Ox-Hugo
|
||||
#+begin_src emacs-lisp
|
||||
(defun tdh-export-everything-to-hugo ()
|
||||
"Export all the .org files in the specified directory to markdown using Hugo"
|
||||
(interactive)
|
||||
(setq org-files (directory-files (read-directory-name "Directory:" "/home/thomas/Cloud/brain/") t "org$" t))
|
||||
;; (defun tdh-export-everything-to-hugo ()
|
||||
;; "Export all the .org files in the specified directory to markdown using Hugo"
|
||||
;; (interactive)
|
||||
;; (setq org-files (directory-files (read-directory-name "Directory:" "/home/thomas/Cloud/brain/") t "org$" t))
|
||||
|
||||
(while org-files
|
||||
(setq current-org-file (car org-files))
|
||||
(message "Exporting %s" current-org-file)
|
||||
(find-file current-org-file)
|
||||
(org-hugo-export-to-md)
|
||||
(setq org-files (cdr org-files))))
|
||||
;; (while org-files
|
||||
;; (setq current-org-file (car org-files))
|
||||
;; (message "Exporting %s" current-org-file)
|
||||
;; (find-file current-org-file)
|
||||
;; (org-hugo-export-to-md)
|
||||
;; (setq org-files (cdr org-files))))
|
||||
#+end_src
|
||||
|
||||
** Tramp
|
||||
#+begin_src emacs-lisp
|
||||
(add-to-list 'tramp-remote-process-environment "GIT_AUTHOR_EMAIL=thomas.dehaeze@esrf.fr")
|
||||
(add-to-list 'tramp-remote-process-environment "GIT_AUTHOR_NAME='Thomas Dehaeze'")
|
||||
(add-to-list 'tramp-remote-process-environment "GIT_COMMITTER_EMAIL=thomas.dehaeze@esrf.fr")
|
||||
(add-to-list 'tramp-remote-process-environment "GIT_COMMITTER_EMAIL='Thomas Dehaeze'")
|
||||
#+end_src
|
||||
|
||||
** Others
|
||||
@ -721,10 +722,12 @@ This idea comes from [[https://blog.lambda.cx/posts/org-agenda-new-tab/][here]].
|
||||
:config (setq org-fancy-priorities-list '("■" "■" "■")))
|
||||
#+end_src
|
||||
|
||||
** Org Notification based on calendar event
|
||||
** TODO [#B] Org Notification based on calendar event
|
||||
https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarms-audio-visual-triggered-by-org-mode-events
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
- [ ] Issue with this part on ubuntu
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(after! org-agenda
|
||||
(setq appt-message-warning-time 5)
|
||||
(defun tdh-org-agenda-to-appt ()
|
||||
@ -737,7 +740,7 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm
|
||||
(setq appt-disp-window-function 'tdh-appt-display)
|
||||
(setq appt-delete-window-function (lambda () t))
|
||||
|
||||
(setq tdh-appt-notification-app (concat (getenv "HOME") "/bin/appt-notification"))
|
||||
(setq tdh-appt-notification-app (concat (getenv "HOME") "/.local/bin/appt-notification"))
|
||||
(defun tdh-appt-display (min-to-app new-time msg)
|
||||
(if (atom min-to-app)
|
||||
(start-process "tdh-appt-notification-app" nil tdh-appt-notification-app min-to-app msg)
|
||||
@ -747,11 +750,11 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm
|
||||
#+end_src
|
||||
|
||||
*** appt-notification script
|
||||
#+begin_src bash :tangle ~/.config/doom/bin/appt-notification :shebang "#!/usr/bin/env bash" :comments none :mkdirp yes
|
||||
#+begin_src bash :tangle ~/.local/bin/appt-notification :shebang "#!/usr/bin/env bash" :comments none :mkdirp yes
|
||||
TIME="$1"TODO
|
||||
MSG="$2"
|
||||
|
||||
dunstify --replace=85401 "Event in $TIME minutes" "$MSG"
|
||||
notify-send "Event in $TIME minutes" "$MSG"
|
||||
#+end_src
|
||||
|
||||
** Org Structure Template
|
||||
@ -924,6 +927,17 @@ Do not export headline with the =:ignore:= tag:
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Open Files
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
(setq org-file-apps
|
||||
'((auto-mode . emacs)
|
||||
("\\.x?html?\\'" . "firefox %s")
|
||||
("\\.pdf\\'" . "zathura \"%s\"")
|
||||
("\\.pdf::\\([0-9]+\\)\\'" . "zathura \"%s\" -p %1")))
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** HTML Export
|
||||
*** HTML Defaults
|
||||
#+begin_src emacs-lisp
|
||||
@ -1854,14 +1868,6 @@ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_c
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Citeproc-Org
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! citeproc-org
|
||||
:after ox-hugo
|
||||
:config
|
||||
(citeproc-org-setup))
|
||||
#+end_src
|
||||
|
||||
** Org Wild Notifier
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! org-wild-notifier
|
||||
@ -1925,8 +1931,6 @@ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_c
|
||||
:ni "C-c F" 'tdh-insert-link-to-previous-figure)
|
||||
(:desc "Insert Screenshot"
|
||||
:ni "C-c s" 'tdh-insert-screenshot-org-link)
|
||||
(:desc "Find Roam"
|
||||
:ni "C-c r" 'orb-find-non-ref-file)
|
||||
(:desc "Insert Roam"
|
||||
:ni "C-c R" 'orb-insert-non-ref)
|
||||
))
|
||||
@ -2109,6 +2113,17 @@ Map Keys
|
||||
:n "F" 'tdh-automatic-latex-fragment-deactivate)))
|
||||
#+end_src
|
||||
|
||||
*** Org-Appear
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! org-appear
|
||||
:after org
|
||||
:hook (org-mode . org-appear-mode)
|
||||
:config (setq
|
||||
org-appear-autolinks t
|
||||
org-appear-autoentities t
|
||||
org-appear-autosubmarkers t ))
|
||||
#+end_src
|
||||
|
||||
*** Bibtex =,r=
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
@ -2164,7 +2179,7 @@ Open HTML output externally
|
||||
Don't ask for confirmation when evaluating following blocs
|
||||
#+begin_src emacs-lisp
|
||||
(defun tdh-org-confirm-babel-evaluate (lang body)
|
||||
(not (member lang '("emacs-lisp" "latex" "matlab" "sh" "latex-macros" "python"))))
|
||||
(not (member lang '("emacs-lisp" "latex" "matlab" "sh" "latex-macros" "python" "ipython" "jupyter-python" "dot"))))
|
||||
|
||||
(after! org
|
||||
(setq org-confirm-babel-evaluate 'tdh-org-confirm-babel-evaluate))
|
||||
@ -2212,7 +2227,6 @@ Add all named source blocks to =org-babel-library-of-babel= ([[file:emacs-librar
|
||||
(org-babel-lob-ingest "~/.config/literate-dotfiles/emacs-library-babel.org"))
|
||||
#+end_src
|
||||
|
||||
|
||||
** Org-Babel Matlab
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
@ -2333,7 +2347,7 @@ yay -S mermaid-cli
|
||||
(use-package! ob-mermaid
|
||||
:after org
|
||||
:config
|
||||
(setq ob-mermaid-cli-path "/usr/bin/mmdc")
|
||||
(setq ob-mermaid-cli-path "/home/thomas/.npm-global/bin/mmdc")
|
||||
)
|
||||
#+end_src
|
||||
|
||||
@ -2541,8 +2555,10 @@ This function:
|
||||
(if (string= lang "matlab")
|
||||
(if (region-active-p)
|
||||
(tdh-matlab-execute-selected (region-beginning) (region-end))
|
||||
(progn (tdh-org-babel-execute-matlab-background)
|
||||
(org-babel-next-src-block)))
|
||||
(progn (tdh-org-babel-execute-matlab-background)))
|
||||
(org-babel-next-src-block))
|
||||
(if (string= lang "jupyter-python")
|
||||
(org-babel-execute-maybe)
|
||||
(org-babel-next-src-block))
|
||||
)
|
||||
(org-babel-next-src-block)
|
||||
@ -2602,12 +2618,21 @@ Org-Tangle and Org-Babel Jump to Tangle File
|
||||
(error "Cannot open tangle file %S" file)))))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun tdh-org-babel-tangle-block ()
|
||||
(interactive)
|
||||
(let ((current-prefix-arg '(4)))
|
||||
(call-interactively 'org-babel-tangle)
|
||||
))
|
||||
#+end_src
|
||||
|
||||
Map Functions
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
(map! :map org-mode-map
|
||||
(:prefix (",b" . "Tangle")
|
||||
:n "F" 'tdh-org-babel-jump-to-tangle-file
|
||||
:n "b" 'tdh-org-babel-tangle-block
|
||||
:n "T" 'tdh-org-babel-tangle-subtree)))
|
||||
#+end_src
|
||||
|
||||
@ -2633,15 +2658,13 @@ Nice Functions:
|
||||
:init
|
||||
:config
|
||||
;; Folder where the notes files are located (or file if just one Note file)
|
||||
(setq org-ref-notes-directory "~/Cloud/brain")
|
||||
(setq org-ref-bibliography-notes "~/Cloud/brain")
|
||||
(setq bibtex-completion-notes-path "~/Cloud/brain/")
|
||||
|
||||
;; Bibliography File
|
||||
(setq reftex-default-bibliography '("~/Cloud/brain/biblio/references.bib"))
|
||||
(setq org-ref-default-bibliography '("~/Cloud/brain/biblio/references.bib"))
|
||||
(setq bibtex-completion-bibliography '("~/Cloud/brain/biblio/references.bib"))
|
||||
|
||||
;; Folder where all the pdf are located
|
||||
(setq org-ref-pdf-directory "~/Cloud/pdfs")
|
||||
(setq bibtex-completion-library-path '("~/Cloud/pdfs/"))
|
||||
|
||||
(setq org-ref-bibliography-entry-format
|
||||
'(("article" . "%a, %t, %j, v(%n), %p (%y).")
|
||||
@ -2663,20 +2686,20 @@ Nice Functions:
|
||||
;; Display information on the citation
|
||||
(setq org-ref-show-citation-on-enter t)
|
||||
|
||||
(add-to-list 'org-ref-helm-user-candidates
|
||||
'("Open pdf in Zathura" . (lambda () (call-process "zathura" nil 0 nil (concat
|
||||
(file-name-as-directory org-ref-pdf-directory)
|
||||
(car (org-ref-get-bibtex-key-and-file))
|
||||
".pdf"))))
|
||||
t)
|
||||
;; (add-to-list 'org-ref-helm-user-candidates
|
||||
;; '("Open pdf in Zathura" . (lambda () (call-process "zathura" nil 0 nil (concat
|
||||
;; (file-name-as-directory org-ref-pdf-directory)
|
||||
;; (car (org-ref-get-bibtex-key-and-file))
|
||||
;; ".pdf"))))
|
||||
;; t)
|
||||
|
||||
(add-to-list 'org-ref-helm-user-candidates
|
||||
'("Drag and Drop" . (lambda () (call-process "/bin/bash" nil 0 nil "-c" (concat
|
||||
"dragon-drag-and-drop "
|
||||
(file-name-as-directory org-ref-pdf-directory)
|
||||
(car (org-ref-get-bibtex-key-and-file))
|
||||
".pdf"))))
|
||||
t)
|
||||
;; (add-to-list 'org-ref-helm-user-candidates
|
||||
;; '("Drag and Drop" . (lambda () (call-process "/bin/bash" nil 0 nil "-c" (concat
|
||||
;; "dragon "
|
||||
;; (file-name-as-directory org-ref-pdf-directory)
|
||||
;; (car (org-ref-get-bibtex-key-and-file))
|
||||
;; ".pdf"))))
|
||||
;; t)
|
||||
|
||||
;; Let Mathjax deals with equation reference
|
||||
(defun org-ref-eqref-export (keyword desc format)
|
||||
@ -2687,6 +2710,11 @@ Nice Functions:
|
||||
)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! org
|
||||
(require 'org-ref))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun tdh-org-ref-open-pdf-at-point ()
|
||||
"Open the pdf in external program for bibtex key under point if it exists."
|
||||
@ -2826,12 +2854,10 @@ Re-Export all roam files.
|
||||
:init
|
||||
:config
|
||||
;; Bibliography file
|
||||
(setq bibtex-completion-bibliography '("~/Cloud/brain/biblio/references.bib"
|
||||
"~/Cloud/acoustic/resources/acoustics.bib"))
|
||||
(setq bibtex-completion-bibliography '("~/Cloud/brain/biblio/references.bib"))
|
||||
|
||||
;; Directory with all the pdfs
|
||||
(setq bibtex-completion-library-path '("~/Cloud/pdfs/"
|
||||
"~/Cloud/acoustic/resources/pdfs/"))
|
||||
(setq bibtex-completion-library-path '("~/Cloud/pdfs/"))
|
||||
|
||||
;; Directory with notes files
|
||||
(setq bibtex-completion-notes-path "~/Cloud/brain/")
|
||||
@ -2947,13 +2973,6 @@ List all element of the bibliography without pdf associated
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Deft ([[https://github.com/jrblevin/deft][link]])
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
(use-package! deft
|
||||
:custom
|
||||
(deft-directory "~/Cloud/brain/"))
|
||||
#+end_src
|
||||
|
||||
** Org-Roam-Bibtex ([[https://github.com/org-roam/org-roam-bibtex][link]])
|
||||
Provides nice functions such as:
|
||||
- =orb-find-non-ref-file=
|
||||
@ -2977,15 +2996,6 @@ Provides nice functions such as:
|
||||
(call-process "zathura" nil 0 nil (org-ref-get-pdf-filename key)))
|
||||
#+end_src
|
||||
|
||||
** Citeproc-org ([[https://github.com/andras-simonyi/citeproc-org][link]])
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! citeproc-org
|
||||
:after org
|
||||
:config
|
||||
(citeproc-org-setup)
|
||||
(setq citeproc-org-html-backends '(html)))
|
||||
#+end_src
|
||||
|
||||
** Bibtex-Mode
|
||||
#+begin_src emacs-lisp
|
||||
(after! bibtex
|
||||
@ -2993,6 +3003,18 @@ Provides nice functions such as:
|
||||
:n "C-c c" 'org-ref-clean-bibtex-entry))
|
||||
#+end_src
|
||||
|
||||
** Citar
|
||||
#+begin_src emacs-lisp
|
||||
;; (use-package! citar
|
||||
;; :custom
|
||||
;; (org-cite-global-bibliography '("~/Cloud/brain/biblio/references.bib"))
|
||||
;; (setq citar-library-paths '("~/Cloud/pdfs/"))
|
||||
;; (setq citar-open-note-function 'orb-citar-edit-note)
|
||||
;; (org-cite-insert-processor 'citar)
|
||||
;; (org-cite-follow-processor 'citar)
|
||||
;; (org-cite-activate-processor 'citar))
|
||||
#+end_src
|
||||
|
||||
* LaTeX
|
||||
- https://tex.stackexchange.com/questions/52179/what-is-your-favorite-emacs-and-or-auctex-command-trick
|
||||
- https://tex.stackexchange.com/questions/20843/useful-shortcuts-or-key-bindings-or-predefined-commands-for-emacsauctex
|
||||
@ -3115,6 +3137,9 @@ Provides nice functions such as:
|
||||
#+end_src
|
||||
|
||||
* Mu4e
|
||||
:PROPERTIES:
|
||||
:header-args:emacs-lisp: :tangle no
|
||||
:END:
|
||||
** Resources
|
||||
Documentation:
|
||||
- [ ] Mu4e documentation: http://www.djcbsoftware.nl/code/mu/mu4e/index.html#Top
|
||||
@ -3367,7 +3392,9 @@ Choose account label to feed msmtp -a option based on From header in Message buf
|
||||
|
||||
:checkers
|
||||
syntax ; tasing you for every semicolon you forget
|
||||
(spell +aspell) ; tasing you for misspelling mispelling
|
||||
(spell
|
||||
+aspell
|
||||
+everywhere) ; tasing you for misspelling mispelling
|
||||
|
||||
:lang
|
||||
data ; config/data formats
|
||||
@ -3383,6 +3410,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf
|
||||
+hugo ; use Emacs for hugo blogging
|
||||
+roam2 ;
|
||||
+gnuplot
|
||||
+jupyter
|
||||
+present) ; using org-mode for presentations
|
||||
python ; beautiful is better than ugly
|
||||
(sh ; she sells {ba,z,fi}sh shells on the C xor
|
||||
@ -3440,6 +3468,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf
|
||||
#+begin_src emacs-lisp
|
||||
;; Automatic toggling of LaTeX fragments
|
||||
(package! org-fragtog)
|
||||
(package! org-appear)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
@ -3460,11 +3489,6 @@ Choose account label to feed msmtp -a option based on From header in Message buf
|
||||
:files ("*.el" "filters" "preprocessors")))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Renders Org-mode citations in CSL styles
|
||||
(package! citeproc-org)
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;; Connector between Org-roam, BibTeX-completion, and Org-ref
|
||||
(package! org-roam-bibtex
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user