From e9e756331cfcce89455adfacac677f7dc2a4356c Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Tue, 8 Oct 2019 20:55:51 -0500 Subject: [PATCH] Fix: (--outline-path) Always return a string org-heading-components returns nil for a heading without heading text, which causes string-match to signal an error. So we'll match the regexp ourselves and return an empty string in that case. Should be slightly faster, anyway. --- org-ql.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org-ql.el b/org-ql.el index c7b9ea3..db3fb85 100644 --- a/org-ql.el +++ b/org-ql.el @@ -429,7 +429,10 @@ Returns cons (INHERITED-TAGS . LOCAL-TAGS)." (defun org-ql--outline-path () "Return outline path for heading at point." (save-excursion - (let ((heading (nth 4 (org-heading-components)))) + (let ((heading (save-match-data + (if (looking-at org-complex-heading-regexp) + (or (match-string 4) "") + "")))) (if (org-up-heading-safe) ;; MAYBE: It seems wrong to call the cache function from ;; inside this function, like a violation of separation of