From 7c63a2c148123ada4a2c847bb9be4dc98a48b5d6 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Tue, 27 Jun 2023 10:30:47 +0200 Subject: [PATCH] emacs: improve org note handline --- emacs/doom/config.org | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/emacs/doom/config.org b/emacs/doom/config.org index ab92762..7aa69d3 100644 --- a/emacs/doom/config.org +++ b/emacs/doom/config.org @@ -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