diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-05-07 00:22:19 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-05-07 00:22:19 -0400 |
commit | edd6ca2281f07634a5eb57543295ef9f7208cf99 (patch) | |
tree | 31f29ef127a4b3cd4d154817297a8e8a086956fe | |
parent | fa92c538cb1a75636d395dfe09ad3e32e06823a9 (diff) | |
download | bog-edd6ca2281f07634a5eb57543295ef9f7208cf99.tar.gz |
Add bog-citekey-tree-to-indirect-buffer
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | README | 1 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | bog.el | 22 |
4 files changed, 26 insertions, 0 deletions
@@ -18,6 +18,8 @@ custom Bog commands for the Org agenda have been removed because this functionality is now available through =bog-commander=. +- Add command =bog-citekey-tree-to-indirect-buffer=. + ** Other changes - =bog-goto-citekey-heading-in-buffer= and @@ -101,6 +101,7 @@ Other useful functions include - =bog-goto-citekey-heading-in-buffer= - =bog-goto-citekey-heading-in-notes= +- =bog-citekey-tree-to-indirect-buffer= - =bog-refile= - =bog-search-notes= - =bog-search-notes-for-citekey= @@ -89,6 +89,7 @@ Other useful functions include - `bog-goto-citekey-heading-in-buffer` - `bog-goto-citekey-heading-in-notes` +- `bog-citekey-tree-to-indirect-buffer` - `bog-refile` - `bog-search-notes` - `bog-search-notes-for-citekey` @@ -651,6 +651,27 @@ buffer, the narrowing is removed." (org-show-context)) (message "Heading for %s not found in notes" citekey)))) +(defun bog-citekey-tree-to-indirect-buffer (&optional no-context) + "Open subtree for citekey in an indirect buffer. + +The citekey will be taken from the text under point if it matches +`bog-citekey-format'. + +With prefix argument NO-CONTEXT, a prompt will open to select +from all citekeys for headings in notes. This same prompt will be +opened if locating a citekey from context fails." + (interactive "P") + (let* ((citekey (bog-citekey-from-point-or-all-headings no-context)) + (marker + (org-find-exact-heading-in-directory citekey bog-notes-directory))) + (if marker + (with-current-buffer (marker-buffer marker) + (save-excursion + (save-restriction + (goto-char (marker-position marker)) + (org-tree-to-indirect-buffer)))) + (message "Heading for %s not found in notes" citekey)))) + (defun bog-refile () "Refile heading within notes. All headings from Org files in `bog-notes-directory' at or above @@ -825,6 +846,7 @@ chosen." (define-key prefix-map "g" 'bog-search-citekey-on-web) (define-key prefix-map "h" 'bog-goto-citekey-heading-in-buffer) (define-key prefix-map "H" 'bog-goto-citekey-heading-in-notes) + (define-key prefix-map "i" 'bog-citekey-tree-to-indirect-buffer) (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) |