emacs: improve org note handline

This commit is contained in:
Julian Mutter 2023-06-27 10:30:47 +02:00
parent b6c9946cd9
commit 7c63a2c148

View File

@ -108,28 +108,26 @@
(map! :map org-mode-map :nvi "M-@" #'org-cite-insert)
(map! :map doom-leader-notes-map "r r" #'org-roam-node-find)
(map! :map doom-leader-notes-map "r t" #'org-roam-buffer-toggle)
(map! :map doom-leader-notes-map "s" #'fd-org-notes-search-follow-symlinks)
(setq org-roam-preview-function #'fd-my-org-roam-preview-function)
(after! org
(add-to-list 'org-capture-templates
'("b" "Bachelor todo" entry
(file+headline "bachelor/todo.org" "Inbox")
"* IDEA %?\n%i\n%T\n%a" :prepend t)
))
;; Custom preview function including subheadings
(defun fd-my-org-roam-preview-function ()
"Return the preview content at point.
This function returns the all contents under the current
headline, up to the next headline."
(let ((beg (save-excursion
(org-roam-end-of-meta-data t)
(point)))
(end (save-excursion
(condition-case nil
(progn
(outline-forward-same-level)
(backward-char)
(point)
)
(error
(point-max))))))
(string-trim (buffer-substring-no-properties beg end))))
(defun fd-org-notes-search-follow-symlinks (query)
"Alternative to +default/org-notes-search which follows symbolic links for better project inlusion"
(interactive
(list (if (doom-region-active-p)
(buffer-substring-no-properties
(doom-region-beginning)
(doom-region-end))
"")))
(require 'org)
(+vertico-file-search :query query :in org-directory :args '("-L")))
#+end_src
** TeX