summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-03-06 02:06:45 -0500
committerKyle Meyer <kyle@kyleam.com>2015-03-06 02:06:45 -0500
commit4724604e72396d6cdf4371f0263ed55b2a646d40 (patch)
treeaac1b5d27d4206ff9b9d16f43c4171bfae701ad3
parent6baf69ba88998595940daab8896724ba430a4d2a (diff)
downloadbog-4724604e72396d6cdf4371f0263ed55b2a646d40.tar.gz
Move bog-goto-citekey-heading-in-notes
Join helper functions that used to be positioned near bog-goto-citekey-heading-in-buffer [1] with bog-goto-citekey-heading-in-notes helper functions. [1] 6baf69ba88998595940daab8896724ba430a4d2a
-rw-r--r--bog.el60
1 files changed, 30 insertions, 30 deletions
diff --git a/bog.el b/bog.el
index adfe25c..6bd526d 100644
--- a/bog.el
+++ b/bog.el
@@ -873,36 +873,6 @@ Groups are specified by `bog-citekey-web-search-groups'."
;;; Notes-related
-(defun bog--find-citekey-heading-in-buffer (citekey &optional pos-only)
- "Return the marker of heading for CITEKEY.
-CITEKEY can either be the heading title or the property value of
-the key `bog-citekey-property'. If POS-ONLY is non-nil, return
-the position instead of a marker."
- (or (org-find-exact-headline-in-buffer citekey nil pos-only)
- (bog--find-citekey-property-in-buffer citekey nil pos-only)))
-
-(defun bog--find-citekey-property-in-buffer (citekey &optional buffer pos-only)
- "Return marker in BUFFER for heading with CITEKEY as a property value.
-The property key must match `bog-citekey-property'. If POS-ONLY
-is non-nil, return the position instead of a marker."
- (with-current-buffer (or buffer (current-buffer))
- (save-excursion
- (save-restriction
- (widen)
- (goto-char (point-min))
- (catch 'found
- (while (re-search-forward (concat "\\b" citekey "\\b") nil t)
- (save-excursion
- (beginning-of-line)
- (when (and (looking-at org-property-re)
- (equal (downcase (match-string 2))
- (downcase bog-citekey-property)))
- (org-back-to-heading t)
- (throw 'found
- (if pos-only
- (point)
- (move-marker (make-marker) (point))))))))))))
-
(defun bog-goto-citekey-heading-in-notes (&optional no-context)
"Find citekey heading in notes.
@@ -935,6 +905,36 @@ buffer, the narrowing is removed."
(org-show-context))
(message "Heading for %s not found in notes" citekey))))
+(defun bog--find-citekey-heading-in-buffer (citekey &optional pos-only)
+ "Return the marker of heading for CITEKEY.
+CITEKEY can either be the heading title or the property value of
+the key `bog-citekey-property'. If POS-ONLY is non-nil, return
+the position instead of a marker."
+ (or (org-find-exact-headline-in-buffer citekey nil pos-only)
+ (bog--find-citekey-property-in-buffer citekey nil pos-only)))
+
+(defun bog--find-citekey-property-in-buffer (citekey &optional buffer pos-only)
+ "Return marker in BUFFER for heading with CITEKEY as a property value.
+The property key must match `bog-citekey-property'. If POS-ONLY
+is non-nil, return the position instead of a marker."
+ (with-current-buffer (or buffer (current-buffer))
+ (save-excursion
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (catch 'found
+ (while (re-search-forward (concat "\\b" citekey "\\b") nil t)
+ (save-excursion
+ (beginning-of-line)
+ (when (and (looking-at org-property-re)
+ (equal (downcase (match-string 2))
+ (downcase bog-citekey-property)))
+ (org-back-to-heading t)
+ (throw 'found
+ (if pos-only
+ (point)
+ (move-marker (make-marker) (point))))))))))))
+
(defun bog--find-citekey-heading-in-notes (citekey)
"Return the marker of heading for CITEKEY in notes.
CITEKEY can either be the heading title or the property value of