Update doom config

This commit is contained in:
Thomas Dehaeze 2021-10-25 14:32:38 +02:00
parent 82056ed283
commit e55d95cd6e
2 changed files with 165 additions and 139 deletions

302
doom.org
View File

@ -245,6 +245,20 @@ Switch from one language to an other ([[https://stackoverflow.com/questions/4215
(setq ispell-program-name "aspell") (setq ispell-program-name "aspell")
#+end_src #+end_src
#+begin_src emacs-lisp
(defun tdh-correct-last-word ()
(interactive)
(save-excursion
(+spell/previous-error)
(+spell/correct)
)
)
#+end_src
#+begin_src emacs-lisp
(define-key evil-insert-state-map (kbd "C-l") 'tdh-correct-last-word)
#+end_src
** Lockfiles ** Lockfiles
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq create-lockfiles nil) (setq create-lockfiles nil)
@ -311,6 +325,16 @@ This works also with =C-x C-q=
- =(= Hide details - =(= Hide details
- =)= Show git infos - =)= Show git infos
#+begin_src emacs-lisp
(after! magit
(setq dired-listing-switches "-lAGh1v --group-directories-first")
(add-hook 'dired-mode-hook
(lambda ()
(dired-hide-details-mode)
(dired-sort-toggle-or-edit)))
)
#+end_src
** PDF-Tools ** PDF-Tools
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! pdf-tools (use-package! pdf-tools
@ -340,6 +364,30 @@ This works also with =C-x C-q=
)) ))
#+end_src #+end_src
** Flycheck
#+begin_src emacs-lisp :tangle no
(flycheck-define-checker proselint
"A linter for prose."
:command ("proselint" source-inplace)
:error-patterns
((warning line-start (file-name) ":" line ":" column ": "
(id (one-or-more (not (any " "))))
(message (one-or-more not-newline)
(zero-or-more "\n" (any " ") (one-or-more not-newline)))
line-end))
:modes (text-mode markdown-mode gfm-mode org-mode))
(add-to-list 'flycheck-checkers 'proselint)
#+end_src
Disable flycheck for now with orgmode buffers:
#+begin_src emacs-lisp
(defun disable-flycheck-mode ()
(interactive)
(flycheck-mode -1))
(add-hook 'org-mode-hook 'disable-flycheck-mode)
#+end_src
** Yassnippets ** Yassnippets
#+begin_src emacs-lisp #+begin_src emacs-lisp
(push "~/.config/doom/snippets" yas-snippet-dirs) (push "~/.config/doom/snippets" yas-snippet-dirs)
@ -655,7 +703,7 @@ Org Agenda Custom Views
) )
#+end_src #+end_src
** Org Agenda HTML ** TODO Org Agenda HTML
This function can be used to export the week calendar to html. This function can be used to export the week calendar to html.
This html page can be used as a starting page for the browser. This html page can be used as a starting page for the browser.
This idea comes from [[https://blog.lambda.cx/posts/org-agenda-new-tab/][here]]. This idea comes from [[https://blog.lambda.cx/posts/org-agenda-new-tab/][here]].
@ -663,7 +711,7 @@ This idea comes from [[https://blog.lambda.cx/posts/org-agenda-new-tab/][here]].
(defun tdh-org-agenda-to-html () (defun tdh-org-agenda-to-html ()
(interactive) (interactive)
(org-agenda-list) (org-agenda-list)
(org-agenda-write "/ssh:thomas@grenoble:~/docker/config/calendar/www/index.html")) (org-agenda-write "/ssh:thomas@homelab:~/docker/config/calendar/www/index.html"))
#+end_src #+end_src
** Org Fancy Priority ** Org Fancy Priority
@ -772,7 +820,14 @@ Documentation:
"Org-Protocol Mail" "Org-Protocol Mail"
entry entry
(file+headline "~/Cloud/org/work-notebook.org" "Mails") (file+headline "~/Cloud/org/work-notebook.org" "Mails")
"* MAIL %:description [[message:%:link][link]]\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n\n" "* MAIL %:description [[message:%:link][link]]\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%i\n"
:immediate-finish t
)
("ps"
"Org-Protocol Sent Mail"
entry
(file+headline "~/Cloud/org/work-notebook.org" "Mails")
"* WAIT %:description [[message:%:link][link]]\n%(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n- to: %i\n\n\n\n"
:immediate-finish t :immediate-finish t
) )
("pu" ("pu"
@ -793,6 +848,38 @@ Documentation:
) )
#+end_src #+end_src
** =message:= link to mutt
#+begin_src emacs-lisp
(require 'org-protocol)
(defun stefanv/mutt-open-message (message-id)
"In neomutt, open the email with the the given Message-ID"
(let*
((message-id (replace-regexp-in-string "^/*" "" message-id))
(mail-file
(replace-regexp-in-string
"\n$" "" (shell-command-to-string
(format "mu find -f l i:%s | head -n 1" message-id))))
(mail-dir (replace-regexp-in-string "/\\(cur\\|new\\|tmp\\)/$" ""
(file-name-directory mail-file)))
(process-id (concat "neomutt-" message-id))
(message-id-escaped (regexp-quote message-id))
(mutt-keystrokes
(format "L~i %s\n\nLall\n\nl" (shell-quote-argument message-id-escaped)))
(mutt-command (list "neomutt" "-R" "-f" mail-dir
"-e" (format "push '%s'" mutt-keystrokes))))
(message "Launching neomutt for message %s" message-id)
(call-process "setsid" nil nil
"-f" "alacritty" "-e"
"neomutt" "-R" "-f" mail-dir
"-e" (format "push '%s'" mutt-keystrokes))))
; Whenever org-mode sees a link starting with `message://`, it
; calls our `mutt-open-message` function
(org-add-link-type "message" 'stefanv/mutt-open-message)
#+end_src
** Org Export ** Org Export
Basic configuration: Basic configuration:
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -829,6 +916,14 @@ Do not export headline with the =:ignore:= tag:
(ox-extras-activate '(ignore-headlines))) (ox-extras-activate '(ignore-headlines)))
#+end_src #+end_src
** Org Effort
#+begin_src emacs-lisp
(after! org
(setq org-global-properties
'(("Effort_ALL". "0 0:10 0:30 1:00 2:00 3:00 4:00")))
)
#+end_src
** HTML Export ** HTML Export
*** HTML Defaults *** HTML Defaults
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1079,6 +1174,14 @@ by spaces.
(setq org-xournalpp-template-getter (lambda () "/home/thomas/Downloads/template_test.xopp")) (setq org-xournalpp-template-getter (lambda () "/home/thomas/Downloads/template_test.xopp"))
#+end_src #+end_src
** Org Transclusion
#+begin_src emacs-lisp
(use-package! org-transclusion
:config
)
#+end_src
** Org LaTeX ** Org LaTeX
*** LaTeX Fragments *** LaTeX Fragments
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -1652,7 +1755,7 @@ The file is taken from a start directory set by `tdh-image-dir' and moved to the
** Render Tables ** Render Tables
https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_chapter_2_it/ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_chapter_2_it/
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp
(after! org (after! org
(defun tdh-render-org-table-at-point () (defun tdh-render-org-table-at-point ()
(interactive) (interactive)
@ -1751,23 +1854,6 @@ https://www.reddit.com/r/emacs/comments/d3a8or/pretty_org_tables_in_the_buffer_c
) )
#+end_src #+end_src
** Org Gcal
- https://cestlaz.github.io/posts/using-emacs-26-gcal/#.WIqBud9vGAk
#+begin_src emacs-lisp
(use-package! org-gcal
:after org
:init
:config
(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
** Citeproc-Org ** Citeproc-Org
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! citeproc-org (use-package! citeproc-org
@ -1976,9 +2062,7 @@ Map Keys
"Watch LaTeX file using latexmk" "Watch LaTeX file using latexmk"
(interactive) (interactive)
(start-process-shell-command "latexmk-watch" "*latexmk-watch-output*" (start-process-shell-command "latexmk-watch" "*latexmk-watch-output*"
"latexmk" (format "-pdflatex=\"xelatex -synctex=1 -shell-escape -interaction nonstopmode -output-directory='%s'\" -pdf -pvc -bibtex -f %s.tex" "latexmk" "-pvc"))
(file-name-directory buffer-file-name)
(file-name-base buffer-file-name))))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2041,7 +2125,7 @@ Map Keys
(defun tdh-open-ranger-in-workdir () (defun tdh-open-ranger-in-workdir ()
(interactive) (interactive)
(call-process-shell-command (call-process-shell-command
(concat "termite --directory=" default-directory " --exec=ranger") nil 0)) (concat "alacritty -e ranger " default-directory) nil 0))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -2654,6 +2738,34 @@ Nice Functions:
) )
#+end_src #+end_src
** Capture Templates
*** Bibliography
#+begin_src org :tangle ~/.config/doom/capture-templates/ref.org
- Tags :: %?
- Reference :: ${ref}
- Author(s) :: %^{author}
- Year :: %^{year}
,* %^{author-abbrev} (%^{year}): %^{title} :%^{entry-type}:ignore:
:PROPERTIES:
:NOTER_DOCUMENT: ../pdfs/%^{citekey}.pdf
:END:
,* Bibliography :ignore:
,#+BIBLIOGRAPHY: here
#+end_src
*** Default
#+begin_src org :tangle ~/.config/doom/capture-templates/default.org
- Tags ::
%?
,* Bibliography :ignore:
,#+BIBLIOGRAPHY: here
#+end_src
** Org Roam ([[https://github.com/jethrokuan/org-roam/][link]]) ** Org Roam ([[https://github.com/jethrokuan/org-roam/][link]])
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! org-roam (use-package! org-roam
@ -2661,39 +2773,22 @@ Nice Functions:
(org-roam-link ((t (:inherit org-link :foreground "#cc241d")))) (org-roam-link ((t (:inherit org-link :foreground "#cc241d"))))
:config :config
(setq org-roam-directory (file-truename "~/Cloud/brain/")) (setq org-roam-directory (file-truename "~/Cloud/brain/"))
(make-directory org-roam-directory 'parents)
(setq org-roam-completion-system 'helm) (setq org-roam-completion-system 'helm)
(setq org-roam-tag-sources '(prop last-directory)) (setq org-roam-tag-sources '(prop last-directory))
(setq org-roam-capture-templates (setq org-roam-capture-templates
`(("d" "default" plain (function org-roam--capture-get-point) `(("d" "default" plain (file "~/.config/doom/capture-templates/default.org")
"%?" :if-new (file+head "${slug}.org" "#+title: ${title}\n#+setupfile: ./setup/org-setup-file.org\n#+hugo_section: zettels\n\n")
:file-name "${slug}" :unnarrowed t)
:head ,(concat "#+title: ${title}\n" ("r" "bibliography reference" plain (file "~/.config/doom/capture-templates/ref.org")
"#+setupfile: ./setup/org-setup-file.org\n" :if-new (file+head "${citekey}.org" "#+title: ${title}\n#+setupfile: ./setup/org-setup-file.org\n#+hugo_section: ${entry-type}\n\n")
"#+hugo_section: zettels\n"
"\n"
"- Tags ::\n"
"\n"
"* Bibliography :ignore:\n"
"bibliography:./biblio/references.bib"
)
:unnarrowed t)))
(setq org-roam-capture-ref-templates
`(("r" "ref" plain (function org-roam--capture-get-point)
"%?"
:file-name "${slug}"
:head ,(concat "#+title: ${title}\n"
"#+setupfile: ./setup/org-setup-file.org\n"
"#+hugo_section: websites\n"
"#+roam_key: ${ref}\n"
"\n"
"- Tags ::\n"
)
:unnarrowed t))) :unnarrowed t)))
) )
#+end_src #+end_src
Automatic export of backlinks Automatic export of backlinks
#+begin_src emacs-lisp #+begin_src emacs-lisp :tangle no
(after! (org org-roam) (after! (org org-roam)
(defun tdh-org-roam--backlinks-list (file) (defun tdh-org-roam--backlinks-list (file)
(when (org-roam--org-roam-file-p file) (when (org-roam--org-roam-file-p file)
@ -2724,47 +2819,6 @@ Re-Export all roam files.
(org-hugo-export-wim-to-md))))) (org-hugo-export-wim-to-md)))))
#+end_src #+end_src
Create Org-Roam file from heading ([[https://ag91.github.io/blog/2020/11/12/write-org-roam-notes-via-elisp/][link]])
#+begin_src emacs-lisp
(defun tdh/make-roam-filepath (title)
"Make filename from note TITLE."
(concat
org-roam-directory
(org-roam--title-to-slug title)
".org"))
(defun tdh/insert-org-roam-file (file-path title text)
"Insert org roam file in FILE-PATH with TITLE, LINKS, SOURCES, TEXT, QUOTE."
(with-temp-file file-path
(insert
"#+title: " title "\n"
"#+setupfile: ./setup/org-setup-file.org\n"
"#+hugo_section: zettels\n"
"\n"
"- Tags ::\n"
"\n"
text
"\n"
"\n"
"* Bibliography :ignore:\n"
"bibliography:./biblio/references.bib"
"\n"
)))
(defun tdh/convert-task-to-org-note ()
"Convert a task in a `org-roam' note."
(interactive)
(let* ((heading (org-get-heading t t t t))
(body (org-get-entry))
(filepath (tdh/make-roam-filepath heading)))
(tdh/insert-org-roam-file
filepath
heading
body)
(find-file filepath)))
#+end_src
** Helm-Bibtex ([[https://github.com/tmalsburg/helm-bibtex][link]]) ** Helm-Bibtex ([[https://github.com/tmalsburg/helm-bibtex][link]])
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! helm-bibtex (use-package! helm-bibtex
@ -2804,6 +2858,7 @@ Create Org-Roam file from heading ([[https://ag91.github.io/blog/2020/11/12/writ
"#+setupfile: ./setup/org-setup-file.org\n" "#+setupfile: ./setup/org-setup-file.org\n"
"#+hugo_section: ${=type=}\n" "#+hugo_section: ${=type=}\n"
"#+roam_key: ${=key=}\n" "#+roam_key: ${=key=}\n"
"#+hugo_draft: true\n"
"\n" "\n"
"- Tags ::\n" "- Tags ::\n"
"- Reference :: cite:${=key=}\n" "- Reference :: cite:${=key=}\n"
@ -2892,14 +2947,14 @@ List all element of the bibliography without pdf associated
) )
#+end_src #+end_src
** Deft ** Deft ([[https://github.com/jrblevin/deft][link]])
#+begin_src emacs-lisp #+begin_src emacs-lisp :tangle no
(use-package! deft (use-package! deft
:custom :custom
(deft-directory "~/Cloud/brain/")) (deft-directory "~/Cloud/brain/"))
#+end_src #+end_src
** Org-Roam-Bibtex ([[https://github.com/Zaeph/org-roam-bibtex][link]]) ** Org-Roam-Bibtex ([[https://github.com/org-roam/org-roam-bibtex][link]])
Provides nice functions such as: Provides nice functions such as:
- =orb-find-non-ref-file= - =orb-find-non-ref-file=
- =orb-insert-non-ref= - =orb-insert-non-ref=
@ -2907,33 +2962,9 @@ Provides nice functions such as:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package! org-roam-bibtex (use-package! org-roam-bibtex
:hook (org-roam-mode . org-roam-bibtex-mode) :after org-roam
:config :config
(setq orb-preformat-keywords `("=key=" "title" "author" "year" "author-abbrev" "=type=")) (setq orb-preformat-keywords '("citekey" "title" "author" "year" "author-abbrev" "entry-type"))
(setq orb-templates
`(("r" "ref" plain (function org-roam-capture--get-point) ""
:file-name "${=key=}"
:head ,(concat "#+title: ${title}\n"
"#+setupfile: ./setup/org-setup-file.org\n"
"#+hugo_section: ${=type=}\n"
"#+roam_key: ${ref}\n"
"\n"
"- Tags ::\n"
"- Reference :: ${ref}\n"
"- Author(s) :: ${author}\n"
"- Year :: ${year}\n"
"\n"
"* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n"
":PROPERTIES:\n"
":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
":END:\n"
"\n"
"* Bibliography :ignore:\n"
"bibliography:./biblio/references.bib"
)
:unnarrowed t)))
(setq orb-note-actions-user '(("Open with Zathura" . tdh-open-bib-with-zathura))) (setq orb-note-actions-user '(("Open with Zathura" . tdh-open-bib-with-zathura)))
) )
#+end_src #+end_src
@ -3350,7 +3381,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf
(org ; organize your plain life in plain text (org ; organize your plain life in plain text
+dragndrop ; drag & drop files/images into org buffers +dragndrop ; drag & drop files/images into org buffers
+hugo ; use Emacs for hugo blogging +hugo ; use Emacs for hugo blogging
+roam ; +roam2 ;
+gnuplot +gnuplot
+present) ; using org-mode for presentations +present) ; using org-mode for presentations
python ; beautiful is better than ugly python ; beautiful is better than ugly
@ -3364,7 +3395,7 @@ Choose account label to feed msmtp -a option based on From header in Message buf
(mu4e +gmail) (mu4e +gmail)
:app :app
calendar ;; calendar
;;(rss +org) ; emacs as an RSS reader ;;(rss +org) ; emacs as an RSS reader
;;write ; emacs for writers (fiction, notes, papers, etc.) ;;write ; emacs for writers (fiction, notes, papers, etc.)
@ -3386,6 +3417,14 @@ Choose account label to feed msmtp -a option based on From header in Message buf
:files ("resources" "*.el"))) :files ("resources" "*.el")))
#+end_src #+end_src
#+begin_src emacs-lisp
(package! org-transclusion
:recipe (:host github
:repo "nobiot/org-transclusion"
:branch "main"
:files ("*.el")))
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Vimrc ;; Vimrc
(package! vimrc-mode) (package! vimrc-mode)
@ -3413,11 +3452,6 @@ Choose account label to feed msmtp -a option based on From header in Message buf
(package! poet-theme) (package! poet-theme)
#+end_src #+end_src
#+begin_src emacs-lisp
;; Major mode for SPICE
(package! spice-mode)
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Import file to Org-mode ;; Import file to Org-mode
(package! org-pandoc-import (package! org-pandoc-import
@ -3433,7 +3467,9 @@ Choose account label to feed msmtp -a option based on From header in Message buf
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Connector between Org-roam, BibTeX-completion, and Org-ref ;; Connector between Org-roam, BibTeX-completion, and Org-ref
(package! org-roam-bibtex) (package! org-roam-bibtex
:recipe (:host github :repo "org-roam/org-roam-bibtex"))
(unpin! org-roam company-org-roam)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -3441,21 +3477,11 @@ Choose account label to feed msmtp -a option based on From header in Message buf
(package! org-ref) (package! org-ref)
#+end_src #+end_src
#+begin_src emacs-lisp
;; Org file tangling upon save
;; (package! org-auto-tangle)
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Alert notifications for org-agenda ;; Alert notifications for org-agenda
(package! org-wild-notifier) (package! org-wild-notifier)
#+end_src #+end_src
#+begin_src emacs-lisp
;; Display Google Calendar in org-calendar
(package! org-gcal)
#+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Turn table into subfigure ;; Turn table into subfigure
(package! ox-latex-subfigure (package! ox-latex-subfigure

View File

@ -97,7 +97,7 @@ $0
#+end_src #+end_src
** Caption ** Caption
#+begin_src conf :tangle ~/.config/doom/snippets/org-mode/caption #+begin_src conf :tangle ~/.config/doom/snippets/org-mode/]c
#contributor : Thomas Dehaeze <dehaeze.thomas@gmail.com> #contributor : Thomas Dehaeze <dehaeze.thomas@gmail.com>
#name :Caption #name :Caption
# -- # --