Tweak org-yasnippet integration

This commit is contained in:
Kiana Sheibani 2024-04-23 15:06:41 -04:00
parent 5766605cf6
commit a65475dd4e
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -3724,10 +3724,7 @@ The goal is to hook into Org's capturing system to get it to feed its template i
(org-capture-plist (plist-put org-capture-plist :template ""))) (org-capture-plist (plist-put org-capture-plist :template "")))
(cl-letf (((symbol-function 'org-kill-is-subtree-p) #'always)) (cl-letf (((symbol-function 'org-kill-is-subtree-p) #'always))
(funcall old-fn arg) (funcall old-fn arg)
(yas-expand-snippet (yas-expand-snippet template))))
(concat (pcase (org-capture-get :type)
('entry "`(make-string (org-outline-level) ?*)`"))
template)))))
#+end_src #+end_src
This advice overrides ~org-capture-place-template~, the function that: This advice overrides ~org-capture-place-template~, the function that:
@ -3794,7 +3791,7 @@ With those variables created, we can define our templates.
"#+title: ${title}") "#+title: ${title}")
:unnarrowed t) :unnarrowed t)
("h" "Heading" entry ("h" "Heading" entry
"* ${title} "`(make-string (org-outline-level) ?*)`* ${title}
:RELATED: :RELATED:
Subnote of `(let ((node (org-roam-node-at-point))) Subnote of `(let ((node (org-roam-node-at-point)))
(format \"[[id:%s][%s]]\" (format \"[[id:%s][%s]]\"
@ -3808,7 +3805,7 @@ Subnote of `(let ((node (org-roam-node-at-point)))
"#+title: %<%Y-%m-%d>" "#+title: %<%Y-%m-%d>"
("Todos")) ("Todos"))
:empty-lines 1) :empty-lines 1)
("n" "Notes" entry "* $0" ("n" "Notes" entry "** $0"
:target (file+head+olp "%<%Y-%m-%d>.org" :target (file+head+olp "%<%Y-%m-%d>.org"
"#+title: %<%Y-%m-%d>" "#+title: %<%Y-%m-%d>"
("Course Notes :notes:")) ("Course Notes :notes:"))