Skip to content
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

Feature request: Add support for citations in the backlinks buffer ? #12

Closed
lucasgruss opened this issue Feb 9, 2023 · 4 comments
Closed

Comments

@lucasgruss
Copy link

Hi, I would like to discuss the addition of a new feature which I think would have its place in citar-denote (but might also require modification in denote?). I mostly use org-mode in my notes and am very fond of org-cite.

Imagine that I have a paper/reference that I cite in different notes (let's call them a.org, b.org, c.org). When I am in the note for this paper, I want to produce a backlinks buffer showing files that cite the paper (a.org, b.org, c.org) as well as the files linking directly to the current note (the default behaviour). Unfortunately, the backlinks are only registered for denote-type links but not citations.

I wrote the following function as a proof-of-concept of the functionality for org-cite :

(defun citar-denote-cite-backlinks ()
  "Construct a buffer of all the notes (in .org format) that cite
the current reference. This function must be called from a denote 
note.

TODO: add support for other citations provided by citar (latex,
markdown) ?
"
  (interactive)
   (let* ((file (buffer-file-name))
	  (key (citar-denote-retrieve-reference-key-value file 'org)))
     (if key
	 (xref--show-xrefs
	  (xref-matches-in-files (format "cite:@%s" key) (denote-directory-text-only-files))
	  nil)
       ;; check if current file is a reference note, add reference if needed and
       ;; rerun command
       (when (yes-or-no-p "Current buffer does not reference a bibliography item. Select a reference ?")
	 (citar-denote-add-citekey)
	 (citar-denote-cite-backlinks)))))

How can we extend the behaviour of denote-link-backlinks from within citar-denote to include the results of the above function ? Is it even possible in the current version of denote ?

I was unsure whether I should ask this question on the denote mailing list, but I feel that this is better suited for citar-denote.

@pprevos
Copy link
Owner

pprevos commented Feb 9, 2023 via email

pprevos added a commit that referenced this issue Feb 11, 2023
@pprevos
Copy link
Owner

pprevos commented Feb 11, 2023

Hi Lucas, I have just committed a new version of citar-denote that includes your requested features.

Great addition to the package - thanks for the idea and initial code; I learned a few new things.

It works with Org and Markdown. LaTeX files are not Denote files. That requires a different package.

The README file is updated.

@pprevos pprevos closed this as completed Feb 11, 2023
@pprevos
Copy link
Owner

pprevos commented Feb 13, 2023

Hi Lucas, can you please confirm that the new version of the package does what you need it to do?

@lucasgruss
Copy link
Author

Hi Peter,

Thank you very much for implementing this feature so quickly. Sorry for not giving feedback earlier, this weekend got unexpectedly busy for me.

From what I tested, it seems to do exactly what I needed and it works for all formats supported by both denote and citar !
It's a great idea to use the completion framework instead of the backlinks buffer (I hardly use it), though we could think of a way to add this option some time in the future.

However this is something that could be first discussed on the denote mailing list. I think it could be great if denote provided a way to extend the backlinks buffer, so that users or packages can populate it with their own elements. I'll engage the discussion on the mailing list onceI have working snippets of code that we can build on and decide if it's a useful addition to denote.

Thanks again and best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants