citar
citar copied to clipboard
Add citar-org-insert-keys ?
For markdown modes we have:
(defun citar-markdown-insert-keys (keys)
"Insert semicolon-separated and @-prefixed KEYS in a markdown buffer."
(insert (mapconcat (lambda (k) (concat "@" k)) keys "; ")))
Why not add the same for org?
I didn't write the markdown stuff, but I suspect it's there because pandoc citations can be outside of brackets.
Not the case with org. So what would be the advantage there, beyond org-cite-insert
?
UX: I'd like to implement a workflow more or less like this:
- insert a citation fragment (I use the function below, but could also be done manually)
- add a prefix manually
- add a key (that's the missing piece)
- add a suffix
- if needed add a semicolon
- repeat steps 2-4
(defun dm/insert-style-fragment ()
(interactive)
(let ((raw-style
(citar-org-select-style)))
(setq style
(if (string-equal raw-style "") raw-style
(concat "/" raw-style))))
(insert (concat "[cite" style ":]"))
(backward-char))
org-cite-insert
doesn't work: if I call it with point inside a cite fragment [cite:X]
I get [cite: [cite:@doe]
With org-cite-insert
:
- if you call with a prefix arg, you get prompted for the style
- insert one or more keys
- you can then add affixes in the buffer, or additional references with
org-cite-insert
, from there
E.g. to add a key to an existing citation using org-cite-insert
, you'd put point here before calling it again: [cite:@one|]
The org command, in other words, is context-aware; behaves differently depending on where it is within the citation, or the larger org document.
Ok, I'll try with this command.