Refactor with variable for notes directory

This commit is contained in:
Dimitri Lozeve 2025-01-26 17:35:42 +01:00
parent ca3431b731
commit 251dcdcc39

26
init.el
View file

@ -366,16 +366,18 @@
;;; Knowledge management: org-mode, org-roam, bibliography ;;; Knowledge management: org-mode, org-roam, bibliography
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq notes-dir "~/Documents/notes")
;; Pour accéder rapidement à l'organisation ;; Pour accéder rapidement à l'organisation
(defun gtd () (defun gtd ()
"Find the planner file." "Find the planner file."
(interactive) (interactive)
(find-file "~/notes/planner.org")) (find-file (file-name-concat notes-dir "planner.org")))
(defun bib () (defun bib ()
"Find the bibliography file." "Find the bibliography file."
(interactive) (interactive)
(find-file "~/notes/bibliography/bibliography.bib") (find-file (file-name-concat notes-dir "bibliography/bibliography.bib"))
(end-of-buffer)) (end-of-buffer))
(use-package org (use-package org
@ -384,8 +386,8 @@
("C-c a" . org-agenda) ("C-c a" . org-agenda)
("C-c c" . org-capture)) ("C-c c" . org-capture))
:config :config
(setq org-agenda-files (list "~/notes/planner.org")) (setq org-agenda-files (list (file-name-concat notes-dir "planner.org")))
(setq org-default-notes-file "~/notes/planner.org") (setq org-default-notes-file (file-name-concat notes-dir "planner.org"))
;; List numbering with a. b. a) b), etc. ;; List numbering with a. b. a) b), etc.
(setq org-list-allow-alphabetical t) (setq org-list-allow-alphabetical t)
;; Fontify code in code blocks ;; Fontify code in code blocks
@ -406,7 +408,7 @@
(add-hook 'org-mode-hook #'visual-line-mode) (add-hook 'org-mode-hook #'visual-line-mode)
;; Set to the location of your Org files on your local system ;; Set to the location of your Org files on your local system
(setq org-directory "~/notes") (setq org-directory notes-dir)
(setq org-agenda-block-separator ?─ (setq org-agenda-block-separator ?─
org-agenda-time-grid '((daily today require-timed) org-agenda-time-grid '((daily today require-timed)
@ -445,13 +447,13 @@
(setq org-capture-templates (setq org-capture-templates
(quote (quote
(("t" "Task" entry (("t" "Task" entry
(file+olp "~/notes/planner.org" "Inbox") (file+olp (file-name-concat notes-dir "planner.org") "Inbox")
"** TODO %?") "** TODO %?")
("n" "Note" entry ("n" "Note" entry
(file+olp "~/notes/planner.org" "Inbox") (file+olp (file-name-concat notes-dir "planner.org") "Inbox")
"** %?") "** %?")
("e" "Event" entry ("e" "Event" entry
(file+olp "~/notes/planner.org" "Inbox") (file+olp (file-name-concat notes-dir "planner.org") "Inbox")
"** %?\n%^T")))) "** %?\n%^T"))))
(setq org-log-into-drawer t) (setq org-log-into-drawer t)
(setq org-structure-template-alist (setq org-structure-template-alist
@ -536,7 +538,7 @@
:after (org) :after (org)
:config :config
(setq org-pandoc-options '((standalone . t) (setq org-pandoc-options '((standalone . t)
(bibliography . "~/notes/bibliography/bibliography.bib")))) (bibliography . (file-name-concat notes-dir "bibliography/bibliography.bib")))))
(use-package ox-gfm (use-package ox-gfm
:ensure t :ensure t
@ -574,8 +576,8 @@
(use-package citar (use-package citar
:ensure t :ensure t
:custom :custom
(org-cite-global-bibliography '("~/notes/bibliography/bibliography.bib")) (org-cite-global-bibliography `(,(file-name-concat notes-dir "bibliography/bibliography.bib")))
(org-cite-csl-styles-dir "~/notes/bibliography/") (org-cite-csl-styles-dir (file-name-concat notes-dir "bibliography/"))
(org-cite-export-processors '((beamer . (biblatex)) (org-cite-export-processors '((beamer . (biblatex))
(latex . (biblatex)) (latex . (biblatex))
(t . (csl "chicago-author-date.csl")))) (t . (csl "chicago-author-date.csl"))))
@ -641,7 +643,7 @@
:ensure t :ensure t
:after org :after org
:custom :custom
(org-roam-directory (file-truename "~/notes/notes")) (org-roam-directory (file-truename (file-name-concat notes-dir "notes")))
:bind (("C-c n l" . org-roam-buffer-toggle) :bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find) ("C-c n f" . org-roam-node-find)
("C-c n g" . org-roam-graph) ("C-c n g" . org-roam-graph)