Use =use-package= instead of =after=

This commit is contained in:
Thomas Dehaeze 2020-02-14 16:08:11 +01:00
parent ed7ac9bf25
commit c5a22c5585

View File

@ -430,9 +430,9 @@ https://gist.github.com/Fuco1/e86fb5e0a5bb71ceafccedb5ca22fcfb
(setq org-default-priority ?C) (setq org-default-priority ?C)
;; Set colours for priorities ;; Set colours for priorities
(setq org-priority-faces '((?A . (:foreground "#CC241D")) (setq org-priority-faces '((?A . (:foreground "#FB4934"))
(?B . (:foreground "#D65D0E")) (?B . (:foreground "#FABD2F"))
(?C . (:foreground "#D79921")))) (?C . (:foreground "#98971A"))))
;; Open agenda in current window ;; Open agenda in current window
(setq org-agenda-window-setup 'current-window) (setq org-agenda-window-setup 'current-window)
@ -1154,38 +1154,43 @@ 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
(after! org-ref (use-package! org-ref
;; Folder where the notes files are located (or file if just one Note file) :after org
(setq org-ref-notes-directory "~/Cloud/thesis/ressources/notes") :init
(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 t) (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
- https://github.com/weirdNox/org-noter - https://github.com/weirdNox/org-noter
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org-noter (use-package! org-noter
:after org
:init
:config
(setq org-noter-always-create-frame nil) (setq org-noter-always-create-frame nil)
(setq org-noter-kill-frame-at-session-end nil) (setq org-noter-kill-frame-at-session-end nil)
;; Fraction of the frame that the document window will occupy when split ;; Fraction of the frame that the document window will occupy when split
@ -1417,31 +1422,24 @@ when inside a source block. Otherwise, keep the normal behavior for ctrl-ent.
(defun tdh/ctrl-ret () (defun tdh/ctrl-ret ()
(interactive) (interactive)
(defun in-src-block-p () (defun in-src-block-p ()
"Returns t when the point is inside a source code block" "Returns t when the point is inside a source code block"
(string= "src" (org-in-block-p '("src")))) (string= "src" (org-in-block-p '("src"))))
(defun in-src-block-function () (defun in-src-block-function ()
"Function to do when inside the src block" "Function to do when inside the src block"
(progn (progn
(org-babel-execute-src-block) (org-babel-execute-src-block)
(org-babel-next-src-block))) (org-babel-next-src-block)))
(if (in-src-block-p) (if (in-src-block-p)
(in-src-block-function) (in-src-block-function)
(+org--insert-item 'below))) (+org--insert-item 'below)))
(after! org (map! :after evil-org
(map! :map evil-org-mode-map :map evil-org-mode-map
:n "<C-return>" #'tdh/ctrl-ret)) :n "<C-return>" #'tdh/ctrl-ret)
#+end_src #+end_src
#+begin_src emacs-lisp
;; (evil-define-minor-mode-key 'normal 'org-src-mode "q" 'org-edit-src-exit)
#+end_src
Remap =C-c C-c=:
https://emacs.stackexchange.com/questions/22430/rebind-org-babel-execute-src-block-maybe-to-c-c-c-c/22530#22530
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun tdh/ctrl-shit-ret () (defun tdh/ctrl-shit-ret ()
(interactive) (interactive)
@ -1453,11 +1451,14 @@ https://emacs.stackexchange.com/questions/22430/rebind-org-babel-execute-src-blo
(tdh/org-babel-execute-goto-next) (tdh/org-babel-execute-goto-next)
(+org/insert-item-above))) (+org/insert-item-above)))
(after! org (map! :after evil-org
(map! :map evil-org-mode-map :map evil-org-mode-map
:n "<C-S-return>" #'tdh/ctrl-shit-ret)) :n "<C-S-return>" #'tdh/ctrl-shit-ret)
#+end_src #+end_src
Remap =C-c C-c=:
https://emacs.stackexchange.com/questions/22430/rebind-org-babel-execute-src-block-maybe-to-c-c-c-c/22530#22530
** Org-Babel Matlab ** Org-Babel Matlab
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org (after! org
@ -1672,7 +1673,6 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
#+end_src #+end_src
*** Map Custom functions *** Map Custom functions
#+begin_src emacs-lisp #+begin_src emacs-lisp
(after! org (after! org
(map! :map org-mode-map :n ",bT" 'tdh/org-babel-tangle-subtree) (map! :map org-mode-map :n ",bT" 'tdh/org-babel-tangle-subtree)
@ -1706,7 +1706,7 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
(setq-default TeX-master nil) (setq-default TeX-master nil)
#+end_src #+end_src
** Pdf Viewer ** PDF Viewer
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq TeX-view-program-selection '((output-pdf "Zathura"))) (setq TeX-view-program-selection '((output-pdf "Zathura")))
(setq TeX-source-correlate-mode t) (setq TeX-source-correlate-mode t)
@ -1716,85 +1716,94 @@ Actually this tangle the file and then go to the file. Maybe I would like to ign
'(("PDF Tools" TeX-pdf-tools-sync-view))) '(("PDF Tools" TeX-pdf-tools-sync-view)))
#+end_src #+end_src
** Bibtex
#+begin_src emacs-lisp
(after! bibtex
(bibtex-set-dialect 'BibTeX))
#+end_src
* Helm-Bibtex * Helm-Bibtex
** General Config ** General Config
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Use "tags" field when looking for bib entries (use-package! helm-bibtex
(setq helm-bibtex-additional-search-fields '(tags)) :init
:config
;; Bibliography file
(setq bibtex-completion-bibliography "~/Cloud/thesis/ressources/references.bib")
;; Display of bibtex entries with helm ;; Directory with all the pdfs
(setq bibtex-completion-display-formats (setq bibtex-completion-library-path "~/Cloud/thesis/ressources/pdfs")
'((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}")))
;; Special symbols for notes and pdf ;; Directory with notes files
(setq bibtex-completion-pdf-symbol "⌘") (setq bibtex-completion-notes-path "~/Cloud/thesis/ressources/notes")
(setq bibtex-completion-notes-symbol "✎")
;; Bibliography file ;; Use "tags" field when looking for bib entries
(setq bibtex-completion-bibliography "~/Cloud/thesis/ressources/references.bib") (setq helm-bibtex-additional-search-fields '(tags))
;; Directory with all the pdfs (setq helm-bibtex-full-frame nil)
(setq bibtex-completion-library-path "~/Cloud/thesis/ressources/pdfs")
;; Directory with notes files ;; Display of bibtex entries with helm
(setq bibtex-completion-notes-path "~/Cloud/thesis/ressources/notes") (setq bibtex-completion-display-formats
'((t . "${author:36} ${title:*} ${year:4} ${=type=:7} ${=has-note=:1}")))
;; Template used when creating new Note file ;; Special symbols for notes and pdf
(setq bibtex-completion-notes-template-multiple-files (concat "#+TITLE: ${title}\n" (setq bibtex-completion-pdf-symbol "⌘")
":DRAWER:\n" (setq bibtex-completion-notes-symbol "✎")
"#+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} :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"))
;; Make "Edit notes" the default action ;; Template used when creating new Note file
(after! helm-bibtex (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} :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"))
;; Make "Edit notes" the default action
(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)
(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 #+end_src
** Open pdf externally ** Open pdf externally
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Action to open the pdf with Zathura
(defun tdehaeze/open-pdf-externally (key) (defun tdehaeze/open-pdf-externally (key)
(call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key))))) (call-process "zathura" nil 0 nil (nth 0 (-cons-to-list (bibtex-completion-find-pdf key)))))
;; Action to open the pdf with Zathura
(after! helm-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))
#+end_src #+end_src
** Special Commands ** Special Commands
@ -2279,81 +2288,87 @@ they are implemented.
:END: :END:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(doom! :completion (when noninteractive
company ; the ultimate code completion backend (after! undo-tree
helm ; the *other* search engine for love and life (global-undo-tree-mode -1)))
ivy ; a search engine for love and life
:ui (doom! :completion
doom ; what makes DOOM look the way it does company ; the ultimate code completion backend
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW helm ; the *other* search engine for love and life
hydra ivy ; a search engine for love and life
modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping
ophints ; highlight the region an operation acts on
(popup ; tame sudden yet inevitable temporary windows
+all ; catch all popups that start with an asterix
+defaults) ; default popup rules
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
:editor :ui
(evil +everywhere); come to the dark side, we have cookies doom ; what makes DOOM look the way it does
fold ; (nigh) universal code folding doom-dashboard ; a nifty splash screen for Emacs
rotate-text ; cycle region at point between text candidates hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
snippets ; my elves. They type so I don't have to hydra
word-wrap ; soft wrapping with language-aware indent modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping
ophints ; highlight the region an operation acts on
(popup ; tame sudden yet inevitable temporary windows
+all ; catch all popups that start with an asterix
+defaults) ; default popup rules
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
:emacs :editor
dired ; making dired pretty [functional] (evil +everywhere); come to the dark side, we have cookies
electric ; smarter, keyword-based electric-indent fold ; (nigh) universal code folding
ibuffer ; interactive buffer management rotate-text ; cycle region at point between text candidates
vc ; version-control and Emacs, sitting in a tree snippets ; my elves. They type so I don't have to
word-wrap ; soft wrapping with language-aware indent
:term :emacs
eshell ; a consistent, cross-platform shell (WIP) dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
ibuffer ; interactive buffer management
vc ; version-control and Emacs, sitting in a tree
:tools :term
debugger ; FIXME stepping through code, to help you add bugs eshell ; a consistent, cross-platform shell (WIP)
(eval +overlay) ; run code, run (also, repls)
(lookup ; helps you navigate your code and documentation
+docsets) ; ...or in Dash docsets locally
;;lsp
magit ; a git porcelain for Emacs
;;pass ; password manager for nerds
pdf ; pdf enhancements
:checkers :tools
syntax ; tasing you for every semicolon you forget debugger ; Stepping through code, to help you add bugs
spell ; tasing you for misspelling mispelling (eval +overlay) ; run code, run (also, repls)
(lookup ; helps you navigate your code and documentation
+docsets) ; ...or in Dash docsets locally
;;lsp
magit ; a git porcelain for Emacs
;;pass ; password manager for nerds
pdf ; pdf enhancements
:lang :checkers
data ; config/data formats syntax ; tasing you for every semicolon you forget
emacs-lisp ; drown in parentheses spell ; tasing you for misspelling mispelling
latex ; writing papers in Emacs has never been so fun
markdown ; writing docs for people to ignore
(org ; organize your plain life in plain text
+dragndrop ; drag & drop files/images into org buffers
+hugo ; use Emacs for hugo blogging
+journal ;
+present) ; using org-mode for presentations
;;python ; beautiful is better than ugly
sh ; she sells {ba,z,fi}sh shells on the C xor
:email :lang
;;(mu4e +gmail) data ; config/data formats
emacs-lisp ; drown in parentheses
latex ; writing papers in Emacs has never been so fun
markdown ; writing docs for people to ignore
(org ; organize your plain life in plain text
+dragndrop ; drag & drop files/images into org buffers
+hugo ; use Emacs for hugo blogging
+journal ;
+pomodoro ;
+present) ; using org-mode for presentations
;;python ; beautiful is better than ugly
sh ; she sells {ba,z,fi}sh shells on the C xor
:app :email
;;calendar ;;(mu4e +gmail)
;;(rss +org) ; emacs as an RSS reader
;;write ; emacs for writers (fiction, notes, papers, etc.)
:config :app
literate calendar
(default +bindings +smartparens)) ;;(rss +org) ; emacs as an RSS reader
;;write ; emacs for writers (fiction, notes, papers, etc.)
:config
literate
(default +bindings +smartparens))
#+end_src #+end_src
* Doom =packages.el= * Doom =packages.el=
@ -2371,6 +2386,8 @@ they are implemented.
(package! matlab-mode (package! matlab-mode
:recipe (:host github :repo "matlab-mode/mirror")) :recipe (:host github :repo "matlab-mode/mirror"))
(package! org-ref) (package! org-ref)
(package! org-ql)
(package! org-fancy-priorities)
#+end_src #+end_src
* Snippets * Snippets
@ -2661,13 +2678,13 @@ $0
#contributor : Thomas Dehaeze <dehaeze.thomas@gmail.com> #contributor : Thomas Dehaeze <dehaeze.thomas@gmail.com>
#name :Matlab-Figure #name :Matlab-Figure
# -- # --
#+HEADER: :tangle no :exports results :results none :noweb yes #+header: :tangle no :exports results :results none :noweb yes
,#+begin_src matlab :var filepath="${2:figs}/$1.pdf" :var figsize="${3:full-tall}" :post pdf2svg(file=*this*, ext="png") ,#+begin_src matlab :var filepath="${2:figs}/$1.pdf" :var figsize="${3:full-tall}" :post pdf2svg(file=*this*, ext="png")
<<plt-matlab>>$0 <<plt-matlab>>$0
,#+end_src ,#+end_src
#+NAME: fig:$1 #+name: fig:$1
#+CAPTION: ${4:caption}${5: ([[./figs/$1.png][png]], [[./figs/$1.pdf][pdf]])} #+caption: ${4:caption}${5: ([[./figs/$1.png][png]], [[./figs/$1.pdf][pdf]])}
[[file:$2/$1.png]] [[file:$2/$1.png]]
#+end_src #+end_src