1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-26 07:33:39 +00:00

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.
This commit is contained in:
Nicolas Goaziou 2013-02-25 23:16:14 +01:00
parent 7cd6fdcd34
commit 367e680582
2 changed files with 7 additions and 7 deletions

View File

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

View File

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