summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-10-16 00:33:24 -0400
committerKyle Meyer <kyle@kyleam.com>2014-10-16 00:33:24 -0400
commit3dcb4aa8b0546b1ac397f14c289952cc1d73eeb0 (patch)
treed133048c8ade4f04c6e5ee5d1b7938fe0cc7576f
parente04264320cad945527db4ea3ec92f45ac6d0a734 (diff)
downloadbog-3dcb4aa8b0546b1ac397f14c289952cc1d73eeb0.tar.gz
bog-citekey-from-heading-title: Cover edge case
Don't throw error if point is before first heading.
-rw-r--r--bog.el6
1 files changed, 3 insertions, 3 deletions
diff --git a/bog.el b/bog.el
index 587921f..18abe4d 100644
--- a/bog.el
+++ b/bog.el
@@ -265,9 +265,9 @@ year, and the first meaningful word in the title)."
(bog-citekey-from-property)))
(defun bog-citekey-from-heading-title ()
- (let ((title (org-no-properties (org-get-heading t t))))
- (when (bog-citekey-p title)
- title)))
+ (--if-let (ignore-errors (org-no-properties (org-get-heading t t)))
+ (when (bog-citekey-p it)
+ it)))
(defun bog-citekey-from-property ()
(-when-let (prop (org-entry-get (point) bog-citekey-property))