From 5ceb4f6729841a713a9ec2c14ce5bdc0a295e7b4 Mon Sep 17 00:00:00 2001 From: Nicolas Petton Date: Wed, 3 Mar 2021 22:27:06 +0100 Subject: Fix an edge case in `nroam-backlinks--crawl-source’ * nroam-backlinks.el (nroam-backlinks--crawl-source): Do not attempt to get the full outline when outline is nil, as `org-get-outline-path’ will throw. --- nroam-backlinks.el | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nroam-backlinks.el b/nroam-backlinks.el index 48444c7..5619fdc 100644 --- a/nroam-backlinks.el +++ b/nroam-backlinks.el @@ -108,13 +108,16 @@ (with-current-buffer (nroam-backlinks--work-buffer) (insert-file-contents file nil nil nil 'replace) (goto-char point) - (let ((elt (org-element-at-point))) - (let ((begin (org-element-property :begin elt)) - (end (org-element-property :end elt)) - (type (org-element-type elt)) - (outline (org-get-outline-path)) - (full-outline (org-get-outline-path 'with-self))) - `(:type ,type :string ,(buffer-substring begin end) :full-outline ,full-outline :outline ,outline))))) + (let* ((elt (org-element-at-point)) + (begin (org-element-property :begin elt)) + (end (org-element-property :end elt)) + (type (org-element-type elt)) + (outline (org-get-outline-path)) + (full-outline (and outline (org-get-outline-path 'with-self)))) + `(:type ,type + :string ,(buffer-substring begin end) + :outline ,outline + :full-outline ,full-outline)))) (defun nroam-backlinks--hide-drawers () "Fold all drawers starting at POINT in the current buffer." -- cgit v1.2.3-54-g00ecf