-
Notifications
You must be signed in to change notification settings - Fork 54
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
Generalize the "notes" part of citar-open
#612
Comments
@aikrahguzar no rush, but since you've been working on and thinking about |
I am not much of a note taker :) From what I can tell you want to be able to address both files or location within a file and what springs to mind is bookmarks. I haven't used them myself but from what I have read about them they should work for both cases i.e. convert both filenames and org-roam nodes to a bookmark and use bookmark as an embark category. An other approach would be provide something basic here and have a separate package which depends on But I would say if you are really pushing the boundaries of |
Ah, I hadn't thought about that.
I had earlier thought of this, if not specifically for this issue. But that is certainly a possibility, in which case I might just drop I'll need to experiment with @mclearc is working on this https://github.com/mclear-tools/consult-notes It's purely focused on notes, however, whereas |
Maybe a wild idea: Do you think it would be feasible to replace I played again with (defun concite-notes-org-roam ()
"Notes."
(org-roam-ref-read--completions))
(defvar concite-source-notes
`(:name "Notes"
:narrow ?n
:category org-roam-node
:items ,#'concite-notes-org-roam)) |
@bdarcus -- yeah interesting idea. I'll see if i can get something working. |
I actually had in mind at one point a generalization of even that, called |
there is this function from the consult-org-roam package that might be useful. I'm not sure I have time today to get into this all that much but we'll see... |
No rush at all; it (whether to remove citar-open from here) is just
the kind of question I want to settle before I tag 1.0, which is
likely sometime this month.
|
I figured it out: I think the constraint that So this works, for example: (defun concite--notes ()
"Notes."
(mapcar #'car (org-roam-ref-read--completions))) But one can probably propertize those strings to embed additional metadata in them. Edit: actually, org-roam itself uses propertized strings for the candidates, so should be able to use those for the annotations (for example, to extract the node). I just didn't figure that part out yet. I also am not a fan of those completion candidates; completing on the keys. And the other thing I don't see ATM: affixation functions. So in the above, would just attach an annotation function. See this issue for affixation: Finally, the other limitation (though may not matter): no multiple selection. |
the relevant code being: :items ,(lambda () (let* ((node (mapcar #'cdr (org-roam-ref-read--completions)))
(title (mapcar #'org-roam-node-title node)))
(progn title))) I'm having real trouble (perhaps predictably) getting any good annotations though. We'll see. |
Actually -- I think this works: :annotate ,(lambda (cand)
(let* ((file (org-roam-node-file (org-roam-node-from-title-or-alias cand)))
(attrs (file-attributes file))
(dir (file-name-nondirectory (directory-file-name (file-name-directory file))))
(size
(file-size-human-readable (file-attribute-size (file-attributes file))))
(time (consult-notes--time (file-attribute-modification-time attrs)))
)
(concat (format "%7s %7s" dir size) " " (format "%10s" time))
)) |
Closed via #634 |
We need to adjust
citar-open
to #603 (or drop the command altogether?).The problem currently is the candidate list here is file paths, and typed as such for Embark.
And
citar--select-resource
takes a list of files as input.But for org-roam v2, for example, with its more general concept of note, the candidates would be "org-roam-ref" "nodes".
I need to look, but I suspect we need to add another defcustom for the candidates.
Notes
org-roam-ref-read
is the completion functionorg-roam-ref-read--completions
; its candidates are a key and a list of org-roam nodes, which look like this:The text was updated successfully, but these errors were encountered: