summaryrefslogtreecommitdiff
path: root/bog.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-05-01 21:57:37 -0400
committerKyle Meyer <kyle@kyleam.com>2014-05-01 22:47:39 -0400
commit525ea791daf2f80ecffdf167c9405fb424f00222 (patch)
tree8729219a355013b22b8d9b712472e57d17af8c1e /bog.el
parent058b3a82ee42327fb86257949dca5cf4ab9ee1bd (diff)
downloadbog-525ea791daf2f80ecffdf167c9405fb424f00222.tar.gz
Hook up other functions to citekey selection
Diffstat (limited to 'bog.el')
-rw-r--r--bog.el67
1 files changed, 45 insertions, 22 deletions
diff --git a/bog.el b/bog.el
index 6ec66aa..c648bd2 100644
--- a/bog.el
+++ b/bog.el
@@ -384,12 +384,18 @@ opened if locating a citekey from context fails."
patterns)))
;;;###autoload
-(defun bog-rename-staged-file-to-citekey ()
+(defun bog-rename-staged-file-to-citekey (&optional no-context)
"Rename citekey file in `bog-stage-directory' with `bog-file-renaming-func'.
+
The citekey will be taken from the text under point if it matches
-`bog-citekey-format' or using `bog-citekey-func'."
- (interactive)
- (let ((citekey (bog-citekey-from-notes)))
+`bog-citekey-format' or from the current subtree using
+`bog-citekey-func'.
+
+With prefix argument NO-CONTEXT, a prompt will open to select
+from citekeys for all associated files. This same prompt will be
+opened if locating a citekey from context fails."
+ (interactive "P")
+ (let ((citekey (bog-citekey-from-notes-or-all no-context)))
(bog-rename-staged-file citekey)))
(defun bog-rename-staged-file (citekey)
@@ -571,15 +577,23 @@ instead of citekeys from file names in `bog-bib-directory'."
;;; Web
;;;###autoload
-(defun bog-search-citekey-on-web ()
+(defun bog-search-citekey-on-web (&optional no-context)
"Open browser and perform query based for a citekey.
The URL will be taken from `bog-web-search-url'.
The citekey is split by groups in `bog-citekey-format' and joined by
-\"+\" to form the query string."
- (interactive)
- (let ((citekey (bog-citekey-from-notes)))
+\"+\" to form the query string.
+
+The citekey will be taken from the text under point if it matches
+`bog-citekey-format' or from the current subtree using
+`bog-citekey-func'.
+
+With prefix argument NO-CONTEXT, a prompt will open to select
+from all citekeys present in notes. This same prompt will be
+opened if locating a citekey from context fails."
+ (interactive "P")
+ (let ((citekey (bog-citekey-from-notes-or-all no-context)))
(bog-open-citekey-on-web citekey)))
(defun bog-open-citekey-on-web (citekey)
@@ -594,13 +608,17 @@ The citekey is split by groups in `bog-citekey-format' and joined by
;;; Notes-related
-(defun bog-goto-citekey-heading-in-buffer ()
+(defun bog-goto-citekey-heading-in-buffer (&optional no-context)
"Find citekey heading in this buffer.
+
The citekey will be taken from the text under point if it matches
-`bog-citekey-format'."
- (interactive)
- (let* ((citekey (or (bog-citekey-at-point)
- (read-string "Enter citekey: ")))
+`bog-citekey-format'.
+
+With prefix argument NO-CONTEXT, a prompt will open to select
+from all citekeys for headings in the current buffer. This same
+prompt will be opened if locating a citekey from context fails."
+ (interactive "P")
+ (let* ((citekey (bog-citekey-from-point-or-buffer-headings no-context))
(pos (org-find-exact-headline-in-buffer citekey nil t)))
(if pos
(progn
@@ -609,16 +627,21 @@ The citekey will be taken from the text under point if it matches
(org-show-context))
(message "Heading for %s not found in buffer" citekey))))
-(defun bog-goto-citekey-heading-in-notes ()
+(defun bog-goto-citekey-heading-in-notes (&optional no-context)
"Find citekey heading in notes.
-All org files in `bog-notes-directory' will be searched. The
-citekey will be taken from the text under point if it matches
-`bog-citekey-format'."
- (interactive)
- (let* ((citekey (or (bog-citekey-at-point)
- (read-string "Enter citekey: ")))
- (marker
- (org-find-exact-heading-in-directory citekey bog-notes-directory)))
+
+All org files in `bog-notes-directory' will be searched.
+
+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
(progn
(switch-to-buffer (marker-buffer marker))