mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-23 02:10:42 +00:00
Merge branch 'master' into max-sticky-agenda
This commit is contained in:
commit
cf55d4338a
|
@ -2935,7 +2935,7 @@ the current buffer."
|
||||||
(insert string)
|
(insert string)
|
||||||
(org-element-parse-objects (point-min) (point-max) nil restriction)))
|
(org-element-parse-objects (point-min) (point-max) nil restriction)))
|
||||||
|
|
||||||
(defun org-element-map (data types fun &optional info first-match)
|
(defun org-element-map (data types fun &optional info first-match no-recursion)
|
||||||
"Map a function on selected elements or objects.
|
"Map a function on selected elements or objects.
|
||||||
|
|
||||||
DATA is the parsed tree, as returned by, i.e,
|
DATA is the parsed tree, as returned by, i.e,
|
||||||
|
@ -2951,9 +2951,15 @@ not exportable according to that property list will be skipped.
|
||||||
When optional argument FIRST-MATCH is non-nil, stop at the first
|
When optional argument FIRST-MATCH is non-nil, stop at the first
|
||||||
match for which FUN doesn't return nil, and return that value.
|
match for which FUN doesn't return nil, and return that value.
|
||||||
|
|
||||||
Nil values returned from FUN are ignored in the result."
|
Optional argument NO-RECURSION is a symbol or a list of symbols
|
||||||
;; Ensure TYPES is a list, even of one element.
|
representing elements or objects types. `org-element-map' won't
|
||||||
|
enter any recursive element or object whose type belongs to that
|
||||||
|
list. Though, FUN can still be applied on them.
|
||||||
|
|
||||||
|
Nil values returned from FUN do not appear in the results."
|
||||||
|
;; Ensure TYPES and NO-RECURSION are a list, even of one element.
|
||||||
(unless (listp types) (setq types (list types)))
|
(unless (listp types) (setq types (list types)))
|
||||||
|
(unless (listp no-recursion) (setq no-recursion (list no-recursion)))
|
||||||
;; Recursion depth is determined by --CATEGORY.
|
;; Recursion depth is determined by --CATEGORY.
|
||||||
(let* ((--category
|
(let* ((--category
|
||||||
(cond
|
(cond
|
||||||
|
@ -3008,12 +3014,13 @@ Nil values returned from FUN are ignored in the result."
|
||||||
--blob))))
|
--blob))))
|
||||||
;; Now determine if a recursion into --BLOB is
|
;; Now determine if a recursion into --BLOB is
|
||||||
;; possible. If so, do it.
|
;; possible. If so, do it.
|
||||||
(when (or (memq --type org-element-recursive-objects)
|
(unless (memq --type no-recursion)
|
||||||
(and (memq --type org-element-all-elements)
|
(when (or (and (memq --type org-element-greater-elements)
|
||||||
(not (eq --category 'elements)))
|
(not (eq --category 'greater-elements)))
|
||||||
(and (memq --type org-element-greater-elements)
|
(and (memq --type org-element-all-elements)
|
||||||
(not (eq --category 'greater-elements))))
|
(not (eq --category 'elements)))
|
||||||
(funcall --walk-tree --blob)))))
|
(memq --type org-element-recursive-objects))
|
||||||
|
(funcall --walk-tree --blob))))))
|
||||||
(org-element-contents --data))))))
|
(org-element-contents --data))))))
|
||||||
(catch 'first-match
|
(catch 'first-match
|
||||||
(funcall --walk-tree data)
|
(funcall --walk-tree data)
|
||||||
|
|
|
@ -2459,9 +2459,9 @@ DATA is the parse tree from which definitions are collected.
|
||||||
INFO is the plist used as a communication channel.
|
INFO is the plist used as a communication channel.
|
||||||
|
|
||||||
Definitions are sorted by order of references. They either
|
Definitions are sorted by order of references. They either
|
||||||
appear as Org data \(transcoded with `org-export-data'\) or as
|
appear as Org data (transcoded with `org-export-data') or as
|
||||||
a secondary string for inlined footnotes \(transcoded with
|
a secondary string for inlined footnotes (transcoded with
|
||||||
`org-export-secondary-string'\). Unreferenced definitions are
|
`org-export-secondary-string'). Unreferenced definitions are
|
||||||
ignored."
|
ignored."
|
||||||
(let (num-alist
|
(let (num-alist
|
||||||
(collect-fn
|
(collect-fn
|
||||||
|
@ -2481,10 +2481,11 @@ ignored."
|
||||||
;; Also search in definition for nested footnotes.
|
;; Also search in definition for nested footnotes.
|
||||||
(when (eq (org-element-property :type fn) 'standard)
|
(when (eq (org-element-property :type fn) 'standard)
|
||||||
(funcall collect-fn def)))))
|
(funcall collect-fn def)))))
|
||||||
info)
|
;; Don't enter footnote definitions since it will happen
|
||||||
;; Return final value.
|
;; when their first reference is found.
|
||||||
(reverse num-alist)))))
|
info nil 'footnote-definition)))))
|
||||||
(funcall collect-fn (plist-get info :parse-tree))))
|
(funcall collect-fn (plist-get info :parse-tree))
|
||||||
|
(reverse num-alist)))
|
||||||
|
|
||||||
(defun org-export-footnote-first-reference-p (footnote-reference info)
|
(defun org-export-footnote-first-reference-p (footnote-reference info)
|
||||||
"Non-nil when a footnote reference is the first one for its label.
|
"Non-nil when a footnote reference is the first one for its label.
|
||||||
|
@ -2512,7 +2513,9 @@ INFO is the plist used as a communication channel."
|
||||||
((eq (org-element-property :type fn) 'standard)
|
((eq (org-element-property :type fn) 'standard)
|
||||||
(funcall search-refs
|
(funcall search-refs
|
||||||
(org-export-get-footnote-definition fn info)))))
|
(org-export-get-footnote-definition fn info)))))
|
||||||
info 'first-match)))))
|
;; Don't enter footnote definitions since it will
|
||||||
|
;; happen when their first reference is found.
|
||||||
|
info 'first-match 'footnote-definition)))))
|
||||||
(equal (catch 'exit (funcall search-refs (plist-get info :parse-tree)))
|
(equal (catch 'exit (funcall search-refs (plist-get info :parse-tree)))
|
||||||
footnote-reference)))))
|
footnote-reference)))))
|
||||||
|
|
||||||
|
@ -2564,7 +2567,9 @@ INFO is the plist used as a communication channel."
|
||||||
(funcall search-ref
|
(funcall search-ref
|
||||||
(org-export-get-footnote-definition fn info))
|
(org-export-get-footnote-definition fn info))
|
||||||
nil))))
|
nil))))
|
||||||
info 'first-match)))))
|
;; Don't enter footnote definitions since it will happen
|
||||||
|
;; when their first reference is found.
|
||||||
|
info 'first-match 'footnote-definition)))))
|
||||||
(catch 'exit (funcall search-ref (plist-get info :parse-tree)))))
|
(catch 'exit (funcall search-ref (plist-get info :parse-tree)))))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,9 @@ text
|
||||||
;; Region.
|
;; Region.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(forward-line 3)
|
(forward-line 3)
|
||||||
(mark-paragraph)
|
(transient-mark-mode 1)
|
||||||
|
(push-mark (point) t t)
|
||||||
|
(goto-char (point-at-eol))
|
||||||
(should (equal (org-export-as 'test) "text\n")))))
|
(should (equal (org-export-as 'test) "text\n")))))
|
||||||
|
|
||||||
(ert-deftest test-org-export/export-snippet ()
|
(ert-deftest test-org-export/export-snippet ()
|
||||||
|
@ -363,7 +365,20 @@ body\n")))
|
||||||
info (org-export-collect-tree-properties tree info 'test)))
|
info (org-export-collect-tree-properties tree info 'test)))
|
||||||
;; Both footnotes should be seen.
|
;; Both footnotes should be seen.
|
||||||
(should
|
(should
|
||||||
(= (length (org-export-collect-footnote-definitions tree info)) 2))))))
|
(= (length (org-export-collect-footnote-definitions tree info)) 2))))
|
||||||
|
;; 4. Test footnotes definitions collection.
|
||||||
|
(org-test-with-temp-text "Text[fn:1:A[fn:2]] [fn:3].
|
||||||
|
|
||||||
|
\[fn:2] B [fn:3] [fn::D].
|
||||||
|
|
||||||
|
\[fn:3] C."
|
||||||
|
(let ((tree (org-element-parse-buffer))
|
||||||
|
(info (org-combine-plists
|
||||||
|
(org-export-initial-options) '(:with-footnotes t))))
|
||||||
|
(setq info (org-combine-plists
|
||||||
|
info (org-export-collect-tree-properties tree info 'test)))
|
||||||
|
(should (= (length (org-export-collect-footnote-definitions tree info))
|
||||||
|
4))))))
|
||||||
|
|
||||||
(ert-deftest test-org-export/fuzzy-links ()
|
(ert-deftest test-org-export/fuzzy-links ()
|
||||||
"Test fuzz link export specifications."
|
"Test fuzz link export specifications."
|
||||||
|
|
|
@ -210,16 +210,20 @@ Footnotes:
|
||||||
|
|
||||||
\[1] Definition"))))
|
\[1] Definition"))))
|
||||||
;; 3. As an exception, in `message-mode' buffer, if a signature is
|
;; 3. As an exception, in `message-mode' buffer, if a signature is
|
||||||
;; present, insert footnotes before it.
|
;; present, insert footnotes before it.n
|
||||||
(let ((org-footnote-tag-for-non-org-mode-files nil)
|
(let ((org-footnote-tag-for-non-org-mode-files nil))
|
||||||
(message-signature-separator "^-- $"))
|
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
(insert "Body[fn::def]
|
(insert "Body[fn::def]
|
||||||
--
|
--
|
||||||
Fake signature
|
Fake signature
|
||||||
--
|
--
|
||||||
Signature")
|
Signature")
|
||||||
(let ((major-mode 'message-mode)) (org-footnote-normalize))
|
;; Mimic `message-mode'.
|
||||||
|
(let ((major-mode 'message-mode)
|
||||||
|
(message-cite-prefix-regexp "\\([ ]*[_.[:word:]]+>+\\|[ ]*[]>|]\\)+")
|
||||||
|
(message-signature-separator "^-- $"))
|
||||||
|
(flet ((message-point-in-header-p nil nil))
|
||||||
|
(org-footnote-normalize)))
|
||||||
(should
|
(should
|
||||||
(equal (buffer-string)
|
(equal (buffer-string)
|
||||||
"Body[1]
|
"Body[1]
|
||||||
|
|
Loading…
Reference in a new issue