-
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
Add optional affixation symbol for currently cited references #744
Conversation
:type 'boolean) | ||
|
||
(defvar-local citar-org-current-refs-in-several-org-buffers nil | ||
"When non-nil, gathers current references from given list of files, or from all org-buffers (if t).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two questions for now:
- Can you include relevant screenshots when you get a moment?
- On the above, couldn't it be smarter, and automatic, at least in org? E.g. do the current buffer, and other included files? EDIT: though I guess this could get a tricky. In any case, thinking about workflow, it should be easy for users to have this work for different scenarios, including multi-chapter books, where each chapter is in a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Yes, that would be an alternative, but on the other hand wouldn’t work for the case where one is editing the file
chapter5.org
that is included inbook.org
. This was my ”raw” idea of letting someone define a project. But I suppose it can perhaps hook into project.el in some way (I don’t use it much myself).
This is with: (setq citar-symbols
`((file ,(all-the-icons-faicon "file-o" :face 'all-the-icons-green :v-adjust -0.1) . " ")
(note ,(all-the-icons-material "speaker_notes" :face 'all-the-icons-blue :v-adjust -0.3) . " ")
(link ,(all-the-icons-octicon "link" :face 'all-the-icons-orange :v-adjust 0.01) . " ")
(cited ,(all-the-icons-faicon "quote-right" :face 'org-cite) . " ")))
|
So on #645, If it's too much of a hassle, we can save it for later., but as you work on this, can you think about how to do both together? It could avoid us having to add additional defcustoms and such. |
By the way, it does a lot of parsing of org-files (on every invocation of |
This can be done for latex by parsing the aux file produced after compilation. |
Thinking about it from the user-facing configuration end, would not something like this work for addressing #645? (defvar citar-indicators
(list (list :indicator "F"
:function #'citar-has-files
:hidden-text "has:files")
(list :indicator "L"
:function #'citar-has-links
:hidden-text "has:links")
(list :indicator "N"
:function #'citar-has-notes
:hidden-text "has:notes"))) And then a function like this: (defun citar--make-indicator-processors (ispecs)
"Return a list of indicator processors."
(mapcar
(lambda (ispec)
(list :indicator (plist-get ispec :indicator)
:hidden-text (plist-get ispec :hidden-text)
:function (funcall (plist-get ispec :function))))
ispecs)) Then the resulting list could be let-bound to a variable, and the affix built by iterating through that. (when (funcall (plist-get proc :function) citekey) (plist-get proc :indicator)) Also, I will note that one of the use cases I identified for that is related to this PR. I had in mind an indicator for |
OK, @andersjohansson, I merged #753. If you rebase from main (or just create a new branch, since I created a number of merge conflicts for you!), I think it should be easy to adapt this to that. Conceptually it all works the same; it's just the configuration and supporting functions is more general. |
An implementation for fetching cite keys in org-mode is included, with configuration for fetching in narrowed buffer or not, and from several org buffers.
7ed6e86
to
207e0af
Compare
Cool! I re-implemented it with following #753. This actually makes it reasonable to do this as a plugin to citar. The only point where I would need to use advice in that case would be for the points where I do the buffer parsing (the not very carefully chosen I'm not sure if you are interested to merge this eventually? The configuration of pretty symbols would look like this then. A bit more tedious to edit the (setf (citar-indicator-symbol citar-indicator-files)
(all-the-icons-faicon "file-o" :face 'all-the-icons-green :v-adjust -0.1)
(citar-indicator-symbol citar-indicator-links)
(all-the-icons-octicon "link" :face 'all-the-icons-orange :v-adjust 0.01)
(citar-indicator-symbol citar-indicator-notes)
(all-the-icons-material "speaker_notes" :face 'all-the-icons-blue :v-adjust -0.3)
(citar-indicator-symbol citar-indicator-cited)
(all-the-icons-faicon "quote-right" :face 'org-cite))
(setq citar-indicators (list citar-indicator-links
citar-indicator-files
citar-indicator-notes
citar-indicator-cited)) |
Oh, I saw you added indicator configuration here as well: https://github.com/emacs-citar/citar/wiki/Indicators. |
I'm not opposed at all; with this all configurable, users can use or not. And I do like the idea. From my POV whether to include is really about the general fit, and this one seems to fit, as it's really about writing in the major modes, and isn't about any specific other packages. I think the design question would just be whether and how to integrate into the major-mode adapter system. I suppose the "list-keys" key is all that's really required, though it's currently defined as only include the citekeys in the "current buffer."
Yes; I'll leave it up to you, though just note that the
Not following here, but if you need to advice, perhaps there are tweaks to that code that would avoid that? I developed I'll also try to test this (been busy with other things). Is it ready for that? |
Oh yes! I had missed that this was already there. I kind of reimplemented it with my function for org mode (+ the multi-buffer stuff, but that should ideally perhaps be designed in a smarter way no matter). My suggestion now then, to add this in a simple enough, but still general way, would be to try to reuse the I created a new suggestion over at #761 |
It's helpful to see what you’ve already cited in the current document.This is something I have missed from my earlier system that extended org-zotxt (before org-cite).
I'm not sure if you want to include something like this, and it is not finished for anything more than org.
An implementation for fetching cite keys in org-mode is included, with configuration for fetching in narrowed buffer or not, and from several org buffers.
Optional grouping by currently cited is also included, however, this seems to interfere with the multi-selection display based on grouping.
(Took some time to go through my citar config and this branch today)