Skip to content

Commit

Permalink
add save citekey note action (#35)
Browse files Browse the repository at this point in the history
New note action: save current note's citekey to kill-ring and clipboard.
myshevchuk authored May 5, 2020
1 parent 1edb446 commit 8574802
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion orb-note-actions.el
Original file line number Diff line number Diff line change
@@ -68,7 +68,8 @@
:group 'org-roam-bibtex)

(defcustom orb-note-actions-extra
'(("Show record in the bibtex file" . bibtex-completion-show-entry))
'(("Save citekey to kill-ring and clipboard" . orb-note-actions-copy-citekey)
("Show record in the bibtex file" . bibtex-completion-show-entry))
"Extra actions for `orb-note-actions'.
Each action is a cons cell DESCRIPTION . FUNCTION."
:type '(alist
@@ -176,6 +177,15 @@ CITEKEY is the citekey." (capitalize frontend-name))
(let ((fun (intern (concat "orb-note-actions--" (symbol-name frontend)))))
(funcall fun citekey)))

;; * Note actions

(defun orb-note-actions-copy-citekey (citekey)
"Save note's citekey to kill-ring and copy it to clipboard.
Since CITEKEY is actually a list of one element, the car of the list is used."
(with-temp-buffer
(insert (car citekey))
(copy-region-as-kill (point-min) (point-max))))

;; * Main functions

;;;###autoload

0 comments on commit 8574802

Please sign in to comment.