diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-10-15 02:18:51 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-10-15 02:28:05 -0400 |
commit | f17083abfd13b947f8c3a819449cc372c13511df (patch) | |
tree | 186802769d8fc93a283fcb2c4a58809443463644 | |
parent | f143cbd5e34a553a6a195649746a7a303d8e2fbf (diff) | |
download | bog-f17083abfd13b947f8c3a819449cc372c13511df.tar.gz |
Add command bog-insert-heading-citekey
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | bog.el | 12 |
3 files changed, 14 insertions, 0 deletions
@@ -105,6 +105,7 @@ Other useful functions include - =bog-search-notes-for-citekey= - =bog-sort-topic-headings-in-buffer= - =bog-sort-topic-headings-in-notes= +- =bog-insert-heading-citekey= * Variables @@ -94,6 +94,7 @@ Other useful functions include - `bog-search-notes-for-citekey` - `bog-sort-topic-headings-in-buffer` - `bog-sort-topic-headings-in-notes` +- `bog-insert-heading-citekey` # Variables @@ -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.") |