Update notebook configuration

This commit is contained in:
Gabriel Arazas 2022-11-23 17:35:16 +08:00
parent 97a24dc723
commit c3c173d858

View File

@ -22,13 +22,13 @@
(f-join my/wiki-asset-directory-name (f-base filename))
nil))
(defun my/concat-assets-folder (&optional filename &rest args)
(defun my/concat-assets-folder (&rest args)
"Concatenate PATH to the assets folder."
(unless filename (setq filename (buffer-file-name)))
(apply #'f-join (my/get-assets-folder filename) args))
(apply #'f-join (my/get-assets-folder (buffer-file-name)) args))
(defun my/create-assets-folder (&optional filename)
"A quick convenient function to create the appropriate folder in the assets folder with its buffer filename."
"A quick convenient function to create the appropriate folder in the assets
folder with its buffer filename."
(interactive)
(unless filename (setq filename (buffer-file-name)))
(if (my/is-in-wiki-directory)
@ -62,34 +62,30 @@
(setq
org-roam-v2-ack 't
org-roam-node-display-template
(format "${doom-hierarchy:*} %s %s"
(propertize "${doom-tags:15}" 'face 'org-tag)
(propertize "${file:60}" 'face 'font-lock-default-face))
citar-notes-paths `(,+wiki-directory)
citar-library-paths '("~/library/references" "~/Zotero")
org-roam-capture-templates `(("e" "evergreen" plain "%?"
org-roam-capture-templates `(("e" "evergreen" plain
(file ,(f-join +wiki-directory "templates" "default.org"))
:target
(file ,(f-join +wiki-notebook-directory "%<%Y-%m-%d-%H-%M-%S>.org"))
:unnarrowed t)
("c" "cards" plain "%?"
("c" "cards" plain
(file ,(f-join +wiki-directory "templates" "anki.org"))
:target
(file ,(f-join +anki-cards-directory-name "%<%Y>.org"))
:unnarrowed t
:empty-lines 2)
("l" "literature" plain "%?"
("l" "literature" plain
(file ,(f-join +wiki-directory "templates" "default.org"))
:target
(file ,(f-join +wiki-notebook-directory "literature.${slug}.org"))
:unnarrowed t)
("L" "literature reference" plain "%?"
("L" "literature reference" plain
(file ,(f-join +wiki-directory "templates" "literature.org"))
:target
(file ,(f-join +wiki-notebook-directory "literature.${citekey}.org"))
@ -99,9 +95,57 @@
:target
(file+head ,(expand-file-name "%<%Y-%m-%d>.org" org-roam-dailies-directory) "#+title: %<%Y-%m-%d>\n"))
("s" "structured" plain "%?"
("s" "structured" plain
(file ,(f-join +wiki-directory "templates" "default.org"))
:target
(file ,(f-join +wiki-notebook-directory "${slug}.org"))
:unnarrowed t)))
(eval-after-load "org-roam"
'(cl-defmethod org-roam-node-slug ((node org-roam-node))
"Override of the original org-roam slug function by replacing the
underscore with dashes."
(let ((title (org-roam-node-title node))
(slug-trim-chars '(;; Combining Diacritical Marks https://www.unicode.org/charts/PDF/U0300.pdf
768 ; U+0300 COMBINING GRAVE ACCENT
769 ; U+0301 COMBINING ACUTE ACCENT
770 ; U+0302 COMBINING CIRCUMFLEX ACCENT
771 ; U+0303 COMBINING TILDE
772 ; U+0304 COMBINING MACRON
774 ; U+0306 COMBINING BREVE
775 ; U+0307 COMBINING DOT ABOVE
776 ; U+0308 COMBINING DIAERESIS
777 ; U+0309 COMBINING HOOK ABOVE
778 ; U+030A COMBINING RING ABOVE
779 ; U+030B COMBINING DOUBLE ACUTE ACCENT
780 ; U+030C COMBINING CARON
795 ; U+031B COMBINING HORN
803 ; U+0323 COMBINING DOT BELOW
804 ; U+0324 COMBINING DIAERESIS BELOW
805 ; U+0325 COMBINING RING BELOW
807 ; U+0327 COMBINING CEDILLA
813 ; U+032D COMBINING CIRCUMFLEX ACCENT BELOW
814 ; U+032E COMBINING BREVE BELOW
816 ; U+0330 COMBINING TILDE BELOW
817 ; U+0331 COMBINING MACRON BELOW
)))
(cl-flet* ((nonspacing-mark-p (char) (memq char slug-trim-chars))
(strip-nonspacing-marks (s) (string-glyph-compose
(apply #'string
(seq-remove #'nonspacing-mark-p
(string-glyph-decompose s)))))
(cl-replace (title pair) (replace-regexp-in-string (car pair) (cdr pair) title)))
(let* ((pairs `(("[^[:alnum:][:digit:]]" . "-") ;; convert anything not alphanumeric
("--*" . "-") ;; remove sequential dashes
("^_" . "") ;; remove starting dashes
("_$" . ""))) ;; remove ending dashes
(slug (-reduce-from #'cl-replace (strip-nonspacing-marks title) pairs)))
(downcase slug))))))
(eval-after-load "org-roam"
'(setq
org-roam-node-display-template
(format "${doom-hierarchy:*} %s %s"
(propertize "${doom-tags:15}" 'face 'org-tag)
(propertize "${file:60}" 'face 'font-lock-default-face))))
;;; config.el ends here