Activate lexical binding

This commit is contained in:
IGARASHI Masanao
2015-11-15 16:43:27 +09:00
parent fdf67b788e
commit f063eb8db6

View File

@@ -1,4 +1,4 @@
;;; ox-rst.el --- Export reStructuredText using org-mode. ;;; ox-rst.el --- Export reStructuredText using org-mode. -*- lexical-binding: t; -*-
;; Copyright (C) 2015 IGARASHI Masanao ;; Copyright (C) 2015 IGARASHI Masanao
@@ -311,7 +311,7 @@ Empty lines are not indented."
"\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1))) "\\(^\\)\\(?:.*\\S-\\)" (make-string width ? ) s nil nil 1)))
(defun org-rst--has-caption-p (element info) (defun org-rst--has-caption-p (element _info)
"Non-nil when ELEMENT has a caption affiliated keyword. "Non-nil when ELEMENT has a caption affiliated keyword.
INFO is a plist used as a communication channel. This function INFO is a plist used as a communication channel. This function
is meant to be used as a predicate for `org-export-get-ordinal'." is meant to be used as a predicate for `org-export-get-ordinal'."
@@ -426,7 +426,7 @@ See `org-rst-text-markup-alist' for details."
(t (format fmt text))))) (t (format fmt text)))))
(defun org-rst--checkbox (item info) (defun org-rst--checkbox (item _info)
"Return checkbox string for ITEM or nil. "Return checkbox string for ITEM or nil.
INFO is a plist used as a communication channel." INFO is a plist used as a communication channel."
;(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8))) ;(let ((utf8p (eq (plist-get info :ascii-charset) 'utf-8)))
@@ -524,7 +524,7 @@ holding export options."
;;;; Bold ;;;; Bold
(defun org-rst-bold (bold contents info) (defun org-rst-bold (_bold contents _info)
"Transcode BOLD from Org to reStructuredText. "Transcode BOLD from Org to reStructuredText.
CONTENTS is the text with bold markup. INFO is a plist holding CONTENTS is the text with bold markup. INFO is a plist holding
contextual information." contextual information."
@@ -533,7 +533,7 @@ contextual information."
;;;; Center Block ;;;; Center Block
(defun org-rst-center-block (center-block contents info) (defun org-rst-center-block (_center-block contents _info)
"Transcode a CENTER-BLOCK element from Org to reStructuredText. "Transcode a CENTER-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the center block. INFO is a plist CONTENTS holds the contents of the center block. INFO is a plist
holding contextual information." holding contextual information."
@@ -542,7 +542,7 @@ holding contextual information."
;;;; Clock ;;;; Clock
(defun org-rst-clock (clock contents info) (defun org-rst-clock (clock _contents _info)
"Transcode a CLOCK object from Org to reStructuredText. "Transcode a CLOCK object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -560,7 +560,7 @@ information."
;;;; Code ;;;; Code
(defun org-rst-code (code contents info) (defun org-rst-code (code _contents _info)
"Transcode a CODE object from Org to reStructuredText. "Transcode a CODE object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist used as a communication CONTENTS is nil. INFO is a plist used as a communication
channel." channel."
@@ -568,7 +568,7 @@ channel."
;;; Comment ;;; Comment
(defun org-rst-comment (comment contents info) (defun org-rst-comment (comment _contents _info)
"Transcode a COMMENT object from Org to reStructuredText. "Transcode a COMMENT object from Org to reStructuredText.
CONTENTS is the text in the comment. INFO is a plist holding CONTENTS is the text in the comment. INFO is a plist holding
contextual information." contextual information."
@@ -577,7 +577,7 @@ contextual information."
;;; Comment Block ;;; Comment Block
(defun org-rst-comment-block (comment-block contents info) (defun org-rst-comment-block (comment-block _contents _info)
"Transcode a COMMENT-BLOCK object from Org to reStructuredText. "Transcode a COMMENT-BLOCK object from Org to reStructuredText.
CONTENTS is the text within the block. INFO is a plist holding CONTENTS is the text within the block. INFO is a plist holding
contextual information." contextual information."
@@ -589,7 +589,7 @@ contextual information."
;;;; Drawer ;;;; Drawer
(defun org-rst-drawer (drawer contents info) (defun org-rst-drawer (drawer contents _info)
"Transcode a DRAWER element from Org to reStructuredText. "Transcode a DRAWER element from Org to reStructuredText.
CONTENTS holds the contents of the block. INFO is a plist CONTENTS holds the contents of the block. INFO is a plist
holding contextual information." holding contextual information."
@@ -605,7 +605,7 @@ holding contextual information."
;;;; Dynamic Block ;;;; Dynamic Block
(defun org-rst-dynamic-block (dynamic-block contents info) (defun org-rst-dynamic-block (_dynamic-block contents _info)
"Transcode a DYNAMIC-BLOCK element from Org to reStructuredText. "Transcode a DYNAMIC-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the block. INFO is a plist CONTENTS holds the contents of the block. INFO is a plist
holding contextual information." holding contextual information."
@@ -614,7 +614,7 @@ holding contextual information."
;;;; Entity ;;;; Entity
(defun org-rst-entity (entity contents info) (defun org-rst-entity (entity _contents _info)
"Transcode an ENTITY object from Org to reStructuredText. "Transcode an ENTITY object from Org to reStructuredText.
CONTENTS are the definition itself. INFO is a plist holding CONTENTS are the definition itself. INFO is a plist holding
contextual information." contextual information."
@@ -626,7 +626,7 @@ contextual information."
;;;; Example Block ;;;; Example Block
(defun org-rst-example-block (example-block contents info) (defun org-rst-example-block (example-block _contents _info)
"Transcode an EXAMPLE-BLOCK element from Org to reStructuredText. "Transcode an EXAMPLE-BLOCK element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -647,7 +647,7 @@ information."
;;;; Export Block ;;;; Export Block
(defun org-rst-export-block (export-block contents info) (defun org-rst-export-block (export-block _contents _info)
"Transcode a EXPORT-BLOCK element from Org to reStructuredText. "Transcode a EXPORT-BLOCK element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
(when (member (org-element-property :type export-block) '("RST" "REST" "RESTRUCTUREDTEXT")) (when (member (org-element-property :type export-block) '("RST" "REST" "RESTRUCTUREDTEXT"))
@@ -656,7 +656,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Export Snippet ;;;; Export Snippet
(defun org-rst-export-snippet (export-snippet contents info) (defun org-rst-export-snippet (export-snippet _contents _info)
"Transcode a EXPORT-SNIPPET object from Org to reStructuredText. "Transcode a EXPORT-SNIPPET object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
(when (eq (org-export-snippet-backend export-snippet) 'rst) (when (eq (org-export-snippet-backend export-snippet) 'rst)
@@ -676,7 +676,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Footnote Reference ;;;; Footnote Reference
(defun org-rst-footnote-reference (footnote-reference contents info) (defun org-rst-footnote-reference (footnote-reference _contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to reStructuredText. "Transcode a FOOTNOTE-REFERENCE element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
(format " [%s]_ " (org-export-get-footnote-number footnote-reference info))) (format " [%s]_ " (org-export-get-footnote-number footnote-reference info)))
@@ -710,14 +710,14 @@ holding contextual information."
;;;; Horizontal Rule ;;;; Horizontal Rule
(defun org-rst-horizontal-rule (horizontal-rule contents info) (defun org-rst-horizontal-rule (_horizontal-rule _contents _info)
"Transcode an HORIZONTAL-RULE object from Org to reStructuredText. "Transcode an HORIZONTAL-RULE object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
"\n------------\n") "\n------------\n")
;;;; Inline Src Block ;;;; Inline Src Block
(defun org-rst-inline-src-block (inline-src-block contents info) (defun org-rst-inline-src-block (inline-src-block _contents _info)
"Transcode an INLINE-SRC-BLOCK element from Org to reStructuredText. "Transcode an INLINE-SRC-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the item. INFO is a plist holding CONTENTS holds the contents of the item. INFO is a plist holding
contextual information." contextual information."
@@ -802,7 +802,7 @@ holding export options."
;;;; Italic ;;;; Italic
(defun org-rst-italic (italic contents info) (defun org-rst-italic (_italic contents _info)
"Transcode ITALIC from Org to reStructuredText. "Transcode ITALIC from Org to reStructuredText.
CONTENTS is the text with italic markup. INFO is a plist holding CONTENTS is the text with italic markup. INFO is a plist holding
contextual information." contextual information."
@@ -852,7 +852,7 @@ a communication channel."
;;;; Keyword ;;;; Keyword
(defun org-rst-keyword (keyword contents info) (defun org-rst-keyword (keyword _contents _info)
"Transcode a KEYWORD element from Org to reStructuredText. "Transcode a KEYWORD element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
(let ((key (org-element-property :key keyword)) (let ((key (org-element-property :key keyword))
@@ -864,7 +864,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Latex Environment ;;;; Latex Environment
(defun org-rst-latex-environment (latex-environment contents info) (defun org-rst-latex-environment (latex-environment _contents info)
"Transcode a LATEX-ENVIRONMENT element from Org to reStructuredText. "Transcode a LATEX-ENVIRONMENT element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -874,7 +874,7 @@ information."
;;;; Latex Fragment ;;;; Latex Fragment
(defun org-rst-latex-fragment (latex-fragment contents info) (defun org-rst-latex-fragment (latex-fragment _contents _info)
"Transcode a LATEX-FRAGMENT object from Org to reStructuredText. "Transcode a LATEX-FRAGMENT object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -897,7 +897,7 @@ information."
;;;; Line Break ;;;; Line Break
(defun org-rst-line-break (line-break contents info) (defun org-rst-line-break (_line-break _contents _info)
"Transcode a LINE-BREAK object from Org to reStructuredText. "Transcode a LINE-BREAK object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -1076,7 +1076,7 @@ INFO is a plist holding contextual information."
;;;; Node Property ;;;; Node Property
(defun org-rst-node-property (node-property contents info) (defun org-rst-node-property (node-property _contents _info)
"Transcode a NODE-PROPERTY element from Org to reStructuredText. "Transcode a NODE-PROPERTY element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -1088,7 +1088,7 @@ information."
;;;; Paragraph ;;;; Paragraph
(defun org-rst-paragraph (paragraph contents info) (defun org-rst-paragraph (_paragraph contents _info)
"Transcode a PARAGRAPH element from Org to reStructuredText. "Transcode a PARAGRAPH element from Org to reStructuredText.
CONTENTS is the contents of the paragraph, as a string. INFO is CONTENTS is the contents of the paragraph, as a string. INFO is
the plist used as a communication channel." the plist used as a communication channel."
@@ -1097,7 +1097,7 @@ the plist used as a communication channel."
;;;; Plain List ;;;; Plain List
(defun org-rst-plain-list (plain-list contents info) (defun org-rst-plain-list (_plain-list contents _info)
"Transcode a PLAIN-LIST element from Org to reStructuredText. "Transcode a PLAIN-LIST element from Org to reStructuredText.
CONTENTS is the contents of the list. INFO is a plist holding CONTENTS is the contents of the list. INFO is a plist holding
contextual information." contextual information."
@@ -1127,7 +1127,7 @@ contextual information."
;;;; Planning ;;;; Planning
(defun org-rst-planning (planning contents info) (defun org-rst-planning (planning _contents _info)
"Transcode a PLANNING element from Org to reStructuredText. "Transcode a PLANNING element from Org to reStructuredText.
CONTENTS is nil. INFO is a plist used as a communication CONTENTS is nil. INFO is a plist used as a communication
channel." channel."
@@ -1154,7 +1154,7 @@ channel."
;;;; Property Drawer ;;;; Property Drawer
(defun org-rst-property-drawer (property-drawer contents info) (defun org-rst-property-drawer (_property-drawer contents _info)
"Transcode a PROPERTY-DRAWER element from Org to reStructuredText. "Transcode a PROPERTY-DRAWER element from Org to reStructuredText.
CONTENTS holds the contents of the drawer. INFO is a plist CONTENTS holds the contents of the drawer. INFO is a plist
holding contextual information." holding contextual information."
@@ -1219,15 +1219,15 @@ containing export options. Modify DATA by side-effect and return it."
;; Return updated DATA. ;; Return updated DATA.
data)) data))
(defun org-rst-math-block-tree-filter (tree backend info) (defun org-rst-math-block-tree-filter (tree _backend info)
(org-rst--wrap-latex-math-block tree info)) (org-rst--wrap-latex-math-block tree info))
(defun org-rst-math-block-options-filter (info backend) (defun org-rst-math-block-options-filter (info _backend)
(dolist (prop '(:author :date :title) info) (dolist (prop '(:author :date :title) info)
(plist-put info prop (plist-put info prop
(org-rst--wrap-latex-math-block (plist-get info prop) info)))) (org-rst--wrap-latex-math-block (plist-get info prop) info))))
(defun org-rst-math-block (math-block contents info) (defun org-rst-math-block (_math-block contents _info)
"Transcode a MATH-BLOCK object from Org to LaTeX. "Transcode a MATH-BLOCK object from Org to LaTeX.
CONTENTS is a string. INFO is a plist used as a communication CONTENTS is a string. INFO is a plist used as a communication
channel." channel."
@@ -1242,7 +1242,7 @@ channel."
;;;; Quote Block ;;;; Quote Block
(defun org-rst-quote-block (quote-block contents info) (defun org-rst-quote-block (quote-block contents _info)
"Transcode a QUOTE-BLOCK element from Org to reStructuredText. "Transcode a QUOTE-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the block. INFO is a plist CONTENTS holds the contents of the block. INFO is a plist
holding contextual information." holding contextual information."
@@ -1281,7 +1281,7 @@ holding contextual information."
;;;; Radio Target ;;;; Radio Target
(defun org-rst-radio-target (radio-target contents info) (defun org-rst-radio-target (_radio-target contents _info)
"Transcode a RADIO-TARGET object from Org to reStructuredText. "Transcode a RADIO-TARGET object from Org to reStructuredText.
CONTENTS is the contents of the target. INFO is a plist holding CONTENTS is the contents of the target. INFO is a plist holding
contextual information." contextual information."
@@ -1290,7 +1290,7 @@ contextual information."
;;;; Section ;;;; Section
(defun org-rst-section (section contents info) (defun org-rst-section (_section contents _info)
"Transcode a SECTION element from Org to reStructuredText. "Transcode a SECTION element from Org to reStructuredText.
CONTENTS holds the contents of the section. INFO is a plist CONTENTS holds the contents of the section. INFO is a plist
holding contextual information." holding contextual information."
@@ -1299,7 +1299,7 @@ holding contextual information."
;;;; Special Block ;;;; Special Block
(defun org-rst-special-block (special-block contents info) (defun org-rst-special-block (special-block contents _info)
"Transcode a SPECIAL-BLOCK element from Org to reStructuredText. "Transcode a SPECIAL-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the block. INFO is a plist CONTENTS holds the contents of the block. INFO is a plist
holding contextual information." holding contextual information."
@@ -1321,7 +1321,7 @@ holding contextual information."
;;;; Src Block ;;;; Src Block
(defun org-rst-src-block (src-block contents info) (defun org-rst-src-block (src-block _contents info)
"Transcode a SRC-BLOCK element from Org to reStructuredText. "Transcode a SRC-BLOCK element from Org to reStructuredText.
CONTENTS holds the contents of the item. INFO is a plist holding CONTENTS holds the contents of the item. INFO is a plist holding
contextual information." contextual information."
@@ -1364,7 +1364,7 @@ contextual information."
;;;; Statistics Cookie ;;;; Statistics Cookie
(defun org-rst-statistics-cookie (statistics-cookie contents info) (defun org-rst-statistics-cookie (statistics-cookie _contents _info)
"Transcode a STATISTICS-COOKIE object from Org to reStructuredText. "Transcode a STATISTICS-COOKIE object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS is nil. INFO is a plist holding contextual information."
(org-element-property :value statistics-cookie)) (org-element-property :value statistics-cookie))
@@ -1372,7 +1372,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
;;;; Strike-Through ;;;; Strike-Through
(defun org-rst-strike-through (strike-through contents info) (defun org-rst-strike-through (_strike-through contents _info)
"Transcode STRIKE-THROUGH from Org to reStructuredText. "Transcode STRIKE-THROUGH from Org to reStructuredText.
CONTENTS is the text with strike-through markup. INFO is a plist CONTENTS is the text with strike-through markup. INFO is a plist
holding contextual information." holding contextual information."
@@ -1381,7 +1381,7 @@ holding contextual information."
;;;; Subscript ;;;; Subscript
(defun org-rst-subscript (subscript contents info) (defun org-rst-subscript (_subscript contents _info)
"Transcode a SUBSCRIPT object from Org to reStructuredText. "Transcode a SUBSCRIPT object from Org to reStructuredText.
CONTENTS is the contents of the object. INFO is a plist holding CONTENTS is the contents of the object. INFO is a plist holding
contextual information." contextual information."
@@ -1390,7 +1390,7 @@ contextual information."
;;;; Superscript ;;;; Superscript
(defun org-rst-superscript (superscript contents info) (defun org-rst-superscript (_superscript contents _info)
"Transcode a SUPERSCRIPT object from Org to reStructuredText. "Transcode a SUPERSCRIPT object from Org to reStructuredText.
CONTENTS is the contents of the object. INFO is a plist holding CONTENTS is the contents of the object. INFO is a plist holding
contextual information." contextual information."
@@ -1472,7 +1472,7 @@ a communication channel."
(t ?-))) (t ?-)))
(makeline (makeline
(function (function
(lambda (rowcontents linebit) (lambda (_rowcontents linebit)
(format "+%s+" (format "+%s+"
(mapconcat (mapconcat
'identity 'identity
@@ -1501,7 +1501,7 @@ a communication channel."
;;;; Target ;;;; Target
(defun org-rst-target (target contents info) (defun org-rst-target (target _contents _info)
"Transcode a TARGET object from Org to reStructuredText. "Transcode a TARGET object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -1510,7 +1510,7 @@ information."
;;;; Timestamp ;;;; Timestamp
(defun org-rst-timestamp (timestamp contents info) (defun org-rst-timestamp (timestamp _contents info)
"Transcode a TIMESTAMP object from Org to reStructuredText. "Transcode a TIMESTAMP object from Org to reStructuredText.
CONTENTS is nil. INFO is a plist holding contextual CONTENTS is nil. INFO is a plist holding contextual
information." information."
@@ -1519,7 +1519,7 @@ information."
;;;; Underline ;;;; Underline
(defun org-rst-underline (underline contents info) (defun org-rst-underline (_underline contents _info)
"Transcode UNDERLINE from Org to reStructuredText. "Transcode UNDERLINE from Org to reStructuredText.
CONTENTS is the text with underline markup. INFO is a plist CONTENTS is the text with underline markup. INFO is a plist
holding contextual information." holding contextual information."
@@ -1528,7 +1528,7 @@ holding contextual information."
;;;; Verbatim ;;;; Verbatim
(defun org-rst-verbatim (verbatim contents info) (defun org-rst-verbatim (verbatim _contents _info)
"Transcode a VERBATIM object from Org to reStructredText. "Transcode a VERBATIM object from Org to reStructredText.
CONTENTS is nil. INFO is a plist used as a communication CONTENTS is nil. INFO is a plist used as a communication
channel." channel."
@@ -1537,7 +1537,7 @@ channel."
;;;; Verse Block ;;;; Verse Block
(defun org-rst-verse-block (verse-block contents info) (defun org-rst-verse-block (_verse-block contents _info)
"Transcode a VERSE-BLOCK element from Org to reStructuredText. "Transcode a VERSE-BLOCK element from Org to reStructuredText.
CONTENTS is verse block contents. INFO is a plist holding CONTENTS is verse block contents. INFO is a plist holding
contextual information." contextual information."
@@ -1550,7 +1550,7 @@ contextual information."
;;; Filters ;;; Filters
(defun org-rst-separate-elements (tree backend info) (defun org-rst-separate-elements (tree _backend _info)
"Make sure elements are separated by at least one blank line. "Make sure elements are separated by at least one blank line.
TREE is the parse tree being exported. BACKEND is the export TREE is the parse tree being exported. BACKEND is the export
@@ -1568,7 +1568,7 @@ Assume BACKEND is `rst'."
;; Return updated tree. ;; Return updated tree.
tree) tree)
(defun org-rst-filter-headline-blank-lines (headline back-end info) (defun org-rst-filter-headline-blank-lines (headline _back-end _info)
"Filter controlling number of blank lines after a headline. "Filter controlling number of blank lines after a headline.
HEADLINE is a string representing a transcoded headline. HEADLINE is a string representing a transcoded headline.
@@ -1581,7 +1581,7 @@ This function only applies to `rst' back-end. See
(let ((blanks (make-string (1+ (cdr org-rst-headline-spacing)) ?\n))) (let ((blanks (make-string (1+ (cdr org-rst-headline-spacing)) ?\n)))
(replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline)))) (replace-regexp-in-string "\n\\(?:\n[ \t]*\\)*\\'" blanks headline))))
(defun org-rst-filter-paragraph-spacing (tree back-end info) (defun org-rst-filter-paragraph-spacing (tree _back-end info)
"Filter controlling number of blank lines between paragraphs. "Filter controlling number of blank lines between paragraphs.
TREE is the parse tree. BACK-END is the symbol specifying TREE is the parse tree. BACK-END is the symbol specifying