Update the doom emacs configuration

This commit is contained in:
Thomas Dehaeze 2020-01-28 21:31:08 +01:00
parent a55d3230f1
commit 63ddff6795

View File

@ -16,7 +16,7 @@
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script> #+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script> #+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
#+PROPERTY: header-args :tangle yes :results none :padline no #+PROPERTY: header-args :tangle ~/.config/doom/config.el :results none :padline no
:END: :END:
https://medium.com/urbint-engineering/emacs-doom-for-newbies-1f8038604e3b https://medium.com/urbint-engineering/emacs-doom-for-newbies-1f8038604e3b
@ -139,12 +139,17 @@ Documentation:
** Visual ** Visual
Automatic line wrap. Automatic line wrap.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(global-visual-line-mode t) (global-visual-line-mode nil)
#+end_src #+end_src
Turn off auto-fill mode that add line breaks. Turn off auto-fill mode that add line breaks.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(auto-fill-mode -1) (auto-fill-mode -1)
(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)
;; turn off auto-fill for org-mode
(add-hook 'org-mode-hook 'turn-off-auto-fill)
#+end_src #+end_src
** Change default alert backend ** Change default alert backend
@ -157,6 +162,17 @@ Turn off auto-fill mode that add line breaks.
(setq create-lockfiles nil) (setq create-lockfiles nil)
#+end_src #+end_src
** Disable highlight of current line
#+begin_src emacs-lisp
(global-hl-line-mode -1)
(add-hook 'org-mode-hook
(lambda()
(hl-line-mode -1)
(global-hl-line-mode -1))
't
)
#+end_src
* Magit * Magit
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setenv "GIT_ASKPASS" "git-gui--askpass") (setenv "GIT_ASKPASS" "git-gui--askpass")
@ -200,8 +216,10 @@ TAB was changed to toggle only the visibility state of the current subtree, rath
#+end_src #+end_src
** Org latex fragment ** Org latex fragment
Don't change the font size for subscripts and superscripts in latex fragments.
This cause the orgmode tables not to be well aligned.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq org-highlight-latex-and-related '(native)) (setq font-latex-fontify-script nil)
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -244,7 +262,7 @@ TAB was changed to toggle only the visibility state of the current subtree, rath
(let ((ov (loop for ov in (org--list-latex-overlays) (let ((ov (loop for ov in (org--list-latex-overlays)
if if
(and (and
r (<= (overlay-start ov) (point)) (<= (overlay-start ov) (point))
(>= (overlay-end ov) (point))) (>= (overlay-end ov) (point)))
return ov))) return ov)))
(when ov (when ov
@ -294,7 +312,7 @@ r (<= (overlay-start ov) (point))
** Org Tagging ** Org Tagging
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Align Tags and flush right ;; Align Tags and flush right
(setq org-tags-column -80) (setq org-tags-column -78)
;; Tags with fast selection keys ;; Tags with fast selection keys
(setq org-tag-alist (quote (("@home" . ?h) (setq org-tag-alist (quote (("@home" . ?h)
("@work" . ?w) ("@work" . ?w)
@ -790,60 +808,59 @@ Special Environments
http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode/ http://slumpy.org/blog/2017-02-01-automatic-latex-preview-in-org-mode/
#+begin_src emacs-lisp #+begin_src emacs-lisp
(map! :map org-mode-map (map! :map org-mode-map
;; Activate Automatic LaTeX fragment ;; Activate Automatic LaTeX fragment
:n ",ol" '(lambda () (interactive) (add-hook 'post-command-hook 'tdh/org-latex-fragment-toggle t)) :n ",ol" '(lambda () (interactive) (add-hook 'post-command-hook 'tdh/org-latex-fragment-toggle t))
;; ;; Disable Automatic LaTeX fragment ;; ;; Disable Automatic LaTeX fragment
:n ",oL" '(lambda () (interactive) (remove-hook 'post-command-hook 'tdh/org-latex-fragment-toggle))) :n ",oL" '(lambda () (interactive) (remove-hook 'post-command-hook 'tdh/org-latex-fragment-toggle)))
;; Use F9 to globally generate all the latex fragments ;; Use F9 to globally generate all the latex fragments
(map! :map org-mode-map :n "<f9>" (lambda () (interactive) (org-preview-latex-fragment 16))) (map! :map org-mode-map :n "<f9>" (lambda () (interactive) (org-preview-latex-fragment 16)))
;; Put all the preview images in some directory ;; Put all the preview images in some directory
(setq org-preview-latex-image-directory "~/.ltximg/") (setq org-preview-latex-image-directory "~/.ltximg/")
;; Define backends to preview LaTeX fragments ;; Define backends to preview LaTeX fragments
(setq org-preview-latex-process-alist '((imagemagick (setq org-preview-latex-process-alist '((imagemagick
:programs ("latex" "convert") :programs ("pdflatex" "convert")
:description "pdf > png" :description "pdf > png"
:message "you need to install the programs: latex and imagemagick." :message "you need to install the programs: pdflatex and imagemagick."
:image-input-type "pdf" :image-input-type "pdf"
:image-output-type "png" :image-output-type "png"
:image-size-adjust (0.6 . 0.6) :image-size-adjust (0.6 . 0.6)
:latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
:image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")) :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O"))
(pdf2svg (dvipng
:programs ("latex" "pdf2svg") :programs ("latex" "dvipng")
:description "pdf > svg" :description "dvi > png"
:message "you need to install the programs: pdflatex and pdf2svg." :message "you need to install the programs: latex and dvipng."
:image-input-type "pdf" :image-input-type "dvi"
:image-output-type "svg" :image-output-type "png"
:image-size-adjust (1.0 . 1.0) :image-size-adjust (0.5 . 0.5)
:latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f") :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
:image-converter ("pdfcrop %f %f && pdftocairo -svg %f %O")) :image-converter ("dvipng -D %D -T tight -o %O %f"))
;; :image-converter ("pdf2svg %f %O")) (dvisvgm
(dvisvgm :programs ("pdflatex" "dvisvgm")
:programs ("latex" "dvisvgm") :description "dvi > svg"
:description "dvi > svg" :message "you need to install the programs: latex and dvisvgm."
:message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi"
:image-input-type "dvi" :image-output-type "svg"
:image-output-type "svg" :image-size-adjust (0.7 . 0.7)
:image-size-adjust (0.8 . 0.8) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
:latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") :image-converter ("dvisvgm %f -n -b min -c %S -o %O"))
:image-converter ("dvisvgm %f -n -b min -c %S -o %O")) ))
))
;; Use imagemagick/dvisvgm to generate png from pdf ;; Use imagemagick/dvisvgm to generate png from pdf
(setq org-preview-latex-default-process 'dvisvgm) (setq org-preview-latex-default-process 'dvipng)
#+end_src #+end_src
*** TODO Custom Export - Add Page and Label for LaTeX export *** TODO Custom Export - Add Page and Label for LaTeX export
https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbitrary-org-property-into-an-arbitrary-string-na?rq=1 https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbitrary-org-property-into-an-arbitrary-string-na?rq=1
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(defcustom tdehaeze/org-property-mapping (defcustom tdh/org-property-mapping
'((latex ("CUSTOM_PAGE" . tdehaeze/insert-org-page-latex) '((latex ("CUSTOM_PAGE" . tdh/insert-org-page-latex)
("CUSTOM_LABEL" . tdehaeze/insert-org-label-latex))) ("CUSTOM_LABEL" . tdh/insert-org-label-latex)))
"List of mappings from org property to arbitrary strings. "List of mappings from org property to arbitrary strings.
Each element is a list: Each element is a list:
(BACKEND (PROPERTY1 . FUNCTION1) (PROPERTY2 . FUNCTION2) ...) (BACKEND (PROPERTY1 . FUNCTION1) (PROPERTY2 . FUNCTION2) ...)
@ -854,13 +871,13 @@ https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbit
#+end_src #+end_src
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(defun tdehaeze/replace-org-property (backend) (defun tdh/replace-org-property (backend)
"Convert org properties using `tdehaeze/org-property-mapping'. "Convert org properties using `tdh/org-property-mapping'.
Lookup BACKEND in `tdehaeze/org-property-mapping' for a list of Lookup BACKEND in `tdh/org-property-mapping' for a list of
(PROPERTY REPLACEMENT). For each healine being exported, if it has a (PROPERTY REPLACEMENT). For each healine being exported, if it has a
PROPERTY listed insert a string immediately after the healine given by PROPERTY listed insert a string immediately after the healine given by
(format REPLACEMENT PROPERTY-VALUE)" (format REPLACEMENT PROPERTY-VALUE)"
(let ((map (cdr (assoc backend tdehaeze/org-property-mapping))) (let ((map (cdr (assoc backend tdh/org-property-mapping)))
value replacement) value replacement)
(when map (when map
(org-map-entries (org-map-entries
@ -870,16 +887,16 @@ https://emacs.stackexchange.com/questions/156/emacs-function-to-convert-an-arbit
(when (setq value (org-entry-get (point) (car it))) (when (setq value (org-entry-get (point) (car it)))
(funcall (cdr it) value))))))))) (funcall (cdr it) value)))))))))
(add-hook 'org-export-before-processing-hook #'tdehaeze/replace-org-property) (add-hook 'org-export-before-processing-hook #'tdh/replace-org-property)
#+end_src #+end_src
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(defun tdehaeze/insert-org-label-latex (label) (defun tdh/insert-org-label-latex (label)
"Insert \"\\\\label{LABEL}\\n\" after the :PROPERTY: drawer." "Insert \"\\\\label{LABEL}\\n\" after the :PROPERTY: drawer."
(search-forward-regexp org-property-end-re) (search-forward-regexp org-property-end-re)
(forward-char 1) (forward-char 1)
(insert (format "\\label{%s}\n" label))) (insert (format "\\label{%s}\n" label)))
(defun tdehaeze/insert-org-page-latex (page) (defun tdh/insert-org-page-latex (page)
"Insert \"\\\\page{PAGE}\\n\" after the :PROPERTY: drawer." "Insert \"\\\\page{PAGE}\\n\" after the :PROPERTY: drawer."
(search-forward-regexp org-property-end-re) (search-forward-regexp org-property-end-re)
(forward-char 1) (forward-char 1)
@ -1115,28 +1132,33 @@ Ressources:
- https://www.reddit.com/r/emacs/comments/4gudyw/help_me_with_my_orgmode_workflow_for_notetaking/ - https://www.reddit.com/r/emacs/comments/4gudyw/help_me_with_my_orgmode_workflow_for_notetaking/
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Folder where the notes files are located (or file if just one Note file) (use-package! org-ref
(setq org-ref-notes-directory "~/Cloud/thesis/ressources/notes") :after org
(setq org-ref-bibliography-notes "~/Cloud/thesis/ressources/notes") :config
;; 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")
;; Bibliography File ;; Bibliography File
(setq reftex-default-bibliography '("~/Cloud/thesis/ressources/references.bib")) (setq reftex-default-bibliography '("~/Cloud/thesis/ressources/references.bib"))
(setq org-ref-default-bibliography '("~/Cloud/thesis/ressources/references.bib")) (setq org-ref-default-bibliography '("~/Cloud/thesis/ressources/references.bib"))
;; Folder where all the pdf are located ;; Folder where all the pdf are located
(setq org-ref-pdf-directory "~/Cloud/thesis/ressources/pdfs") (setq org-ref-pdf-directory "~/Cloud/thesis/ressources/pdfs")
;; Tell org-ref to let helm-bibtex find notes for it ;; Tell org-ref to let helm-bibtex find notes for it
(setq org-ref-notes-function (setq org-ref-notes-function
(lambda (thekey) (lambda (thekey)
(let ((bibtex-completion-bibliography (org-ref-find-bibliography))) (let ((bibtex-completion-bibliography (org-ref-find-bibliography)))
(bibtex-completion-edit-notes (bibtex-completion-edit-notes
(list (car (org-ref-get-bibtex-key-and-file thekey))))))) (list (car (org-ref-get-bibtex-key-and-file thekey)))))))
;; Problem with speed: don't display broken links ;; Problem with speed: don't display broken links
(setq org-ref-show-broken-links nil) (setq org-ref-show-broken-links t)
;; Display information on the citation ;; Display information on the citation
(setq org-ref-show-citation-on-enter t) (setq org-ref-show-citation-on-enter t)
(bibtex-set-dialect 'BibTeX)
)
#+end_src #+end_src
** Org Noter ** Org Noter
@ -1681,7 +1703,7 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
** General Config ** General Config
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Use "tags" field when looking for bib entries ;; Use "tags" field when looking for bib entries
(setq helm-bibtex-additional-search-fields '(keywords)) (setq helm-bibtex-additional-search-fields '(tags))
;; Display of bibtex entries with helm ;; Display of bibtex entries with helm
(setq bibtex-completion-display-formats (setq bibtex-completion-display-formats
@ -1716,7 +1738,7 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
"#+LATEX_HEADER: \\newcommand{\\refYear}{${year}}\n" "#+LATEX_HEADER: \\newcommand{\\refYear}{${year}}\n"
"#+LATEX_HEADER: \\newcommand{\\refDoi}{${DOI}}\n" "#+LATEX_HEADER: \\newcommand{\\refDoi}{${DOI}}\n"
"#+LATEX_HEADER: \\newcommand{\\refUrl}{${url}}\n" "#+LATEX_HEADER: \\newcommand{\\refUrl}{${url}}\n"
"#+LATEX_HEADER: \\newcommand{\\refKeywords}{${keywords}}\n" "#+LATEX_HEADER: \\newcommand{\\refKeywords}{${tags}}\n"
"#+LATEX_HEADER: \\input{config.tex}\n" "#+LATEX_HEADER: \\input{config.tex}\n"
"#+LATEX_HEADER: \\graphicspath{{./figs/${=key=}/}}\n" "#+LATEX_HEADER: \\graphicspath{{./figs/${=key=}/}}\n"
"# #+TOC: headlines 2\n" "# #+TOC: headlines 2\n"
@ -1744,8 +1766,7 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
;; Make "Edit notes" the default action ;; Make "Edit notes" the default action
(after! helm-bibtex (after! helm-bibtex
(helm-delete-action-from-source "Edit notes" helm-source-bibtex) (helm-delete-action-from-source "Edit notes" helm-source-bibtex)
(helm-add-action-to-source "Edit notes" 'helm-bibtex-edit-notes helm-source-bibtex 0) (helm-add-action-to-source "Edit notes" 'helm-bibtex-edit-notes helm-source-bibtex 0))
)
#+end_src #+end_src
** Open pdf externally ** Open pdf externally
@ -1756,8 +1777,7 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
;; Action to open the pdf with Zathura ;; Action to open the pdf with Zathura
(after! helm-bibtex (after! helm-bibtex
(helm-delete-action-from-source "Open PDF Externally" helm-source-bibtex) (helm-delete-action-from-source "Open PDF Externally" helm-source-bibtex)
(helm-add-action-to-source "Open PDF Externally" 'tdehaeze/open-pdf-externally helm-source-bibtex 1) (helm-add-action-to-source "Open PDF Externally" 'tdehaeze/open-pdf-externally helm-source-bibtex 1))
)
#+end_src #+end_src
** Special Commands ** Special Commands
@ -2147,12 +2167,12 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
** Open ranger in current directory ** Open ranger in current directory
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun 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 "termite --directory=" default-directory " --exec=ranger") nil 0))
(map! :map org-mode-map :n ",oo" 'open-ranger-in-workdir) (map! :map org-mode-map :n ",oo" 'tdh/open-ranger-in-workdir)
#+end_src #+end_src
* Yassnippets * Yassnippets
@ -2161,12 +2181,6 @@ Check [[https://github.com/djcb/mu/issues/179][here]].
(yas-global-mode 1) (yas-global-mode 1)
#+end_src #+end_src
* Path for Shell
#+begin_src emacs-lisp
;; (when (memq window-system '(mac ns x))
;; (exec-path-from-shell-initialize))
#+end_src
* Proxy * Proxy
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(setq url-proxy-services (setq url-proxy-services
@ -2273,7 +2287,6 @@ they are implemented.
:ui :ui
doom ; what makes DOOM look the way it does doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
hydra hydra
modeline ; snazzy, Atom-inspired modeline, plus API modeline ; snazzy, Atom-inspired modeline, plus API
@ -2306,17 +2319,13 @@ they are implemented.
:tools :tools
debugger ; FIXME stepping through code, to help you add bugs debugger ; FIXME stepping through code, to help you add bugs
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls) (eval +overlay) ; run code, run (also, repls)
(lookup ; helps you navigate your code and documentation (lookup ; helps you navigate your code and documentation
+docsets) ; ...or in Dash docsets locally +docsets) ; ...or in Dash docsets locally
;;lsp ;;lsp
magit ; a git porcelain for Emacs magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds ;;pass ; password manager for nerds
pdf ; pdf enhancements pdf ; pdf enhancements
;;rgb ; creating color strings
;;upload ; map local to remote projects via ssh/ftp
:checkers :checkers
syntax ; tasing you for every semicolon you forget syntax ; tasing you for every semicolon you forget
@ -2325,21 +2334,15 @@ they are implemented.
:lang :lang
data ; config/data formats data ; config/data formats
emacs-lisp ; drown in parentheses emacs-lisp ; drown in parentheses
;;ess ; emacs speaks statistics
;;go ; the hipster dialect
;;(haskell +dante) ; a language that's lazier than I am
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
latex ; writing papers in Emacs has never been so fun latex ; writing papers in Emacs has never been so fun
markdown ; writing docs for people to ignore markdown ; writing docs for people to ignore
(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
+journal ; +journal ;
;;+pomodoro ; be fruitful with the tomato technique
+present) ; using org-mode for presentations +present) ; using org-mode for presentations
;;python ; beautiful is better than ugly ;;python ; beautiful is better than ugly
sh ; she sells {ba,z,fi}sh shells on the C xor sh ; she sells {ba,z,fi}sh shells on the C xor
;;web ; the tubes
:email :email
;;(mu4e +gmail) ;;(mu4e +gmail)