Huge Update - Change all ressources directory

This commit is contained in:
Thomas Dehaeze 2020-04-16 15:55:36 +02:00
parent b8405753c0
commit 97c28fcffa

View File

@ -82,7 +82,8 @@ Documentation:
| C-c C-v h | org-babel-describe-bindings |
| C-c C-v x | org-babel-do-key-sequence-in-edit-buffer |
* Personal Information
* Basic Configuration
** Personal Information
#+begin_src emacs-lisp
;; These are used for a number of things, particularly for GPG configuration,
;; some email clients, file templates and snippets.
@ -90,7 +91,7 @@ Documentation:
user-mail-address "dehaeze.thomas@gmail.com")
#+end_src
* Doom Config
** Doom Config
#+begin_src emacs-lisp
(setq doom-font (font-spec :family "Hack Nerd Font Mono" :size 12 :weight 'semi-light)
doom-variable-pitch-font (font-spec :family "Hack Nerd Font Mono")
@ -106,7 +107,7 @@ Documentation:
(setq display-line-numbers-type t)
#+end_src
* Evil
** Evil
#+begin_src emacs-lisp
(after! evil
(map! :m "-" #'dired-jump))
@ -125,7 +126,7 @@ Make horizontal movement cross lines
(setq-default evil-cross-lines t)
#+end_src
* Which Key
** Which Key
#+begin_src emacs-lisp
(after! which-key
(setq which-key-idle-delay 0.5
@ -133,7 +134,6 @@ Make horizontal movement cross lines
which-key-sort-order 'which-key-key-order-alpha))
#+end_src
* Basic
** Visual
Automatic line wrap.
#+begin_src emacs-lisp
@ -181,13 +181,27 @@ Turn off auto-fill mode that add line breaks.
"C-i" #'better-jumper-jump-forward))
#+end_src
* Magit
** Magit
#+begin_src emacs-lisp
(setenv "GIT_ASKPASS" "git-gui--askpass")
(setq magit-diff-refine-hunk 'all)
#+end_src
** PDF-Tools
#+begin_src emacs-lisp
(use-package! pdf-tools
:config
(add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1)))
)
#+end_src
** Yassnippets
#+begin_src emacs-lisp
(push "~/.config/doom/snippets" yas-snippet-dirs)
(yas-global-mode 1)
#+end_src
* Org Mode
- http://cachestocaches.com/2016/9/my-workflow-org-agenda/
- http://doc.norang.ca/org-mode.html#TodoKeywords
@ -239,9 +253,9 @@ Display the real size of images and not the one set with =attr_latex: :width \li
(map! :map org-mode-map "C-c l" 'org-store-link)
(setq org-link-abbrev-alist
'(("bib" . "~/Cloud/thesis/ressources/references.bib::%s")
("notes" . "~/Cloud/thesis/ressources/notes/notes.org::#%s")
("papers" . "~/Cloud/thesis/ressources/pdfs/%s.pdf")))
'(("bib" . "~/Cloud/brain/references.bib::%s")
("notes" . "~/Cloud/brain/%s.org")
("papers" . "~/Cloud/pdfs/%s.pdf")))
)
#+end_src
@ -296,8 +310,9 @@ Display the real size of images and not the one set with =attr_latex: :width \li
)
#+end_src
** Archive subtrees under the same hierarchy as original in the archive files
** Org Archive
https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
Archive subtrees under the same hierarchy as original in the archive files
#+begin_src emacs-lisp
(after! org
@ -347,7 +362,7 @@ https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
#+end_src
** Org Agenda
*** General configuration
General configuration
#+begin_src emacs-lisp
(after! org
(map! :map org-mode-map "C-c a" 'org-agenda)
@ -380,9 +395,7 @@ https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
)
#+end_src
*** Org Agenda Custom Views
https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
Org Agenda Custom Views
#+begin_src emacs-lisp
(after! org-agenda
(defun tdh-org-agenda-skip-scheduled ()
@ -442,7 +455,7 @@ https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
(level 1)
(not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis")))
((org-ql-block-header "Other Things"))))
((org-agenda-files '("~/Cloud/thesis/ressources/notes/"))))
((org-agenda-files '("~/Cloud/brain/"))))
("r" "Articles and Books to read"
((org-ql-block '(and (todo "READ")
(level 1)
@ -460,7 +473,7 @@ https://blog.aaronbieber.com/2016/09/24/an-agenda-for-life-with-org-mode.html
(level 1)
(not (tags "article" "inproceedings" "techreport" "inbook" "book" "phdthesis")))
((org-ql-block-header "Other Things to Read"))))
((org-agenda-files '("~/Cloud/thesis/ressources/notes/")))))
((org-agenda-files '("~/Cloud/brain/")))))
)
)
#+end_src
@ -539,51 +552,51 @@ Documentation:
#+begin_src emacs-lisp
(after! org
(setq org-capture-templates
(quote (("t" ; key
"todo" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Inbox") ; target
"** TODO %?\n%U\n" ; template
)
("M" ; key
"Meeting" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Meetings") ; target
"** %?\n%(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n" ; template
)
("m" ; key
"mail" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Mails") ; target
"** TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n" ; template
)
("pm"
"Org-Protocol Mail"
entry
(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"
:immediate-finish t
)
("pu"
"Org-Protocol Url"
entry
(file+headline "~/Cloud/org/work-notebook.org" "Inbox")
"* [[%:link][%:description]]\nCaptured On: %U\n\n"
:immediate-finish t
)
("pt"
"Org-Protocol text"
entry
(file+headline "~/Cloud/org/work-notebook.org" "Inbox")
"* %:description\nSource: %:link\nCaptured On: %U\n\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n"
:immediate-finish t
)
)))
)
(quote (("t" ; key
"todo" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Inbox") ; target
"** TODO %?\n%U\n" ; template
)
("M" ; key
"Meeting" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Meetings") ; target
"** %?\n%(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n" ; template
)
("m" ; key
"mail" ; name
entry ; type
(file+headline "~/Cloud/org/work-notebook.org" "Mails") ; target
"** TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n" ; template
)
("pm"
"Org-Protocol Mail"
entry
(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"
:immediate-finish t
)
("pu"
"Org-Protocol Url"
entry
(file+headline "~/Cloud/org/work-notebook.org" "Inbox")
"* [[%:link][%:description]]\nCaptured On: %U\n\n"
:immediate-finish t
)
("pt"
"Org-Protocol text"
entry
(file+headline "~/Cloud/org/work-notebook.org" "Inbox")
"* %:description\nSource: %:link\nCaptured On: %U\n\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n"
:immediate-finish t
)
)))
)
#+end_src
** Org Export
*** Basic
Basic configuration:
#+begin_src emacs-lisp
(after! org
;; How many levels of headline to export
@ -597,7 +610,7 @@ Documentation:
)
#+end_src
*** Defaults
Some defaults:
#+begin_src emacs-lisp
(after! org
(setq org-export-with-author t)
@ -610,7 +623,7 @@ Documentation:
)
#+end_src
*** Do not export headline with the =:ignore:= tag
Do not export headline with the =:ignore:= tag:
#+begin_src emacs-lisp
;; Used to not export headings with :ignore: tag
(after! org
@ -1167,127 +1180,6 @@ https://www.reddit.com/r/orgmode/comments/7u2n0h/tip_for_defining_latex_macros_f
#+end_src
** Org Ref
Ressources:
- https://github.com/tmalsburg/helm-bibtex
- https://github.com/jkitchin/org-ref
- https://www.reddit.com/r/emacs/comments/4gudyw/help_me_with_my_orgmode_workflow_for_notetaking/
Nice Functions:
- =org-ref-insert-ref-link=
- =org-ref-helm-insert-cite-link=
- =org-ref-list-of-figures=
- =org-ref-find-bad-citations=
- =org-ref-clean-bibtex-entry=
#+begin_src emacs-lisp
(use-package! org-ref
:after org
:init
: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
(setq reftex-default-bibliography '("~/Cloud/thesis/ressources/references.bib"))
(setq org-ref-default-bibliography '("~/Cloud/thesis/ressources/references.bib"))
;; Folder where all the pdf are located
(setq org-ref-pdf-directory "~/Cloud/thesis/ressources/pdfs")
;; Tell org-ref to let helm-bibtex find notes for it
(setq org-ref-notes-function
(lambda (thekey)
(let ((bibtex-completion-bibliography (org-ref-find-bibliography)))
(bibtex-completion-edit-notes
(list (car (org-ref-get-bibtex-key-and-file thekey)))))))
;; Problem with speed: don't display broken links
(setq org-ref-show-broken-links t)
;; 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
'("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)
(map!
:map org-mode-map
(:desc "Insert Link"
:ni "C-c i" #'org-ref-insert-ref-link))
)
#+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."
(interactive)
(let* ((results (org-ref-get-bibtex-key-and-file))
(key (car results))
(pdf-file (funcall org-ref-get-pdf-filename-function key)))
(if (file-exists-p pdf-file)
(call-process "zathura" nil 0 nil pdf-file)
(message "no pdf found for %s" key))))
#+end_src
** Org Noter
- https://github.com/weirdNox/org-noter
#+begin_src emacs-lisp
(use-package! org-noter
:defer t
:after (:any org pdf-view)
:config
(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
(setq org-noter-doc-split-fraction '(0.6 . 0.6))
;; Save the last visited location automatically; when starting a new session, go to that location
(setq org-noter-auto-save-last-location nil)
;; Add an empty line between each note's heading and content
(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")
(defun org-noter-init-pdf-view ()
(pdf-view-fit-page-to-window)
(pdf-view-auto-slice-minor-mode)
(run-at-time "0.5 sec" nil #'org-noter))
(add-hook 'pdf-view-mode-hook 'org-noter-init-pdf-view)
(map!
:map pdf-view-mode-map
(:desc "Insert Note"
:n "i" #'org-noter-insert-note))
)
#+end_src
** Org Roam
#+begin_src emacs-lisp
(use-package! org-roam
:config
(setq org-roam-directory "~/Cloud/org-roam/")
(setq org-roam-completion-system 'helm)
)
#+end_src
** TODO Org Projects
#+begin_src emacs-lisp :tangle no
(setq org-publish-project-alist
@ -1314,21 +1206,6 @@ Nice Functions:
:with-todo-keywords nil
:html-wrap-src-lines nil
:table-of-contents nil)
("bibliography"
:base-directory "~/Cloud/thesis/ressources/notes/"
:base-extension "org"
:publishing-directory "~/Cloud/thesis/ressources/docs/"
:author "Dehaeze Thomas"
:email "dehaeze.thomas@gmail.com/"
:recursive nil
:publishing-function org-html-publish-to-html
:auto-preamble t
:auto-sitemap t
:html-link-up "index.html"
:html-link-home "index.html"
:with-todo-keywords nil
:html-wrap-src-lines nil
:table-of-contents nil)
("nass-simscape"
:base-directory "~/Cloud/thesis/matlab/nass-simscape/org/"
:base-extension "org"
@ -1548,7 +1425,7 @@ Insert Link to paper
(defun tdh-insert-paper-org-link (paper)
"Insert an org link to some paper, choosing the file with completion"
(interactive
(list (read-file-name "Paper: " "~/Cloud/thesis/ressources/pdfs/" nil t)))
(list (read-file-name "Paper: " "~/Cloud/pdfs/" nil t)))
(insert (format "[[papers:%s]]" (file-name-base paper))))
#+end_src
@ -1557,7 +1434,7 @@ Insert Link to notes
(defun tdh-insert-note-org-link (note)
"Insert an org link to some note, choosing the file with completion"
(interactive
(list (read-file-name "Note: " "~/Cloud/thesis/ressources/pdfs/" nil t)))
(list (read-file-name "Note: " "~/Cloud/pdfs/" nil t)))
(insert (format "[[notes:%s]]" (file-name-base note))))
#+end_src
@ -1703,6 +1580,7 @@ Map Keys
(map! :map org-mode-map
(:prefix (",r" . "References")
:n "b" 'helm-bibtex
:n "B" 'helm-bibtex-with-local-bibliography
:n "f" 'helm-bibtex-favorites
:n "r" 'helm-resume)))
#+end_src
@ -1787,7 +1665,7 @@ Use the current window for C-c ' source editing
#+end_src
** Library of Babel
Add all named source blocks to =org-babel-library-of-babel=.
Add all named source blocks to =org-babel-library-of-babel= ([[file:emacs-library-babel.org][link]]).
#+begin_src emacs-lisp
(after! org
@ -2095,6 +1973,251 @@ Map Functions
:n "T" 'tdh-org-babel-tangle-subtree)))
#+end_src
* Bibliography Management
My bibliography management is mainly based on the following packages:
- =org-ref= for nice citations
- =org-noter= to annotate documents
- =org-roam= to manage and links all my notes
- =helm-bibtex= as an interface to easily find references
- =org-roam-bibtex= that connects all the above packages
** Org Ref ([[https://github.com/jkitchin/org-ref][link]])
Nice Functions:
- =org-ref-insert-ref-link=
- =org-ref-helm-insert-cite-link=
- =org-ref-list-of-figures=
- =org-ref-find-bad-citations=
- =org-ref-clean-bibtex-entry=
#+begin_src emacs-lisp
(use-package! org-ref
:after org
: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")
;; Bibliography File
(setq reftex-default-bibliography '("~/Cloud/brain/references.bib"))
(setq org-ref-default-bibliography '("~/Cloud/brain/references.bib"))
;; Folder where all the pdf are located
(setq org-ref-pdf-directory "~/Cloud/pdfs")
;; Tell org-ref to let helm-bibtex find notes for it
(setq org-ref-notes-function
(lambda (thekey)
(let ((bibtex-completion-bibliography (org-ref-find-bibliography)))
(bibtex-completion-edit-notes
(list (car (org-ref-get-bibtex-key-and-file thekey)))))))
;; Problem with speed: don't display broken links
(setq org-ref-show-broken-links t)
;; 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
'("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)
(map!
:map org-mode-map
(:desc "Insert Link"
:ni "C-c i" #'org-ref-insert-ref-link))
)
#+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."
(interactive)
(let* ((results (org-ref-get-bibtex-key-and-file))
(key (car results))
(pdf-file (funcall org-ref-get-pdf-filename-function key)))
(if (file-exists-p pdf-file)
(call-process "zathura" nil 0 nil pdf-file)
(message "no pdf found for %s" key))))
#+end_src
** Org Noter ([[https://github.com/weirdNox/org-noter][link]])
#+begin_src emacs-lisp
(use-package! org-noter
:defer t
:after (:any org pdf-view)
:config
(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
(setq org-noter-doc-split-fraction '(0.6 . 0.6))
;; Save the last visited location automatically; when starting a new session, go to that location
(setq org-noter-auto-save-last-location nil)
;; Add an empty line between each note's heading and content
(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/brain")
(defun org-noter-init-pdf-view ()
(pdf-view-fit-page-to-window)
(pdf-view-auto-slice-minor-mode)
(run-at-time "0.5 sec" nil #'org-noter))
(add-hook 'pdf-view-mode-hook 'org-noter-init-pdf-view)
(map!
:map pdf-view-mode-map
(:desc "Insert Note"
:n "i" #'org-noter-insert-note))
)
#+end_src
** Org Roam ([[https://github.com/jethrokuan/org-roam/][link]])
#+begin_src emacs-lisp
(use-package! org-roam
:config
(setq org-roam-directory "~/Cloud/brain/")
(setq org-roam-completion-system 'helm)
(setq org-roam-capture-templates
`(("d" "default" plain (function org-roam--capture-get-point)
"%?"
:file-name "${slug}"
:head ,(concat "#+TITLE: ${title}\n"
"#+SETUPFILE ./org-roam-setup-file.org\n"
"\n"
"- Tags ::\n"
"\n")
:unnarrowed t)))
)
#+end_src
** Helm-Bibtex ([[https://github.com/tmalsburg/helm-bibtex][link]])
#+begin_src emacs-lisp
(use-package! helm-bibtex
:init
:config
;; Bibliography file
(setq bibtex-completion-bibliography "~/Cloud/brain/references.bib")
;; Directory with all the pdfs
(setq bibtex-completion-library-path "~/Cloud/pdfs")
;; Directory with notes files
(setq bibtex-completion-notes-path "~/Cloud/brain/")
(setq bibtex-completion-notes-extension ".org")
(setq bibtex-completion-pdf-extension '(".pdf" ".djvu"))
;; Use "tags" field when looking for bib entries
(setq helm-bibtex-additional-search-fields '(tags))
(setq helm-bibtex-full-frame nil)
;; Display of bibtex entries with helm
(setq bibtex-completion-display-formats
'((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}")))
;; Special symbols for notes and pdf
(setq bibtex-completion-pdf-symbol "⌘")
(setq bibtex-completion-notes-symbol "✎")
;; Template used when creating new Note file
(setq bibtex-completion-notes-template-multiple-files (concat "#+TITLE: ${title}\n"
"#+NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
"#+ROAM_KEY: cite:${=key=}\n"
"\n"
"- Author :: ${author}\n"
"- Year :: ${year}\n"
"- DOI :: ${DOI}\n"
"\n"))
;; Make "Edit notes" the default action
(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-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)
)
#+end_src
Open pdf externally
#+begin_src emacs-lisp
(defun tdehaeze/open-pdf-externally (key)
(call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key)))))
#+end_src
Special Commands
#+begin_src emacs-lisp
(defun helm-bibtex-favorites (&optional arg)
"Search Favorite BibTeX entries"
(interactive "P")
(helm-bibtex arg nil "favorite "))
#+end_src
List all element of the bibliography without pdf associated
#+begin_src emacs-lisp
(defun tdh-list-bib-without-pdf-associated ()
(interactive)
(bibtex-completion-init)
(setq candidates (bibtex-completion-candidates))
(defun canditate-is-pdf-present (candidate)
(bibtex-completion-find-pdf-in-library (cdr (assoc "=key=" candidate)))
)
(setq candidates-without-pdf (remove-if #'canditate-is-pdf-present candidates))
(setq candidate-without-pdf-names (mapcar
(lambda (x) (cdr (assoc "title" x)))
candidates-without-pdf))
(with-output-to-temp-buffer "*bib-without-pdf*" (princ (string-join candidate-without-pdf-names "\n")))
(switch-to-buffer-other-window "*bib-without-pdf*")
)
#+end_src
** Org-Roam-Bibtex ([[https://github.com/Zaeph/org-roam-bibtex][link]])
#+begin_src emacs-lisp
(use-package! org-roam-bibtex
:load-path "~/.config/doom/packages/org-roam-bibtex/"
:config
(org-roam-bibtex-mode)
(setq org-roam-bibtex-preformat-keywords `("=key=" "title" "author" "year"))
(setq org-roam-bibtex-template
`(("r" "ref" plain (function org-roam-capture--get-point) ""
:file-name "${=key=}"
:head ,(concat "#+TITLE: ${title}\n"
"#+SETUPFILE ./org-notes-setup-file.org\n"
"#+ROAM_KEY: ${ref}\n"
"\n"
"- Tags :: %?\n"
"- Author(s) :: ${author}\n"
"- Year :: ${year}\n"
"\n"
"* Notes :ignore:\n"
":PROPERTIES:\n"
":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
":END:\n")
:unnarrowed t)))
)
#+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,142 +2262,6 @@ Map Functions
(bibtex-set-dialect 'BibTeX))
#+end_src
* Helm-Bibtex
** General Config
#+begin_src emacs-lisp
(use-package! helm-bibtex
:init
:config
;; Bibliography file
(setq bibtex-completion-bibliography "~/Cloud/thesis/ressources/references.bib")
;; Directory with all the pdfs
(setq bibtex-completion-library-path "~/Cloud/thesis/ressources/pdfs")
;; Directory with notes files
(setq bibtex-completion-notes-path "~/Cloud/thesis/ressources/notes/notes.org")
(setq bibtex-completion-notes-extension ".org")
(setq bibtex-completion-pdf-extension '(".pdf" ".djvu"))
;; Use "tags" field when looking for bib entries
(setq helm-bibtex-additional-search-fields '(tags))
(setq helm-bibtex-full-frame nil)
;; Display of bibtex entries with helm
(setq bibtex-completion-display-formats
'((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}")))
;; Special symbols for notes and pdf
(setq bibtex-completion-pdf-symbol "⌘")
(setq bibtex-completion-notes-symbol "✎")
;; Template used when creating new Note file
(setq bibtex-completion-notes-template-multiple-files (concat "#+TITLE: ${title}\n"
":DRAWER:\n"
"#+LATEX_CLASS: biblioreport\n"
"\n"
"#+OPTIONS: toc:nil title:nil\n"
"#+OPTIONS: ':t -:t\n"
"\n"
"#+LATEX_HEADER: \\newcommand{\\refType}{${=type=}}\n"
"#+LATEX_HEADER: \\newcommand{\\refKey}{${=key=}}\n"
"#+LATEX_HEADER: \\newcommand{\\refTitle}{${title}}\n"
"#+LATEX_HEADER: \\newcommand{\\refAuthor}{${author-or-editor}}\n"
"#+LATEX_HEADER: \\newcommand{\\refJournal}{${journal}}\n"
"#+LATEX_HEADER: \\newcommand{\\refYear}{${year}}\n"
"#+LATEX_HEADER: \\newcommand{\\refDoi}{${DOI}}\n"
"#+LATEX_HEADER: \\newcommand{\\refUrl}{${url}}\n"
"#+LATEX_HEADER: \\newcommand{\\refKeywords}{${tags}}\n"
"#+LATEX_HEADER: \\input{config.tex}\n"
"#+LATEX_HEADER: \\graphicspath{{./figs/${=key=}/}}\n"
"# #+TOC: headlines 2\n"
":END:\n"
"\n"
"#+BEGIN_abstract\n"
"\n"
"#+END_abstract\n"
"\n"
"* ${title} :${=type=}:ignore:\n"
":PROPERTIES:\n"
":CUSTOM_ID: ${=key=}\n"
":AUTHOR: ${author}\n"
":TYPE: ${=type=}\n"
":JOURNAL: ${journal}\n"
":YEAR: ${year}\n"
":VOLUME: ${volume}\n"
":PAGES: ${pages}\n"
":DOI: ${DOI}\n"
":URL: ${url}\n"
":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
":END:\n"
"\n"))
(setq bibtex-completion-notes-template-one-file (concat "\n"
"* ${author-abbrev} (${year}): ${title} :${=type=}:ignore:\n"
":PROPERTIES:\n"
":CUSTOM_ID: ${=key=}\n"
":EXPORT_FILE_NAME: ${=key=}\n"
":EXPORT_TITLE: ${title}\n"
":AUTHOR: ${author}\n"
":TYPE: ${=type=}\n"
":JOURNAL: ${journal}\n"
":YEAR: ${year}\n"
":VOLUME: ${volume}\n"
":PAGES: ${pages}\n"
":DOI: ${DOI}\n"
":URL: ${url}\n"
":NOTER_DOCUMENT: ../pdfs/${=key=}.pdf\n"
":END:\n"
"\n"))
;; Make "Edit notes" the default action
(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-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)
)
#+end_src
** Open pdf externally
#+begin_src emacs-lisp
(defun tdehaeze/open-pdf-externally (key)
(call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key)))))
#+end_src
** Special Commands
#+begin_src emacs-lisp
(defun helm-bibtex-favorites (&optional arg)
"Search Favorite BibTeX entries"
(interactive "P")
(helm-bibtex arg nil "favorite "))
#+end_src
** List all element of the bibliography without pdf associated
#+begin_src emacs-lisp
(defun tdh-list-bib-without-pdf-associated ()
(interactive)
(bibtex-completion-init)
(setq candidates (bibtex-completion-candidates))
(defun canditate-is-pdf-present (candidate)
(bibtex-completion-find-pdf-in-library (cdr (assoc "=key=" candidate)))
)
(setq candidates-without-pdf (remove-if #'canditate-is-pdf-present candidates))
(setq candidate-without-pdf-names (mapcar
(lambda (x) (cdr (assoc "title" x)))
candidates-without-pdf))
(with-output-to-temp-buffer "*bib-without-pdf*" (princ (string-join candidate-without-pdf-names "\n")))
(switch-to-buffer-other-window "*bib-without-pdf*")
)
#+end_src
* Matlab
- https://sourceforge.net/projects/matlab-emacs/
@ -2362,7 +2349,7 @@ Map Functions
* Mu4e
** Ressources
** Resources
Documentation:
- [ ] Mu4e documentation: http://www.djcbsoftware.nl/code/mu/mu4e/index.html#Top
- [ ] https://github.com/djcb/mu
@ -2553,20 +2540,6 @@ Choose account label to feed msmtp -a option based on From header in Message buf
)
#+end_src
* PDF-Tools
#+begin_src emacs-lisp
(use-package! pdf-tools
:config
(add-hook 'pdf-view-mode-hook (lambda() (linum-mode -1)))
)
#+end_src
* Yassnippets
#+begin_src emacs-lisp
(push "~/.config/doom/snippets" yas-snippet-dirs)
(yas-global-mode 1)
#+end_src
* Doom =init.el=
:PROPERTIES:
:header-args: :tangle ~/.config/doom/init.el