org-export: Suppress some byte-compiling warnings
This commit is contained in:
parent
a147dc3150
commit
3f0f8734ff
|
@ -1116,8 +1116,7 @@ Return options as a plist."
|
||||||
(plist-put
|
(plist-put
|
||||||
plist :title
|
plist :title
|
||||||
(org-element-parse-secondary-string
|
(org-element-parse-secondary-string
|
||||||
prop
|
prop (org-element-restriction 'keyword)))))
|
||||||
(cdr (assq 'keyword org-element-string-restrictions))))))
|
|
||||||
(when (setq prop (org-entry-get (point) "EXPORT_TEXT"))
|
(when (setq prop (org-entry-get (point) "EXPORT_TEXT"))
|
||||||
(setq plist (plist-put plist :text prop)))
|
(setq plist (plist-put plist :text prop)))
|
||||||
(when (setq prop (org-entry-get (point) "EXPORT_AUTHOR"))
|
(when (setq prop (org-entry-get (point) "EXPORT_AUTHOR"))
|
||||||
|
@ -1489,26 +1488,28 @@ associated numbering \(in the shape of a list of numbers\)."
|
||||||
"Return list of elements and objects to ignore during export.
|
"Return list of elements and objects to ignore during export.
|
||||||
DATA is the parse tree to traverse. OPTIONS is the plist holding
|
DATA is the parse tree to traverse. OPTIONS is the plist holding
|
||||||
export options."
|
export options."
|
||||||
(let (ignore
|
(let* (ignore
|
||||||
(walk-data
|
walk-data ; for byte-compiler.
|
||||||
(function
|
(walk-data
|
||||||
(lambda (data options selected)
|
(function
|
||||||
;; Collect ignored elements or objects into IGNORE-LIST.
|
(lambda (data options selected)
|
||||||
(mapc
|
;; Collect ignored elements or objects into IGNORE-LIST.
|
||||||
(lambda (el)
|
(mapc
|
||||||
(if (org-export--skip-p el options selected) (push el ignore)
|
(lambda (el)
|
||||||
(let ((type (org-element-type el)))
|
(if (org-export--skip-p el options selected) (push el ignore)
|
||||||
(if (and (eq (plist-get info :with-archived-trees) 'headline)
|
(let ((type (org-element-type el)))
|
||||||
(eq (org-element-type el) 'headline)
|
(if (and (eq (plist-get options :with-archived-trees)
|
||||||
(org-element-property :archivedp el))
|
'headline)
|
||||||
;; If headline is archived but tree below has
|
(eq (org-element-type el) 'headline)
|
||||||
;; to be skipped, add it to ignore list.
|
(org-element-property :archivedp el))
|
||||||
(mapc (lambda (e) (push e ignore))
|
;; If headline is archived but tree below has
|
||||||
(org-element-contents el))
|
;; to be skipped, add it to ignore list.
|
||||||
;; Move into recursive objects/elements.
|
(mapc (lambda (e) (push e ignore))
|
||||||
(when (org-element-contents el)
|
(org-element-contents el))
|
||||||
(funcall walk-data el options selected))))))
|
;; Move into recursive objects/elements.
|
||||||
(org-element-contents data))))))
|
(when (org-element-contents el)
|
||||||
|
(funcall walk-data el options selected))))))
|
||||||
|
(org-element-contents data))))))
|
||||||
;; Main call. First find trees containing a select tag, if any.
|
;; Main call. First find trees containing a select tag, if any.
|
||||||
(funcall walk-data data options (org-export--selected-trees data options))
|
(funcall walk-data data options (org-export--selected-trees data options))
|
||||||
;; Return value.
|
;; Return value.
|
||||||
|
@ -1518,29 +1519,30 @@ export options."
|
||||||
"Return list of headlines containing a select tag in their tree.
|
"Return list of headlines containing a select tag in their tree.
|
||||||
DATA is parsed data as returned by `org-element-parse-buffer'.
|
DATA is parsed data as returned by `org-element-parse-buffer'.
|
||||||
INFO is a plist holding export options."
|
INFO is a plist holding export options."
|
||||||
(let (selected-trees
|
(let* (selected-trees
|
||||||
(walk-data
|
walk-data ; for byte-compiler.
|
||||||
(function
|
(walk-data
|
||||||
(lambda (data genealogy)
|
(function
|
||||||
(case (org-element-type data)
|
(lambda (data genealogy)
|
||||||
(org-data (mapc (lambda (el) (funcall walk-data el genealogy))
|
(case (org-element-type data)
|
||||||
(org-element-contents data)))
|
(org-data (mapc (lambda (el) (funcall walk-data el genealogy))
|
||||||
(headline
|
(org-element-contents data)))
|
||||||
(let ((tags (org-element-property :tags data)))
|
(headline
|
||||||
(if (loop for tag in (plist-get info :select-tags)
|
(let ((tags (org-element-property :tags data)))
|
||||||
thereis (member tag tags))
|
(if (loop for tag in (plist-get info :select-tags)
|
||||||
;; When a select tag is found, mark full
|
thereis (member tag tags))
|
||||||
;; genealogy and every headline within the tree
|
;; When a select tag is found, mark full
|
||||||
;; as acceptable.
|
;; genealogy and every headline within the tree
|
||||||
(setq selected-trees
|
;; as acceptable.
|
||||||
(append
|
(setq selected-trees
|
||||||
genealogy
|
(append
|
||||||
(org-element-map data 'headline 'identity)
|
genealogy
|
||||||
selected-trees))
|
(org-element-map data 'headline 'identity)
|
||||||
;; Else, continue searching in tree, recursively.
|
selected-trees))
|
||||||
(mapc
|
;; Else, continue searching in tree, recursively.
|
||||||
(lambda (el) (funcall walk-data el (cons data genealogy)))
|
(mapc
|
||||||
(org-element-contents data))))))))))
|
(lambda (el) (funcall walk-data el (cons data genealogy)))
|
||||||
|
(org-element-contents data))))))))))
|
||||||
(funcall walk-data data nil) selected-trees))
|
(funcall walk-data data nil) selected-trees))
|
||||||
|
|
||||||
(defun org-export--skip-p (blob options selected)
|
(defun org-export--skip-p (blob options selected)
|
||||||
|
@ -2367,6 +2369,9 @@ of subtree at point.
|
||||||
When optional argument PUB-DIR is set, use it as the publishing
|
When optional argument PUB-DIR is set, use it as the publishing
|
||||||
directory.
|
directory.
|
||||||
|
|
||||||
|
When optional argument VISIBLE-ONLY is non-nil, don't export
|
||||||
|
contents of hidden elements.
|
||||||
|
|
||||||
Return file name as a string, or nil if it couldn't be
|
Return file name as a string, or nil if it couldn't be
|
||||||
determined."
|
determined."
|
||||||
(let ((base-name
|
(let ((base-name
|
||||||
|
@ -2376,8 +2381,7 @@ determined."
|
||||||
(or (and subtreep
|
(or (and subtreep
|
||||||
(org-entry-get
|
(org-entry-get
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(ignore-errors
|
(ignore-errors (org-back-to-heading) (point)))
|
||||||
(org-back-to-heading (not visible-only)) (point)))
|
|
||||||
"EXPORT_FILE_NAME" t))
|
"EXPORT_FILE_NAME" t))
|
||||||
;; File name may be extracted from buffer's associated
|
;; File name may be extracted from buffer's associated
|
||||||
;; file, if any.
|
;; file, if any.
|
||||||
|
@ -2639,27 +2643,28 @@ 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 or as a secondary string for inlined
|
appear as Org data or as a secondary string for inlined
|
||||||
footnotes. Unreferenced definitions are ignored."
|
footnotes. Unreferenced definitions are ignored."
|
||||||
(let (num-alist
|
(let* (num-alist
|
||||||
(collect-fn
|
collect-fn ; for byte-compiler.
|
||||||
(function
|
(collect-fn
|
||||||
(lambda (data)
|
(function
|
||||||
;; Collect footnote number, label and definition in DATA.
|
(lambda (data)
|
||||||
(org-element-map
|
;; Collect footnote number, label and definition in DATA.
|
||||||
data 'footnote-reference
|
(org-element-map
|
||||||
(lambda (fn)
|
data 'footnote-reference
|
||||||
(when (org-export-footnote-first-reference-p fn info)
|
(lambda (fn)
|
||||||
(let ((def (org-export-get-footnote-definition fn info)))
|
(when (org-export-footnote-first-reference-p fn info)
|
||||||
(push
|
(let ((def (org-export-get-footnote-definition fn info)))
|
||||||
(list (org-export-get-footnote-number fn info)
|
(push
|
||||||
(org-element-property :label fn)
|
(list (org-export-get-footnote-number fn info)
|
||||||
def)
|
(org-element-property :label fn)
|
||||||
num-alist)
|
def)
|
||||||
;; Also search in definition for nested footnotes.
|
num-alist)
|
||||||
(when (eq (org-element-property :type fn) 'standard)
|
;; Also search in definition for nested footnotes.
|
||||||
(funcall collect-fn def)))))
|
(when (eq (org-element-property :type fn) 'standard)
|
||||||
;; Don't enter footnote definitions since it will happen
|
(funcall collect-fn def)))))
|
||||||
;; when their first reference is found.
|
;; Don't enter footnote definitions since it will happen
|
||||||
info nil 'footnote-definition)))))
|
;; when their first reference is found.
|
||||||
|
info nil 'footnote-definition)))))
|
||||||
(funcall collect-fn (plist-get info :parse-tree))
|
(funcall collect-fn (plist-get info :parse-tree))
|
||||||
(reverse num-alist)))
|
(reverse num-alist)))
|
||||||
|
|
||||||
|
@ -2673,25 +2678,26 @@ INFO is the plist used as a communication channel."
|
||||||
(if (not label) t
|
(if (not label) t
|
||||||
;; Otherwise, return the first footnote with the same LABEL and
|
;; Otherwise, return the first footnote with the same LABEL and
|
||||||
;; test if it is equal to FOOTNOTE-REFERENCE.
|
;; test if it is equal to FOOTNOTE-REFERENCE.
|
||||||
(let ((search-refs
|
(let* (search-refs ; for byte-compiler.
|
||||||
(function
|
(search-refs
|
||||||
(lambda (data)
|
(function
|
||||||
(org-element-map
|
(lambda (data)
|
||||||
data 'footnote-reference
|
(org-element-map
|
||||||
(lambda (fn)
|
data 'footnote-reference
|
||||||
(cond
|
(lambda (fn)
|
||||||
((string= (org-element-property :label fn) label)
|
(cond
|
||||||
(throw 'exit fn))
|
((string= (org-element-property :label fn) label)
|
||||||
;; If FN isn't inlined, be sure to traverse its
|
(throw 'exit fn))
|
||||||
;; definition before resuming search. See
|
;; If FN isn't inlined, be sure to traverse its
|
||||||
;; comments in `org-export-get-footnote-number'
|
;; definition before resuming search. See
|
||||||
;; for more information.
|
;; comments in `org-export-get-footnote-number'
|
||||||
((eq (org-element-property :type fn) 'standard)
|
;; for more information.
|
||||||
(funcall search-refs
|
((eq (org-element-property :type fn) 'standard)
|
||||||
(org-export-get-footnote-definition fn info)))))
|
(funcall search-refs
|
||||||
;; Don't enter footnote definitions since it will
|
(org-export-get-footnote-definition fn info)))))
|
||||||
;; happen when their first reference is found.
|
;; Don't enter footnote definitions since it will
|
||||||
info 'first-match 'footnote-definition)))))
|
;; 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)))))
|
||||||
|
|
||||||
|
@ -2707,45 +2713,46 @@ INFO is the plist used as a communication channel."
|
||||||
|
|
||||||
FOOTNOTE is either a footnote reference or a footnote definition.
|
FOOTNOTE is either a footnote reference or a footnote definition.
|
||||||
INFO is the plist used as a communication channel."
|
INFO is the plist used as a communication channel."
|
||||||
(let ((label (org-element-property :label footnote))
|
(let* ((label (org-element-property :label footnote))
|
||||||
seen-refs
|
seen-refs
|
||||||
(search-ref
|
search-ref ; for byte-compiler.
|
||||||
(function
|
(search-ref
|
||||||
(lambda (data)
|
(function
|
||||||
;; Search footnote references through DATA, filling
|
(lambda (data)
|
||||||
;; SEEN-REFS along the way.
|
;; Search footnote references through DATA, filling
|
||||||
(org-element-map
|
;; SEEN-REFS along the way.
|
||||||
data 'footnote-reference
|
(org-element-map
|
||||||
(lambda (fn)
|
data 'footnote-reference
|
||||||
(let ((fn-lbl (org-element-property :label fn)))
|
(lambda (fn)
|
||||||
(cond
|
(let ((fn-lbl (org-element-property :label fn)))
|
||||||
;; Anonymous footnote match: return number.
|
(cond
|
||||||
((and (not fn-lbl) (equal fn footnote))
|
;; Anonymous footnote match: return number.
|
||||||
(throw 'exit (1+ (length seen-refs))))
|
((and (not fn-lbl) (equal fn footnote))
|
||||||
;; Labels match: return number.
|
(throw 'exit (1+ (length seen-refs))))
|
||||||
((and label (string= label fn-lbl))
|
;; Labels match: return number.
|
||||||
(throw 'exit (1+ (length seen-refs))))
|
((and label (string= label fn-lbl))
|
||||||
;; Anonymous footnote: it's always a new one. Also,
|
(throw 'exit (1+ (length seen-refs))))
|
||||||
;; be sure to return nil from the `cond' so
|
;; Anonymous footnote: it's always a new one. Also,
|
||||||
;; `first-match' doesn't get us out of the loop.
|
;; be sure to return nil from the `cond' so
|
||||||
((not fn-lbl) (push 'inline seen-refs) nil)
|
;; `first-match' doesn't get us out of the loop.
|
||||||
;; Label not seen so far: add it so SEEN-REFS.
|
((not fn-lbl) (push 'inline seen-refs) nil)
|
||||||
;;
|
;; Label not seen so far: add it so SEEN-REFS.
|
||||||
;; Also search for subsequent references in footnote
|
;;
|
||||||
;; definition so numbering following reading logic.
|
;; Also search for subsequent references in footnote
|
||||||
;; Note that we don't have to care about inline
|
;; definition so numbering following reading logic.
|
||||||
;; definitions, since `org-element-map' already
|
;; Note that we don't have to care about inline
|
||||||
;; traverse them at the right time.
|
;; definitions, since `org-element-map' already
|
||||||
;;
|
;; traverse them at the right time.
|
||||||
;; Once again, return nil to stay in the loop.
|
;;
|
||||||
((not (member fn-lbl seen-refs))
|
;; Once again, return nil to stay in the loop.
|
||||||
(push fn-lbl seen-refs)
|
((not (member fn-lbl seen-refs))
|
||||||
(funcall search-ref
|
(push fn-lbl seen-refs)
|
||||||
(org-export-get-footnote-definition fn info))
|
(funcall search-ref
|
||||||
nil))))
|
(org-export-get-footnote-definition fn info))
|
||||||
;; Don't enter footnote definitions since it will happen
|
nil))))
|
||||||
;; when their first reference is found.
|
;; Don't enter footnote definitions since it will happen
|
||||||
info 'first-match 'footnote-definition)))))
|
;; 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)))))
|
||||||
|
|
||||||
|
|
||||||
|
@ -2893,12 +2900,16 @@ This only applies to links without a description."
|
||||||
(and (not (org-element-contents link))
|
(and (not (org-element-contents link))
|
||||||
(let ((case-fold-search t)
|
(let ((case-fold-search t)
|
||||||
(rules (or rules org-export-default-inline-image-rule)))
|
(rules (or rules org-export-default-inline-image-rule)))
|
||||||
(some
|
(catch 'exit
|
||||||
(lambda (rule)
|
(mapc
|
||||||
(and (string= (org-element-property :type link) (car rule))
|
(lambda (rule)
|
||||||
(string-match (cdr rule)
|
(and (string= (org-element-property :type link) (car rule))
|
||||||
(org-element-property :path link))))
|
(string-match (cdr rule)
|
||||||
rules))))
|
(org-element-property :path link))
|
||||||
|
(throw 'exit t)))
|
||||||
|
rules)
|
||||||
|
;; Return nil if no rule matched.
|
||||||
|
nil))))
|
||||||
|
|
||||||
(defun org-export-resolve-coderef (ref info)
|
(defun org-export-resolve-coderef (ref info)
|
||||||
"Resolve a code reference REF.
|
"Resolve a code reference REF.
|
||||||
|
@ -3856,6 +3867,7 @@ BLOB is the element or object being considered. INFO is a plist
|
||||||
used as a communication channel."
|
used as a communication channel."
|
||||||
(let* ((type (org-element-type blob))
|
(let* ((type (org-element-type blob))
|
||||||
(end (org-element-property :end blob))
|
(end (org-element-property :end blob))
|
||||||
|
walk-data ; for byte-compiler.
|
||||||
(walk-data
|
(walk-data
|
||||||
(lambda (data genealogy)
|
(lambda (data genealogy)
|
||||||
;; Walk DATA, looking for BLOB. GENEALOGY is the list of
|
;; Walk DATA, looking for BLOB. GENEALOGY is the list of
|
||||||
|
|
Loading…
Reference in New Issue