mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-30 22:57:59 +00:00
Update Emacs notebook configuration
This commit is contained in:
parent
9e956dc085
commit
7d52a921dc
@ -1,20 +1,40 @@
|
|||||||
((org-mode .
|
((org-mode .
|
||||||
((org-babel-default-header-args . ((:session . "none")
|
((org-babel-default-header-args . ((:session . "none")
|
||||||
(:results . "replace output")
|
(:results . "replace output")
|
||||||
(:exports . "both")
|
(:exports . "both")
|
||||||
(:cache . "no")
|
(:cache . "no")
|
||||||
(:noweb . "yes")
|
(:noweb . "yes")
|
||||||
(:mkdirp . "yes")
|
(:mkdirp . "yes")
|
||||||
(:tangle . "no")))
|
(:tangle . "no")))
|
||||||
(org-babel-default-header-args:org . ((:results . "silent")
|
(org-babel-default-header-args:org . ((:results . "silent")
|
||||||
(:exports . "code")))
|
(:exports . "code")))
|
||||||
(time-stamp-format . "%Y-%02m-%02d %02H:%02M:%02S %:z")
|
(citar-open-note-function 'orb-citar-edit-note)
|
||||||
(time-stamp-start . "date_modified:[ ]+\\\\?[\"< ]*")
|
(time-stamp-format . "%Y-%02m-%02d %02H:%02M:%02S %:z")
|
||||||
(time-stamp-end . "\\\\?[\"> ]*$")
|
(time-stamp-start . "date_modified:[ ]+\\\\?[\"< ]*")
|
||||||
(eval . (setq org-babel-default-header-args
|
(time-stamp-end . "\\\\?[\"> ]*$")
|
||||||
(cons `(:dir . ,(concat
|
(eval . (setq org-babel-default-header-args
|
||||||
(file-name-directory (buffer-file-name))
|
(cons `(:output-dir . ,(f-join
|
||||||
"assets/"
|
(file-name-directory (buffer-file-name))
|
||||||
(file-name-base (buffer-file-name))))
|
"assets"
|
||||||
(assq-delete-all :dir org-babel-default-header-args))))
|
(file-name-base (buffer-file-name))))
|
||||||
(org-babel-results-keyword . "results"))))
|
(assq-delete-all :output-dir org-babel-default-header-args))
|
||||||
|
|
||||||
|
citar-note-format-function
|
||||||
|
(lambda (key entry)
|
||||||
|
(let* ((template (citar--get-template 'note))
|
||||||
|
(note-meta (when template
|
||||||
|
(citar-format--entry template entry)))
|
||||||
|
(filepath (expand-file-name
|
||||||
|
(f-join "notebook/" (concat "literature." key ".org"))
|
||||||
|
(car citar-notes-paths)))
|
||||||
|
(buffer (find-file filepath)))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(erase-buffer)
|
||||||
|
(citar-org-roam-make-preamble key)
|
||||||
|
(org-roam-capture--fill-template "r")
|
||||||
|
(insert "\n\n|\n\n#+print_bibliography:")
|
||||||
|
(search-backward "|")
|
||||||
|
(delete-char 1)
|
||||||
|
(when (fboundp 'evil-insert)
|
||||||
|
(evil-insert 1)))))))
|
||||||
|
(org-babel-results-keyword . "results"))))
|
||||||
|
8
.envrc
8
.envrc
@ -1,7 +1 @@
|
|||||||
if type lorri &>/dev/null
|
use flake
|
||||||
then
|
|
||||||
echo "direnv: using lorri"
|
|
||||||
eval "$(lorri direnv)"
|
|
||||||
else
|
|
||||||
use nix
|
|
||||||
fi
|
|
||||||
|
46
config.el
46
config.el
@ -5,35 +5,42 @@
|
|||||||
|
|
||||||
(+wiki/biblio-setup)
|
(+wiki/biblio-setup)
|
||||||
|
|
||||||
(defun my/is-in-wiki-directory ()
|
(defun my/is-in-wiki-directory (&optional filename)
|
||||||
"Return t if the file buffer is in the wiki directory."
|
"Return t if the file buffer is in the wiki directory."
|
||||||
(if (and (not (string= (f-base (buffer-file-name))
|
(unless filename (setq filename (buffer-file-name)))
|
||||||
|
(if (and (not (string= (f-base filename)
|
||||||
my/wiki-asset-directory-name))
|
my/wiki-asset-directory-name))
|
||||||
(f-descendant-of-p (buffer-file-name)
|
(f-descendant-of-p filename
|
||||||
(expand-file-name +wiki-directory)))
|
(expand-file-name +wiki-directory)))
|
||||||
t
|
t
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defun my/get-assets-folder ()
|
(defun my/get-assets-folder (&optional filename)
|
||||||
"Get the assets folder of the current Org mode document."
|
"Get the assets folder of the current Org mode document."
|
||||||
(if (my/is-in-wiki-directory)
|
(unless filename (setq filename (buffer-file-name)))
|
||||||
(f-join my/wiki-asset-directory-name (f-base buffer-file-name))
|
(if (my/is-in-wiki-directory filename)
|
||||||
|
(f-join my/wiki-asset-directory-name (f-base filename))
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defun my/concat-assets-folder (&rest args)
|
(defun my/concat-assets-folder (&optional filename &rest args)
|
||||||
"Concatenate PATH to the assets folder."
|
"Concatenate PATH to the assets folder."
|
||||||
(apply #'f-join (my/get-assets-folder) args))
|
(unless filename (setq filename (buffer-file-name)))
|
||||||
|
(apply #'f-join (my/get-assets-folder filename) args))
|
||||||
|
|
||||||
(defun my/create-assets-folder ()
|
(defun my/create-assets-folder (&optional filename)
|
||||||
"A quick convenient function to create an assets folder in the wiki folder."
|
"A quick convenient function to create the appropriate folder in the assets folder with its buffer filename."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
(unless filename (setq filename (buffer-file-name)))
|
||||||
(if (my/is-in-wiki-directory)
|
(if (my/is-in-wiki-directory)
|
||||||
(f-mkdir my/wiki-asset-directory-name
|
(let* ((target (f-base filename))
|
||||||
(f-join my/wiki-asset-directory-name (file-name-sans-extension (buffer-file-name))))
|
(target-dir (f-join my/wiki-asset-directory-name target)))
|
||||||
|
(apply #'f-mkdir (f-split target-dir))
|
||||||
|
(message "Directory '%s' has been created." target-dir))
|
||||||
(message "Not in the wiki directory.")))
|
(message "Not in the wiki directory.")))
|
||||||
|
|
||||||
(defun my/parse-links-in-org (filename)
|
(defun my/parse-links-in-org (&optional filename)
|
||||||
"Returns a list of links in an Org buffer."
|
"Returns a list of links in an Org buffer."
|
||||||
|
(unless filename (setq filename (buffer-file-name)))
|
||||||
(let ((ast (with-temp-buffer
|
(let ((ast (with-temp-buffer
|
||||||
(insert-file-contents filename)
|
(insert-file-contents filename)
|
||||||
(org-mode)
|
(org-mode)
|
||||||
@ -55,12 +62,14 @@
|
|||||||
|
|
||||||
(setq
|
(setq
|
||||||
org-roam-v2-ack 't
|
org-roam-v2-ack 't
|
||||||
org-roam-node-display-template "${doom-hierarchy:100} ${file:45}"
|
|
||||||
org-roam-node-display-template
|
org-roam-node-display-template
|
||||||
(format "${doom-hierarchy:*} %s %s"
|
(format "${doom-hierarchy:*} %s %s"
|
||||||
(propertize "${doom-tags:15}" 'face 'org-tag)
|
(propertize "${doom-tags:15}" 'face 'org-tag)
|
||||||
(propertize "${file:60}" 'face 'font-lock-default-face))
|
(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"))
|
(file ,(f-join +wiki-directory "templates" "default.org"))
|
||||||
:target
|
:target
|
||||||
@ -71,7 +80,8 @@
|
|||||||
(file ,(f-join +wiki-directory "templates" "anki.org"))
|
(file ,(f-join +wiki-directory "templates" "anki.org"))
|
||||||
:target
|
:target
|
||||||
(file ,(f-join +anki-cards-directory-name "%<%Y>.org"))
|
(file ,(f-join +anki-cards-directory-name "%<%Y>.org"))
|
||||||
:unnarrowed t)
|
:unnarrowed t
|
||||||
|
:empty-lines 2)
|
||||||
|
|
||||||
("l" "literature" plain "%?"
|
("l" "literature" plain "%?"
|
||||||
(file ,(f-join +wiki-directory "templates" "default.org"))
|
(file ,(f-join +wiki-directory "templates" "default.org"))
|
||||||
@ -79,7 +89,7 @@
|
|||||||
(file ,(f-join +wiki-notebook-directory "literature.${slug}.org"))
|
(file ,(f-join +wiki-notebook-directory "literature.${slug}.org"))
|
||||||
:unnarrowed t)
|
:unnarrowed t)
|
||||||
|
|
||||||
("L" "literature reference" plain
|
("L" "literature reference" plain "%?"
|
||||||
(file ,(f-join +wiki-directory "templates" "literature.org"))
|
(file ,(f-join +wiki-directory "templates" "literature.org"))
|
||||||
:target
|
:target
|
||||||
(file ,(f-join +wiki-notebook-directory "literature.${citekey}.org"))
|
(file ,(f-join +wiki-notebook-directory "literature.${citekey}.org"))
|
||||||
|
Loading…
Reference in New Issue
Block a user