浏览代码

ox: Change order of retured elements in `org-export-get-previous-element'

* lisp/ox.el (org-export-get-previous-element): Change order of
  retured elements in `org-export-get-previous-element'.
* testing/lisp/test-ox.el: Update test.
Nicolas Goaziou 12 年之前
父节点
当前提交
367e680582
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 4 4
      lisp/ox.el
  2. 3 3
      testing/lisp/test-ox.el

+ 4 - 4
lisp/ox.el

@@ -4800,8 +4800,8 @@ a communication channel.  Return previous exportable element or
 object, a string, or nil.
 
 When optional argument N is a positive integer, return a list
-containing up to N siblings before BLOB, from closest to
-farthest.  With any other non-nil value, return a list containing
+containing up to N siblings before BLOB, from farthest to
+closest.  With any other non-nil value, return a list containing
 all of them."
   (let ((siblings
 	 ;; An object can belong to the contents of its parent or
@@ -4823,10 +4823,10 @@ all of them."
 	      (cond ((memq obj (plist-get info :ignore-list)))
 		    ((null n) (throw 'exit obj))
 		    ((not (wholenump n)) (push obj prev))
-		    ((zerop n) (throw 'exit (nreverse prev)))
+		    ((zerop n) (throw 'exit prev))
 		    (t (decf n) (push obj prev))))
 	    (cdr (memq blob (reverse siblings))))
-      (nreverse prev))))
+      prev)))
 
 (defun org-export-get-next-element (blob info &optional n)
   "Return next element or object.

+ 3 - 3
testing/lisp/test-ox.el

@@ -2340,7 +2340,7 @@ Another text. (ref:text)
 	 (org-element-type
 	  (org-export-get-previous-element
 	   (org-element-map
-	    (plist-get info :title) 'plain-text 'identity info t) info)))))
+	       (plist-get info :title) 'plain-text 'identity info t) info)))))
   ;; Find previous element in parsed affiliated keywords.
   (should
    (eq 'verbatim
@@ -2351,7 +2351,7 @@ Another text. (ref:text)
   ;; With optional argument N, return a list containing up to
   ;; N previous elements.
   (should
-   (equal '(bold italic underline)
+   (equal '(underline italic bold)
 	  (org-test-with-parsed-data "_a_ /b/ *c* ~d~"
 	    (mapcar 'car
 		    (org-export-get-previous-element
@@ -2359,7 +2359,7 @@ Another text. (ref:text)
   ;; When N is a positive integer, return a list containing up to
   ;; N previous elements.
   (should
-   (equal '(bold italic)
+   (equal '(italic bold)
 	  (org-test-with-parsed-data "_a_ /b/ *c* ~d~"
 	    (mapcar 'car
 		    (org-export-get-previous-element