Use =after! org= for all the orgmode configuration

This commit is contained in:
Thomas Dehaeze 2020-01-31 14:36:55 +01:00
parent 00d5fa5690
commit ddf3a54e7c

View File

@ -22,6 +22,8 @@
https://medium.com/urbint-engineering/emacs-doom-for-newbies-1f8038604e3b
https://noelwelsh.com/posts/2019-01-10-doom-emacs.html
https://dotdoom.netlify.com/config.html
https://emacs.christianbaeuerlein.com/
https://github.com/nmartin84/.doom.d/blob/master/config.org
Documentation:
- https://github.com/hlissner/doom-emacs/blob/develop/docs/index.org
@ -148,8 +150,9 @@ Turn off auto-fill mode that add line breaks.
(remove-hook 'text-mode-hook 'turn-on-auto-fill)
;; turn on auto-fill for text-mode
(add-hook 'text-mode-hook 'turn-on-auto-fill)
(after! org
;; turn off auto-fill for org-mode
(add-hook 'org-mode-hook 'turn-off-auto-fill)
(add-hook 'org-mode-hook 'turn-off-auto-fill))
#+end_src
** Change default alert backend
@ -165,12 +168,13 @@ Turn off auto-fill mode that add line breaks.
** Disable highlight of current line
#+begin_src emacs-lisp
(global-hl-line-mode -1)
(after! org
(add-hook 'org-mode-hook
(lambda()
(hl-line-mode -1)
(global-hl-line-mode -1))
't
)
))
#+end_src
* Magit
@ -185,13 +189,9 @@ Turn off auto-fill mode that add line breaks.
- http://doc.norang.ca/org-mode.html#TodoKeywords
- https://emacs.cafe/emacs/orgmode/gtd/2017/06/30/orgmode-gtd.html
** Make sure to load Org
#+begin_src emacs-lisp
(require 'org)
#+end_src
** Org General Config
#+begin_src emacs-lisp
(after! org
(setq org-directory "~/Cloud/org/")
(setq org-default-notes-file "~/Cloud/org/refile.org")
@ -207,6 +207,7 @@ Turn off auto-fill mode that add line breaks.
;; Record the information of when the task was marked as DONE
(setq org-log-done 'time)
)
#+end_src
TAB was changed to toggle only the visibility state of the current subtree, rather than cycle through it recursively. This can be reversed with:
@ -306,11 +307,13 @@ This cause the orgmode tables not to be well aligned.
** Org Links
#+begin_src emacs-lisp
(map! :map org-mode-map "C-c l" 'org-store-link)
(after! org
(map! :map org-mode-map "C-c l" 'org-store-link))
#+end_src
** Org Tagging
#+begin_src emacs-lisp
(after! org
;; Align Tags and flush right
(setq org-tags-column -78)
;; Tags with fast selection keys
@ -318,15 +321,19 @@ This cause the orgmode tables not to be well aligned.
("@work" . ?w)
("@christophe" . ?c)
("@veijo" . ?v))))
)
#+end_src
** Org Refile
#+begin_src emacs-lisp
(after! org
(setq org-refile-targets '((org-agenda-files . (:maxlevel . 6))))
)
#+end_src
** Org TODO
#+begin_src emacs-lisp
(after! org
;; Tags with fast selection keys
(setq org-todo-keywords '(
(sequence "TODO(t)" "NEXT(n)" "MAIL(m)" "|" "DONE(d)")
@ -352,12 +359,14 @@ This cause the orgmode tables not to be well aligned.
("BKMK" . (:foreground "#98971a" :weight bold)) ;; green
("IDEA" . (:foreground "#98971a" :weight bold)) ;; green
("EXAM" . (:foreground "#98971a" :weight bold)))) ;; green
)
#+end_src
** Archive subtrees under the same hierarchy as original in the archive files
https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
#+begin_src emacs-lisp
(after! org
(defadvice org-archive-subtree (around fix-hierarchy activate)
(let* ((fix-archive-p (and (not current-prefix-arg)
(not (use-region-p))))
@ -400,11 +409,13 @@ https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
(widen)
(org-end-of-subtree t t)
(org-paste-subtree level tree-text))))))))
)
#+end_src
** Org Agenda
*** General configuration
#+begin_src emacs-lisp
(after! org
(map! :map org-mode-map "C-c a" 'org-agenda)
;; File to save todo items
@ -432,40 +443,14 @@ https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
(tags . " %-12:c")
(search . " %-12:c"))
)
#+end_src
#+begin_src emacs-lisp
(map! :map org-mode-map "C-c a" 'org-agenda)
;; File to save todo items
(setq org-agenda-files (list "~/Cloud/org/"))
;; Include archived files
(setq org-agenda-archives-mode t)
;; Set priority range from A to C with default A
(setq org-highest-priority ?A)
(setq org-lowest-priority ?C)
(setq org-default-priority ?C)
;; Set colours for priorities
(setq org-priority-faces '((?A . (:foreground "#CC241D"))
(?B . (:foreground "#D65D0E"))
(?C . (:foreground "#D79921"))))
;; Open agenda in current window
(setq org-agenda-window-setup 'current-window)
(setq org-agenda-prefix-format
'((agenda . " %-12:c %?-12t% s")
(todo . "") ;; Don't show the filename for reading agenda
(tags . " %-12:c")
(search . " %-12:c")))
)
#+end_src
*** Org Agenda Custom Views
https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
#+begin_src emacs-lisp
(after! org-agenda
(defun tdh/org-agenda-skip-scheduled ()
(org-agenda-skip-entry-if 'scheduled 'deadline 'regexp "\n]+>"))
@ -492,29 +477,32 @@ https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
((todo "READ" ((org-agenda-overriding-header "Things to read"))))
((org-agenda-files '("~/Cloud/thesis/ressources/notes/")))))
)
)
#+end_src
** 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
(after! org-agenda
(setq appt-message-warning-time 5)
(defun my-org-agenda-to-appt ()
(defun tdh/org-agenda-to-appt ()
(interactive)
(setq appt-time-msg-list nil)
(org-agenda-to-appt))
(my-org-agenda-to-appt)
(tdh/org-agenda-to-appt)
; Display appointments as a window manager notification
(setq appt-disp-window-function 'my-appt-display)
(setq appt-disp-window-function 'tdh/appt-display)
(setq appt-delete-window-function (lambda () t))
(setq my-appt-notification-app (concat (getenv "HOME") "/bin/appt-notification"))
(defun my-appt-display (min-to-app new-time msg)
(setq tdh/appt-notification-app (concat (getenv "HOME") "/bin/appt-notification"))
(defun tdh/appt-display (min-to-app new-time msg)
(if (atom min-to-app)
(start-process "my-appt-notification-app" nil my-appt-notification-app min-to-app msg)
(start-process "tdh/appt-notification-app" nil tdh/appt-notification-app min-to-app msg)
(dolist (i (number-sequence 0 (1- (length min-to-app))))
(start-process "my-appt-notification-app" nil my-appt-notification-app (nth i min-to-app) (nth i msg)))))
(start-process "tdh/appt-notification-app" nil tdh/appt-notification-app (nth i min-to-app) (nth i msg)))))
)
#+end_src
*** appt-notification script
@ -532,13 +520,14 @@ https://emacs.stackexchange.com/questions/3844/good-methods-for-setting-up-alarm
** Org Structure Template
#+begin_src emacs-lisp
(after! org
(setq org-structure-template-alist
'(("c" . "center")
("C" . "comment")
("i" . "important")
("e" . "example")
("q" . "quote")
("s" . "src"))
("s" . "src")))
)
#+end_src
@ -549,10 +538,12 @@ Documentation:
- Capture protocol: https://orgmode.org/manual/capture-protocol.html
#+begin_src emacs-lisp
(map! :map org-mode-map "C-c c" 'org-capture)
(after! org
(map! :map org-mode-map "C-c c" 'org-capture))
#+end_src
#+begin_src emacs-lisp
(after! org
(setq org-capture-templates
(quote (("t" ; key
"todo" ; name
@ -594,11 +585,13 @@ Documentation:
:immediate-finish t
)
)))
)
#+end_src
** Org Export
*** Basic
#+begin_src emacs-lisp
(after! org
;; How many levels of headline to export
(setq org-export-headline-levels 4)
@ -606,22 +599,28 @@ Documentation:
(setq org-export-allow-bind-keywords t)
(setq org-odt-preferred-output-format "doc")
)
#+end_src
*** Do not export headline with the =:ignore:= tag
#+begin_src emacs-lisp
;; Used to not export headings with :ignore: tag
(after! org
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines))
(ox-extras-activate '(ignore-headlines)))
#+end_src
*** Ox Latex Subfigure package
#+begin_src emacs-lisp
(use-package! ox-latex-subfigure
:config (require 'ox-latex-subfigure))
;; (use-package! ox-latex-subfigure
;; :config (require 'ox-latex-subfigure))
#+end_src
*** Clear page before heading
https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-heading/30892
#+begin_src emacs-lisp
(after! org
(defun org/get-headline-string-element (headline backend info)
(let ((prop-point (next-property-change 0 headline)))
(if prop-point (plist-get (text-properties-at prop-point headline) :parent))))
@ -634,11 +633,13 @@ https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-he
(add-to-list 'org-export-filter-headline-functions
'org/ensure-latex-clearpage)
)
#+end_src
*** TODO HTML Export
**** MathJax
#+begin_src emacs-lisp
(after! org
(setq org-html-mathjax-template
"<script>
MathJax = {
@ -650,9 +651,11 @@ https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-he
</script>
<script type=\"text/javascript\"
src=\"%PATH\"></script>")
)
#+end_src
#+begin_src emacs-lisp
(after! org
(setq org-html-mathjax-options
'((path "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js")
(scale "100")
@ -664,30 +667,37 @@ https://emacs.stackexchange.com/questions/30575/adding-latex-newpage-before-a-he
(multlinewidth "85%")
(tagindent ".8em")
(tagside "right")))
)
#+end_src
**** Export with css class instead of inline css
#+begin_src emacs-lisp
(setq org-html-htmlize-output-type 'css)
(after! org
(setq org-html-htmlize-output-type 'css))
#+end_src
**** TODO MP4 movies
#+begin_src emacs-lisp :tangle no
(after! org
(setq org-html-html5-fancy t)
(setq org-html-doctype "xhtml-strict")
)
#+end_src
** Org LaTeX
*** Org CdLatex
https://orgmode.org/manual/CDLaTeX-mode.html#CDLaTeX-mode
#+begin_src emacs-lisp
(after! org
(push "~/.config/doom/local/" load-path)
(require 'cdlatex)
(add-hook 'org-mode-hook 'turn-on-org-cdlatex)
)
#+end_src
*** LaTeX Classes
#+begin_src emacs-lisp
(after! org
;; Custom classes to use when exporting to latex
(add-to-list 'org-latex-classes
`("beamer"
@ -743,10 +753,12 @@ https://orgmode.org/manual/CDLaTeX-mode.html#CDLaTeX-mode
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
)
)
#+end_src
*** Basic
*** Default added packages
#+begin_src emacs-lisp
(after! org
;; Add packages by default
(add-to-list 'org-latex-packages-alist '("" "siunitx" t))
(add-to-list 'org-latex-packages-alist '("" "array" t))
@ -754,7 +766,12 @@ https://orgmode.org/manual/CDLaTeX-mode.html#CDLaTeX-mode
(add-to-list 'org-latex-packages-alist '("" "booktabs" t))
(add-to-list 'org-latex-packages-alist '("" "bm" t))
(add-to-list 'org-latex-packages-alist '("most" "tcolorbox" t))
)
#+end_src
*** Some configurations
#+begin_src emacs-lisp
(after! org
;; Setup default option for image size when exporting to LaTeX
(setq org-latex-image-default-option "scale=1")
(setq org-latex-image-default-width nil)
@ -771,11 +788,13 @@ https://orgmode.org/manual/CDLaTeX-mode.html#CDLaTeX-mode
;; Command used when exporting to pdf
(setq org-latex-pdf-process
'("latexmk -cd -pdflatex=\"pdflatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory %o\" -pdf -bibtex -f %f"))
)
#+end_src
*** Beamer
Bold Text
#+begin_src emacs-lisp
(after! org
(defun tdh/my-beamer-bold (contents backend info)
(when (eq backend 'beamer)
(replace-regexp-in-string
@ -784,12 +803,14 @@ Bold Text
contents)))
(add-to-list 'org-export-filter-bold-functions 'tdh/my-beamer-bold)
)
#+end_src
Special Environments
- [ ] Make some comment those special environments
#+begin_src emacs-lisp
(after! org
(add-to-list 'org-beamer-environments-extra
'("cbox" ;; Name of environment
"m" ;; Selection key
@ -800,6 +821,7 @@ Special Environments
"M" ;; Selection key
"\\onslide%a{\\tcbsubtitle{%h}"
"}"))
)
#+end_src
*** TODO Latex Fragments
@ -807,6 +829,7 @@ Special Environments
http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode/
#+begin_src emacs-lisp
(after! org
(map! :map org-mode-map
;; Activate Automatic LaTeX fragment
:n ",ol" '(lambda () (interactive) (add-hook 'post-command-hook 'tdh/org-latex-fragment-toggle t))
@ -851,6 +874,7 @@ http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode/
;; Use imagemagick/dvisvgm to generate png from pdf
(setq org-preview-latex-default-process 'dvipng)
)
#+end_src
*** TODO Custom Export - Add Page and Label for LaTeX export
@ -918,6 +942,7 @@ https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbit
*** Number Equations
#+begin_src emacs-lisp
(after! org
(defun org-renumber-environment (orig-func &rest args)
"A function to inject numbers in LaTeX fragment previews."
(let ((results '())
@ -960,6 +985,7 @@ https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbit
(apply orig-func args))
(advice-add 'org-create-formula-image :around #'org-renumber-environment)
)
#+end_src
** TODO [#A] View PDF in org mode
@ -1012,13 +1038,13 @@ https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbit
#+end_src
#+begin_src emacs-lisp :tangle no
(defun my-latex-filter-nobreaks (text backend info)
(defun tdh/latex-filter-nobreaks (text backend info)
"Ensure \" \" are properly handled in LaTeX export."
(when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string " " "~" text)))
(add-to-list 'org-export-filter-plain-text-functions
'my-latex-filter-nobreaks)
'tdh/latex-filter-nobreaks)
#+end_src
#+begin_src emacs-lisp :tangle no
@ -1094,7 +1120,7 @@ Let's try the first solution.
(let ((text (replace-regexp-in-string "[^\\w]\\(:\\)[^\n\t\r]+\\(:\\)[^\\w]" "<mark>" text nil nil 1 nil)))
(replace-regexp-in-string "[^\\w]\\(<mark>\\)[^\n\t\r]+\\(:\\)[^\\w]" "</mark>" text nil nil 2 nil))))
(add-to-list 'org-export-filter-plain-text-fucntions 'my-html-mark-tag)
(add-to-list 'org-export-filter-plain-text-fucntions 'tdh/html-mark-tag)
#+end_src
#+begin_src emacs-lisp :tangle no
@ -1131,9 +1157,7 @@ Ressources:
- https://www.reddit.com/r/emacs/comments/4gudyw/help_me_with_my_orgmode_workflow_for_notetaking/
#+begin_src emacs-lisp
(use-package! org-ref
:after org
:config
(after! org-ref
;; Folder where the notes files are located (or file if just one Note file)
(setq org-ref-notes-directory "~/Cloud/thesis/ressources/notes")
(setq org-ref-bibliography-notes "~/Cloud/thesis/ressources/notes")
@ -1164,6 +1188,7 @@ Ressources:
- https://github.com/weirdNox/org-noter
#+begin_src emacs-lisp
(after! org-noter
(setq org-noter-always-create-frame nil)
(setq org-noter-kill-frame-at-session-end nil)
;; Fraction of the frame that the document window will occupy when split
@ -1174,12 +1199,14 @@ Ressources:
(setq org-noter-separate-notes-from-heading t)
;; List of paths to check (non recursively) when searching for a notes file
(setq org-noter-notes-search-path "~/Cloud/thesis/ressources/notes")
)
#+end_src
** Custom key bindings
Export to LaTeX
#+begin_src emacs-lisp
(map! :map org-mode-map :n ",l" 'org-latex-export-to-latex)
(after! org
(map! :map org-mode-map :n ",l" 'org-latex-export-to-latex))
#+end_src
Open pdf externally.
@ -1189,7 +1216,8 @@ Open pdf externally.
(call-process "xdg-open" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".pdf"))
)
(map! :map org-mode-map :n ",vp" 'tdh/open-org-pdf-externally)
(after! org
(map! :map org-mode-map :n ",vp" 'tdh/open-org-pdf-externally))
#+end_src
Open HTML externally.
@ -1199,24 +1227,13 @@ Open HTML externally.
(call-process "xdg-open" nil 0 nil (concat (file-name-sans-extension (buffer-file-name)) ".html"))
)
(map! :map org-mode-map :n ",vh" 'tdh/open-org-html-externally)
#+end_src
** TODO Org-Contacts
#+begin_src emacs-lisp :tangle no
(setq org-contacts-files (list "~/Cloud/org/contacts.org"))
#+end_src
** TODO Org-Wunderlist
#+begin_src emacs-lisp :tangle no
(setq org-wunderlist-client-id "6799d9caeb2f5d8bd641"
org-wunderlist-token "fd5965cde436c2587850a7c517d366561d8a1cbf7b6d96ab62f3fc8c9930"
org-wunderlist-file "~/Cloud/thesis/todos/wunderlist.org"
org-wunderlist-dir "~/.emacs.d/org-wunderlist/")
(after! org
(map! :map org-mode-map :n ",vh" 'tdh/open-org-html-externally))
#+end_src
** Automatically run =startblock= when opening org-mode files
#+begin_src emacs-lisp
(after! org
(defun tdh/eval-startblock ()
(if (member "startblock" (org-babel-src-block-names))
(save-excursion
@ -1227,6 +1244,7 @@ Open HTML externally.
)
(add-hook 'org-mode-hook 'tdh/eval-startblock)
)
#+end_src
** TODO Insert ScreenShot or Picture from Phone
@ -1295,7 +1313,8 @@ http://pragmaticemacs.com/emacs/a-workflow-to-quickly-add-photos-to-org-mode-not
https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_chapter_2_it/
#+begin_src emacs-lisp
(defun my-render-org-table-at-point ()
(after! org
(defun tdh/render-org-table-at-point ()
(interactive)
(save-excursion
(beginning-of-line)
@ -1310,11 +1329,11 @@ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_c
(while (not (eq 'table (org-element-type (org-element-at-point))))
(forward-line -1))
(my-render-org-table (org-element-at-point))
(tdh/render-org-table (org-element-at-point))
)))))
(defun my-render-org-table (table)
(defun tdh/render-org-table (table)
(interactive)
(let* ((begin (org-element-property :begin table))
(end (let ((pos (org-element-property :end table)))
@ -1339,40 +1358,55 @@ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_c
)
(defun my-render-org-tables-in-buffer ()
(defun tdh/render-org-tables-in-buffer ()
(save-excursion
(org-element-map (org-element-parse-buffer) 'table 'my-render-org-table)))
(org-element-map (org-element-parse-buffer) 'table 'tdh/render-org-table)))
;; Use F9 to globally generate tables
(map! :map org-mode-map :n "<f8>" (lambda () (interactive) (my-render-org-table-at-point)))
(map! :map org-mode-map :n "<f8>" (lambda () (interactive) (tdh/render-org-table-at-point)))
)
#+end_src
** Org Gcal
- https://cestlaz.github.io/posts/using-emacs-26-gcal/#.WIqBud9vGAk
#+begin_src emacs-lisp
(after! org
(setq org-gcal-client-id "396102378658-dcmbcmrnthbe925519otsjbd921otq0v.apps.googleusercontent.com"
org-gcal-client-secret "4M5PWrbhQjwYEMXGK85lDYX9"
org-gcal-file-alist '(("dehaeze.thomas@gmail.com" . "~/Cloud/org/gcal.org")
("8kjmhe2ar0abnm054ill1fb0gc@group.calendar.google.com" . "~/Cloud/org/gcal_phd.org")))
;; Automatic fetch of the new events
(add-hook 'org-agenda-mode-hook (lambda () (org-gcal-fetch) ))
)
#+end_src
* Org Babel
** Main configuration
Don't ask for confirmation when evaluating following blocs
#+begin_src emacs-lisp
;; Don't ask for confirmation when evalutating latex blocs
(defun my-org-confirm-babel-evaluate (lang body)
(defun tdh/org-confirm-babel-evaluate (lang body)
(not (member lang '("emacs-lisp" "latex" "matlab" "sh"))))
(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
(after! org
(setq org-confirm-babel-evaluate 'tdh/org-confirm-babel-evaluate))
#+end_src
Use the current window for C-c ' source editing
#+begin_src emacs-lisp
;; Use the current window for C-c ' source editing
(setq org-src-window-setup 'current-window)
(after! org
(setq org-src-window-setup 'current-window))
#+end_src
** Library of Babel
Add all named source blocks to =org-babel-library-of-babel=.
#+begin_src emacs-lisp
(after! org
(org-babel-lob-ingest "~/Cloud/thesis/org-mode/org-babel-tutorial/org-babel-library.org"))
#+end_src
** Special Shortcuts
https://emacs.stackexchange.com/questions/13869/how-to-toggle-org-mode-source-code-block-eval-no-status
@ -1396,8 +1430,9 @@ when inside a source block. Otherwise, keep the normal behavior for ctrl-ent.
(in-src-block-function)
(+org--insert-item 'below)))
(after! org
(map! :map evil-org-mode-map
:n "<C-return>" #'tdh/ctrl-ret)
:n "<C-return>" #'tdh/ctrl-ret))
#+end_src
#+begin_src emacs-lisp
@ -1418,19 +1453,14 @@ https://emacs.stackexchange.com/questions/22430/rebind-org-babel-execute-src-blo
(tdh/org-babel-execute-goto-next)
(+org/insert-item-above)))
(after! org
(map! :map evil-org-mode-map
:n "<C-S-return>" #'tdh/ctrl-shit-ret)
#+end_src
** TODO [#A] Library of Babel
Add all named source blocks to =org-babel-library-of-babel=.
#+begin_src emacs-lisp
; (org-babel-lob-ingest "~/Cloud/thesis/org-mode/org-babel-tutorial/org-babel-library.org")
:n "<C-S-return>" #'tdh/ctrl-shit-ret))
#+end_src
** Org-Babel Matlab
#+begin_src emacs-lisp
(after! org
(setq org-babel-matlab-shell-command "/home/thomas/bin/matlab -nodesktop -nosplash")
(setq org-babel-matlab-emacs-link-wrapper-method
@ -1445,10 +1475,12 @@ Add all named source blocks to =org-babel-library-of-babel=.
end
delete('%s');
")
)
#+end_src
** Default options for Matlab code
#+begin_src emacs-lisp
(after! org
(setq org-babel-default-header-args:matlab
'((:results . "none")
(:session . "*MATLAB*")
@ -1460,22 +1492,7 @@ Add all named source blocks to =org-babel-library-of-babel=.
(:tangle . "no")
(:mkdir . "yes")
(:eval . "no-export")))
#+end_src
** TODO Asynchronous execution
#+begin_src emacs-lisp
;; (push "~/.emacs.d/private/ob-session-async/lisp/" load-path)
;; (require 'ob-session-async)
#+end_src
#+begin_src emacs-lisp
;; (with-eval-after-load "ob"
;; (require 'org-babel-eval-in-repl))
#+end_src
#+begin_src emacs-lisp
;; (with-eval-after-load "eval-in-repl"
;; (setq eir-jump-after-eval nil))
)
#+end_src
** TODO Theme
@ -1488,9 +1505,11 @@ Add all named source blocks to =org-babel-library-of-babel=.
** Indentation
#+begin_src emacs-lisp
(after! org
(setq org-edit-src-content-indentation 2
org-src-tab-acts-natively nil
org-src-preserve-indentation nil)
)
#+end_src
** Some functions for using Matlab with Org Babel
@ -1616,10 +1635,6 @@ Add all named source blocks to =org-babel-library-of-babel=.
)
#+end_src
#+begin_src emacs-lisp
(map! :map org-mode-map :n ",bT" 'tdh/org-babel-tangle-subtree)
#+end_src
*** Org-Babel Jump to Tangle File
Actually this tangle the file and then go to the file. Maybe I would like to ignore the tangling phase.
@ -1639,10 +1654,6 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
(error "Cannot open tangle file %S" file)))))
#+end_src
#+begin_src emacs-lisp
(map! :map org-mode-map :n ",bF" 'tdh/org-babel-jump-to-tangle-file)
#+end_src
*** Org-Babel Tangle File and Execute
#+begin_src emacs-lisp
(defun tdh/org-babel-execute-tangle-file ()
@ -1660,6 +1671,15 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
(error "Cannot open tangle file %S" file)))))
#+end_src
*** Map Custom functions
#+begin_src emacs-lisp
(after! org
(map! :map org-mode-map :n ",bT" 'tdh/org-babel-tangle-subtree)
(map! :map org-mode-map :n ",bF" 'tdh/org-babel-jump-to-tangle-file)
)
#+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
@ -2139,17 +2159,19 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
(delete-process "latexmk-watch")
)
(after! org
(map! :map org-mode-map
:n ",ow" 'tdh/latex/watch
:n ",ok" 'tdh/latex/watch/kill)
:n ",ok" 'tdh/latex/watch/kill))
#+end_src
** Helm-Bibtex
#+begin_src emacs-lisp
(after! org
(map! :map org-mode-map
:n ",ob" 'helm-bibtex
:n ",of" 'helm-bibtex-favorites
:n ",or" 'helm-resume)
:n ",or" 'helm-resume))
#+end_src
** Open terminal in current directory
@ -2159,7 +2181,8 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
(call-process-shell-command
(concat "termite --directory=" default-directory) nil 0))
(map! :map org-mode-map :n ",ot" 'tdh/open-terminal-in-workdir)
(after! org
(map! :map org-mode-map :n ",ot" 'tdh/open-terminal-in-workdir))
#+end_src
** Open ranger in current directory
@ -2169,7 +2192,8 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
(call-process-shell-command
(concat "termite --directory=" default-directory " --exec=ranger") nil 0))
(map! :map org-mode-map :n ",oo" 'tdh/open-ranger-in-workdir)
(after! org
(map! :map org-mode-map :n ",oo" 'tdh/open-ranger-in-workdir))
#+end_src
* Yassnippets
@ -2186,32 +2210,10 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
("no_proxy" . "^.*esrf.fr")))
#+end_src
* TODO [#B] Slack
:PROPERTIES:
:header-args:emacs-lisp+: :tangle no
:END:
#+begin_src emacs-lisp
(slack-register-team
:name "emacs-slack"
:default t
:client-id "299050134212.316863429523"
:client-secret "7168a660375090e517fe812ea2d136e5"
:token "xoxp-299050134212-299063259042-715794254097-7c319fdd63315620e86f1fad42c126a2"
:subscribed-channels '())
#+end_src
#+begin_src emacs-lisp
(advice-add 'slack-counts-update :override #'ignore)
#+end_src
#+begin_src emacs-lisp
(setq slack-prefer-current-team t)
#+end_src
* TODO [#C] Neomutt connection
https://mentat.za.net/blog/2018/10/31/using-org-mode-with-neomutt/
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no
(require 'org-protocol)
;; Call this function, which spawns neomutt, whenever org-mode
;; tries to open a link of the form mutt:message-id+goes_here@mail.gmail.com