-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org-roam-v2 parent node titles in vulpea-find? #178
Comments
@iwooden Hey, all good! Thanks for reaching me out. There is no way to do it out of the box, but it can be implemented. I am OOO today and will not be able to share anything, but will try to do it tomorrow. |
@iwooden can you please tell me how you include parent titles in org-roam? I wanted to check if behaviour I've coded is the same, but by default I am also curious to know what you use to understand performance differences. Naïve approach would be slow on a huge collection of notes (assuming synchronous completion). |
Ah yep, you're totally right. As I mentioned, I'm using a (mostly) unmodified Doom Emacs, which apparently sets a custom I'm not really using any profiling to determine performance differences (I know, heresy), I just noticed that In any case, it sounds like this is a major pain to do efficiently, but you've already helped quite a bit by pointing out |
I completely forgot about The only catch, it doesn't include the file title, i.e. title of the file-level note. But it's easy to get in performant way. Let me add |
The master branch now includes a commit that adds OLP to Outline path without file-level note title(defun my-vulpea-select-describe-fn (note)
"Describe NOTE for `vulpea-select'."
(concat
(propertize
(string-join
(nconc (vulpea-note-outline-path note) (list ""))
" → ")
'face 'completions-annotations)
(vulpea-note-title note)))
;; this is just to test
(let ((vulpea-select-describe-fn #'my-vulpea-select-describe-fn))
(vulpea-select "Note"))
;; you can configure vulpea to use this function by default:
(setq vulpea-select-describe-fn #'my-vulpea-select-describe-fn) Outline path, including file-level note titleCurrently there is no way to do in an optimal way without advice, but... well, it works 😅 (defun my-vulpea-select-from-wrapper (orig-fn &rest args)
"Custom wrapper around `vulpea-select-from'.
The function calls ORIG-FN with ARGS, but optimises calls to `vulpea-db'
used by custom describe function for selection routine."
(let ((title-by-path (make-hash-table :test #'equal)))
(--each (vulpea-db-query
(lambda (note)
;; here we just don't care about non-file-level notes and we don't care about aliases
(and (= 0 (vulpea-note-level note))
(null (vulpea-note-primary-title note)))))
(puthash (vulpea-note-path it) (vulpea-note-title it) title-by-path))
(let ((vulpea-select-describe-fn (my-vulpea-select-describe-fn title-by-path)))
(apply orig-fn args))))
(defun my-vulpea-select-describe-fn (title-by-path)
"Return a describe function for `vulpea-select'.
It uses TITLE-BY-PATH to include file-level note title."
(lambda (note)
(concat
(propertize
(string-join
(nconc
(unless (= 0 (vulpea-note-level note))
(or (gethash (vulpea-note-path note) title-by-path) "unknown file"))
(vulpea-note-outline-path note)
(when (= 0 (vulpea-note-level note)) (list "")))
" → ")
'face 'completions-annotations)
(vulpea-note-title note))))
(advice-add 'vulpea-select-from :around #'my-vulpea-select-from-wrapper) It's a little bit more slow as it requires extra query of all db, but at least it's not overly slow haha. In short it just dynamically builds the describe function every time you call Feel free to play around with And of course, let me know if you need further assistance. |
Now that I think about it... I actually love both options. Maybe I will change the default value of describe function 😅 Or at least, share both of the solutions in documentation 🤷 So really happy that you approached me 😅 And sorry for spoiling you the fun of implementing it yourself 😭 P.S. Reopened because I want to include it OOTB or share. |
Hi! First off, thanks for your work on this project - I'm interested in using
vulpea
over the nativeorg-roam
interactive functions primarily for performance reasons, though the tag/metadata stuff looks like it'll be useful if I dig into it more.I'm using
org-roam-v2
on Doom Emacs, and I heavily use the "headings as nodes" feature ofv2
rather than "one node per file" like inv1
. One thing that's really useful is that when I useorg-roam-node-find
, the candidates will show all their parent headers, and in fact the search text will match all child nodes even if just the parent node title matches:This makes it very easy to disambiguate nodes that have similar titles by looking at their parent titles, jump to specific child nodes under a given heading, etc. If I use
vulpea-find
, it only matches against the node titles themselves:Is there some way to config Vulpea to get similar behavior from
vulpea-find
? Keep in mind I'm a relatively new Emacs user, so I apologize if this question is trivial or I missed some easy config option for this.Thanks again!
The text was updated successfully, but these errors were encountered: