Selaa lähdekoodia

Merge branch 'maint'

Nicolas Goaziou 9 vuotta sitten
vanhempi
commit
cec775fa06
2 muutettua tiedostoa jossa 15 lisäystä ja 8 poistoa
  1. 9 7
      lisp/org.el
  2. 6 1
      testing/lisp/test-org.el

+ 9 - 7
lisp/org.el

@@ -11600,18 +11600,20 @@ order.")
 
 Outline path is a list of strings, in reverse order.  When
 optional argument USE-CACHE is non-nil, make use of a cache.  See
-`org-get-outline-path' for delails.
+`org-get-outline-path' for details.
 
 Assume buffer is widened."
   (org-back-to-heading t)
   (or (and use-cache (cdr (assq (point) org-outline-path-cache)))
       (let ((p (point))
-	    (heading (progn (looking-at org-complex-heading-regexp)
-			    (org-trim
-			     ;; Remove statistical/checkboxes cookies.
-			     (replace-regexp-in-string
-			      "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
-			      (org-match-string-no-properties 4))))))
+	    (heading (progn
+		       (looking-at org-complex-heading-regexp)
+		       (if (not (match-end 4)) ""
+			 ;; Remove statistics cookies.
+			 (org-trim
+			  (replace-regexp-in-string
+			   "\\[[0-9]+%\\]\\|\\[[0-9]+/[0-9]+\\]" ""
+			   (org-match-string-no-properties 4)))))))
 	(if (org-up-heading-safe)
 	    (let ((path (cons heading (org--get-outline-path-1 use-cache))))
 	      (when use-cache

+ 6 - 1
testing/lisp/test-org.el

@@ -1437,7 +1437,12 @@
 	    (setq org-outline-path-cache nil)
 	    (org-get-outline-path t)
 	    (search-forward "S2")
-	    (org-get-outline-path t)))))
+	    (org-get-outline-path t))))
+  ;; Do not choke on empty headlines.
+  (should
+   (org-test-with-temp-text "* "
+     (setq org-outline-path-cache nil)
+     (org-get-outline-path t))))
 
 (ert-deftest test-org/format-outline-path ()
   "Test `org-format-outline-path' specifications."