From f17083abfd13b947f8c3a819449cc372c13511df Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 15 Oct 2014 02:18:51 -0400 Subject: Add command bog-insert-heading-citekey --- bog.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bog.el') diff --git a/bog.el b/bog.el index 78f16df..8d6b10f 100644 --- a/bog.el +++ b/bog.el @@ -742,6 +742,17 @@ Sorting is only done if the heading's level matches (not (bog-citekey-from-heading))) (org-sort-entries nil sorting-type)))) +(defun bog-insert-heading-citekey (&optional current-buffer) + "Select a citekey to insert at point. +By default, offer heading citekeys from all files. With prefix +argument CURRENT-BUFFER, limit to heading citekeys from the +current buffer." + (interactive "P") + (let ((citekey-func (if current-buffer + 'bog-heading-citekeys-in-buffer + 'bog-all-heading-citekeys))) + (insert (bog-select-citekey (funcall citekey-func))))) + ;;; Font-lock @@ -862,6 +873,7 @@ chosen." (define-key prefix-map "r" 'bog-rename-staged-file-to-citekey) (define-key prefix-map "s" 'bog-search-notes) (define-key prefix-map "w" 'bog-refile) + (define-key prefix-map "y" 'bog-insert-heading-citekey) (define-key map bog-keymap-prefix prefix-map)) map) "Keymap for Bog.") -- cgit v1.2.3