Browse Source

org-format-outline-path: Ignore nil path elements

* lisp/org.el (org-format-outline-path): Ignore nil path elements.
* testing/lisp/test-org.el (test-org/format-outline-path): Add test.

The PATH argument shouldn't contain a nil item.  However, this didn't
fail before 1c74002, and helm-get-org-candidates-in-file relies on this
behavior, so prevent it from failing now.

Reported-by: Simon Thum <simon.thum@gmx.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/102411>
Kyle Meyer 3 years ago
parent
commit
59d706219b
2 changed files with 4 additions and 0 deletions
  1. 1 0
      lisp/org.el
  2. 3 0
      testing/lisp/test-org.el

+ 1 - 0
lisp/org.el

@@ -11751,6 +11751,7 @@ such as the file name.
 SEPARATOR is inserted between the different parts of the path,
 the default is \"/\"."
   (setq width (or width 79))
+  (setq path (delq nil path))
   (unless (> width 0)
     (user-error "Argument `width' must be positive"))
   (setq separator (or separator "/"))

+ 3 - 0
testing/lisp/test-org.el

@@ -1319,6 +1319,9 @@
   (should
    (string= (org-format-outline-path '())
 	    ""))
+  (should
+   (string= (org-format-outline-path '(nil))
+	    ""))
   ;; Empty path and prefix.
   (should
    (string= (org-format-outline-path '() nil ">>")