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.
This commit is contained in:
Adam Porter 2019-10-08 20:55:51 -05:00
parent da9be83326
commit e9e756331c

View file

@ -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