egh / zotxt-emacs

143 stars 11 forks source link

Function to insert citation regardless of description style #43

Open plantarum opened 4 years ago

plantarum commented 4 years ago

Hi again,

I've set my description style to use better bibtex, which gives me nice control over how the links appear in my document. However, sometimes I also want to insert the full citation. This doesn't need to be an actual org link, it could be inserted as plain text without markup. Or a link, I don't have a strong preference.

I think the code is mostly already there to provide this feature, but I don't yet understand how the deferred chains work well enough to add this myself. I also tried writing a wrapper that would set the value of org-zotxt-link-description-style temporarily, but the new setting is ignored:

(defun org-zotxt-insert-reference-citation (&optional arg)
  "Wrapper to o-z-i-r-link to force it to use full citations"
  (interactive "p")
  (let ((org-zotxt-link-description-style :citation))
    (org-zotxt-insert-reference-link arg)))
plantarum commented 4 years ago

On further investigation, if I debug my function (org-zotxt-insert-reference-citation in the first message), it works as expected, but when I undebug it, it inserts the better-bibtex style link again. Not sure why that would be?