summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2012-03-16 17:33:05 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2012-03-16 17:33:05 +0100
commit768c95e18bf76c4470bf92d820092ceb202eaf61 (patch)
tree5a994b4073b75928a25f0c270f690c28a544b2a1
parent2149ad8aeae944fb2d1d41a866e5328ec08ebeb7 (diff)
parentde4ba0d4cd490b681f3199fa3d15944736f97181 (diff)
downloadorg-mode-768c95e18bf76c4470bf92d820092ceb202eaf61.tar.gz
Merge branch 'master' of orgmode.org:org-mode
-rw-r--r--EXPERIMENTAL/org-e-html.el327
-rw-r--r--EXPERIMENTAL/org-e-odt.el191
-rw-r--r--contrib/lisp/org-contacts.el2
-rw-r--r--contrib/lisp/org-element.el2
-rw-r--r--doc/org.texi3
-rw-r--r--lisp/ob-lilypond.el68
-rw-r--r--lisp/ob-sh.el46
-rw-r--r--lisp/ob.el10
-rw-r--r--lisp/org-agenda.el2
-rw-r--r--lisp/org-attach.el2
-rw-r--r--lisp/org-footnote.el1
-rw-r--r--lisp/org-mobile.el2
-rw-r--r--lisp/org-pcomplete.el5
-rw-r--r--lisp/org-src.el5
-rw-r--r--lisp/org.el9
-rw-r--r--testing/lisp/test-ob-lilypond.el22
16 files changed, 371 insertions, 326 deletions
diff --git a/EXPERIMENTAL/org-e-html.el b/EXPERIMENTAL/org-e-html.el
index 8cd90fe..1e1e94a 100644
--- a/EXPERIMENTAL/org-e-html.el
+++ b/EXPERIMENTAL/org-e-html.el
@@ -1505,8 +1505,7 @@ This function shouldn't be used for floats. See
(defun org-e-html-style (info)
(concat
- (when (plist-get info :style-include-default)
- org-e-html-style-default)
+ "\n" (when (plist-get info :style-include-default) org-e-html-style-default)
(plist-get info :style)
(plist-get info :style-extra)
"\n"
@@ -1727,6 +1726,8 @@ original parsed data. INFO is a plist holding export options."
;;; Transcode Helpers
+;;;; Todo
+
(defun org-e-html--todo (todo)
(when todo
(format "<span class=\"%s %s%s\">%s</span>"
@@ -1734,6 +1735,8 @@ original parsed data. INFO is a plist holding export options."
org-e-html-todo-kwd-class-prefix (org-e-html-fix-class-name todo)
todo)))
+;;;; Tags
+
(defun org-e-html--tags (tags)
(when tags
(format "<span class=\"tag\">%s</span>"
@@ -1745,6 +1748,8 @@ original parsed data. INFO is a plist holding export options."
tag))
(org-split-string tags ":") "&nbsp;"))))
+;;;; Headline
+
(defun* org-e-html-format-headline
(todo todo-type priority text tags
&key level section-number headline-label &allow-other-keys)
@@ -1757,6 +1762,98 @@ original parsed data. INFO is a plist holding export options."
(concat section-number todo (and todo " ") text
(and tags "&nbsp;&nbsp;&nbsp;") tags)))
+;;;; Src Code
+
+(defun org-e-html-fontify-code (code lang)
+ (when code
+ (cond
+ ;; Case 1: No lang. Possibly an example block.
+ ((not lang)
+ ;; Simple transcoding.
+ (org-e-html-encode-plain-text code))
+ ;; Case 2: No htmlize or an inferior version of htmlize
+ ((not (and (require 'htmlize nil t) (fboundp 'htmlize-region-for-paste)))
+ ;; Emit a warning.
+ (message "Cannot fontify src block (htmlize.el >= 1.34 required)")
+ ;; Simple transcoding.
+ (org-e-html-encode-plain-text code))
+ (t
+ ;; Map language
+ (setq lang (or (assoc-default lang org-src-lang-modes) lang))
+ (let* ((lang-mode (and lang (intern (format "%s-mode" lang)))))
+ (cond
+ ;; Case 1: Language is not associated with any Emacs mode
+ ((not (functionp lang-mode))
+ ;; Simple transcoding.
+ (org-e-html-encode-plain-text code))
+ ;; Case 2: Default. Fotify code.
+ (t
+ ;; htmlize
+ (setq code (with-temp-buffer
+ (insert code)
+ (funcall lang-mode)
+ (font-lock-fontify-buffer)
+ ;; markup each line separately
+ (org-remove-formatting-on-newlines-in-region
+ (point-min) (point-max))
+ (org-src-mode)
+ (set-buffer-modified-p nil)
+ (org-export-e-htmlize-region-for-paste
+ (point-min) (point-max))))
+ ;; Strip any encolosing <pre></pre> tags
+ (if (string-match "<pre[^>]*>\n*\\([^\000]*\\)</pre>" code)
+ (match-string 1 code)
+ code))))))))
+
+(defun org-e-html-do-format-code
+ (code &optional lang refs retain-labels num-start textarea-p)
+ (when textarea-p
+ (setq num-start nil refs nil lang nil))
+ (let* ((code-lines (org-split-string code "\n"))
+ (code-length (length code-lines))
+ (num-fmt
+ (and num-start
+ (format "%%%ds: "
+ (length (number-to-string (+ code-length num-start))))))
+ (code (org-e-html-fontify-code code lang)))
+ (assert (= code-length (length (org-split-string code "\n"))))
+ (org-export-format-code
+ code
+ (lambda (loc line-num ref)
+ (setq loc
+ (concat
+ ;; Add line number, if needed.
+ (when num-start
+ (format "<span class=\"linenr\">%s</span>"
+ (format num-fmt line-num)))
+ ;; Transcoded src line.
+ loc
+ ;; Add label, if needed.
+ (when (and ref retain-labels) (format " (%s)" ref))))
+ ;; Mark transcoded line as an anchor, if needed.
+ (if (not ref) loc
+ (format "<span id=\"coderef-%s\" class=\"coderef-off\">%s</span>"
+ ref loc)))
+ num-start refs)))
+
+(defun org-e-html-format-code (element info)
+ (let* ((lang (org-element-property :language element))
+ ;; (switches (org-element-property :switches element))
+ (switches nil) ; FIXME
+ (textarea-p (and switches (string-match "-t\\>" switches)))
+ ;; Extract code and references.
+ (code-info (org-export-unravel-code element))
+ (code (car code-info))
+ (refs (cdr code-info))
+ ;; Does the src block contain labels?
+ (retain-labels (org-element-property :retain-labels element))
+ ;; Does it have line numbers?
+ (num-start (case (org-element-property :number-lines element)
+ (continued (org-export-get-loc element info))
+ (new 0))))
+ (org-e-html-do-format-code
+ code lang refs retain-labels num-start textarea-p)))
+
;;; Transcode Functions
@@ -1824,175 +1921,37 @@ holding contextual information.."
"Transcode an ENTITY object from Org to HTML.
CONTENTS are the definition itself. INFO is a plist holding
contextual information."
- ;; (let ((ent (org-element-property :latex entity)))
- ;; (if (org-element-property :latex-math-p entity)
- ;; (format "$%s$" ent)
- ;; ent))
(org-element-property :html entity))
;;;; Example Block
-(defun org-e-html-format-source-line-with-line-number-and-label (line)
- (let ((ref (org-find-text-property-in-string 'org-coderef line))
- (num (org-find-text-property-in-string 'org-loc line)))
- (when num
- (setq line (format "<span class=\"linenr\">%d: </span>%s (%s)"
- num line ref)))
- (when ref
- (setq line
- (format
- "<span id=\"coderef-%s\" class=\"coderef-off\">%s (%s)</span>"
- ref line ref)))
- line))
-
-(defun org-e-html-format-source-code-or-example-plain
- (lines lang caption textareap cols rows num cont rpllbl fmt)
- (format
- "\n<pre class=\"example\">\n%s\n</pre>"
- (cond
- (textareap
- (format "<p>\n<textarea cols=\"%d\" rows=\"%d\">%s\n</textarea>\n</p>\n"
- cols rows lines))
- (t (mapconcat
- (lambda (line)
- (org-e-html-format-source-line-with-line-number-and-label
- (org-e-html-encode-plain-text line)))
- (org-split-string lines "\n")
- "\n")))))
-
-(defun org-e-html-format-source-code-or-example-colored
- (lines lang caption textareap cols rows num cont rpllbl fmt)
- (let* ((lang-m (when lang
- (or (cdr (assoc lang org-src-lang-modes))
- lang)))
- (mode (and lang-m (intern
- (concat
- (if (symbolp lang-m)
- (symbol-name lang-m)
- lang-m)
- "-mode"))))
- (org-inhibit-startup t)
- (org-startup-folded nil))
- (setq lines
- (with-temp-buffer
- (insert lines)
- (if (functionp mode)
- (funcall mode)
- (fundamental-mode))
- (font-lock-fontify-buffer)
- ;; markup each line separately
- (org-remove-formatting-on-newlines-in-region
- (point-min) (point-max))
- (org-src-mode)
- (set-buffer-modified-p nil)
- (org-export-e-htmlize-region-for-paste
- (point-min) (point-max))))
-
- (when (string-match "<pre\\([^>]*\\)>\n*" lines)
- (setq lines (replace-match
- (format "<pre class=\"src src-%s\">\n" lang) t t lines)))
-
- (when caption
- (setq lines
- (concat
- "<div class=\"org-src-container\">"
- (format "<label class=\"org-src-name\">%s</label>" caption)
- lines "</div>")))
-
- (unless textareap
- (setq lines
- (mapconcat
- (lambda (line)
- (org-e-html-format-source-line-with-line-number-and-label line))
- (org-split-string lines "\n") "\n")))
-
- ;; (when (string-match "\\(\\`<[^>]*>\\)\n" lines)
- ;; (setq lines (replace-match "\\1" t nil lines)))
- lines))
-
-(defun org-e-html-format-source-code-or-example
- (lang code &optional opts indent caption)
- "Format CODE from language LANG and return it formatted for export.
-The CODE is marked up in `org-export-current-backend' format.
-
-Check if a function by name
-\"org-<backend>-format-source-code-or-example\" is bound. If yes,
-use it as the custom formatter. Otherwise, use the default
-formatter. Default formatters are provided for docbook, html,
-latex and ascii backends. For example, use
-`org-e-html-format-source-code-or-example' to provide a custom
-formatter for export to \"html\".
-
-If LANG is nil, do not add any fontification.
-OPTS contains formatting options, like `-n' for triggering numbering lines,
-and `+n' for continuing previous numbering.
-Code formatting according to language currently only works for HTML.
-Numbering lines works for all three major backends (html, latex, and ascii).
-INDENT was the original indentation of the block."
- (save-match-data
- (let* ((backend-formatter 'org-e-html-format-source-code-or-example-plain)
- num cont rtn rpllbl keepp textareap preserve-indentp cols rows fmt)
- (setq opts (or opts "")
- num (string-match "[-+]n\\>" opts)
- cont (string-match "\\+n\\>" opts)
- rpllbl (string-match "-r\\>" opts)
- keepp (string-match "-k\\>" opts)
- textareap (string-match "-t\\>" opts)
- preserve-indentp (or org-src-preserve-indentation
- (string-match "-i\\>" opts))
- cols (if (string-match "-w[ \t]+\\([0-9]+\\)" opts)
- (string-to-number (match-string 1 opts))
- 80)
- rows (if (string-match "-h[ \t]+\\([0-9]+\\)" opts)
- (string-to-number (match-string 1 opts))
- (org-count-lines code))
- fmt (if (string-match "-l[ \t]+\"\\([^\"\n]+\\)\"" opts)
- (match-string 1 opts)))
- (when (and textareap
- ;; (eq org-export-current-backend 'html)
- )
- ;; we cannot use numbering or highlighting.
- (setq num nil cont nil lang nil))
- (if keepp (setq rpllbl 'keep))
- (setq rtn (if preserve-indentp code (org-remove-indentation code)))
- (when (string-match "^," rtn)
- (setq rtn (with-temp-buffer
- (insert rtn)
- ;; Free up the protected lines
- (goto-char (point-min))
- (while (re-search-forward "^," nil t)
- (if (or (equal lang "org")
- (save-match-data
- (looking-at "\\([*#]\\|[ \t]*#\\+\\)")))
- (replace-match ""))
- (end-of-line 1))
- (buffer-string))))
- (when lang
- (if (featurep 'xemacs)
- (require 'htmlize)
- (require 'htmlize nil t)))
-
- (setq backend-formatter
- (cond
- ((fboundp 'htmlize-region-for-paste)
- 'org-e-html-format-source-code-or-example-colored)
- (t
- (message
- "htmlize.el 1.34 or later is needed for source code formatting")
- 'org-e-html-format-source-code-or-example-plain)))
- (funcall backend-formatter rtn lang caption textareap cols rows
- num cont rpllbl fmt))))
-
(defun org-e-html-example-block (example-block contents info)
"Transcode a EXAMPLE-BLOCK element from Org to HTML.
CONTENTS is nil. INFO is a plist holding contextual information."
(let* ((options (or (org-element-property :options example-block) ""))
- (value (org-export-handle-code example-block info nil nil t)))
- ;; (org-e-html--wrap-label
- ;; example-block (format "\\begin{verbatim}\n%s\\end{verbatim}" value))
- (org-e-html--wrap-label
- example-block (org-e-html-format-source-code-or-example nil value))))
+ (lang (org-element-property :language example-block))
+ (caption (org-element-property :caption example-block))
+ (label (org-element-property :name example-block))
+ (caption-str (org-e-html--caption/label-string caption label info))
+ (attr (mapconcat #'identity
+ (org-element-property :attr_html example-block)
+ " "))
+ ;; (switches (org-element-property :switches example-block))
+ (switches nil) ; FIXME
+ (textarea-p (and switches (string-match "-t\\>" switches)))
+ (code (org-e-html-format-code example-block info)))
+ (cond
+ (textarea-p
+ (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
+ 80 (string-to-number (match-string 1 switches))))
+ (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
+ (string-to-number (match-string 1 switches))
+ (org-count-lines code))))
+ (format
+ "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
+ cols rows code)))
+ (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
;;;; Export Snippet
@@ -2023,7 +1982,8 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"^[ \t]*: ?" ""
(org-element-property :value fixed-width)))))
(org-e-html--wrap-label
- fixed-width (org-e-html-format-source-code-or-example nil value))))
+ fixed-width (format "\n<pre class=\"example\">\n%s\n</pre>"
+ (org-e-html-do-format-code value)))))
;;;; Footnote Definition
@@ -2094,7 +2054,7 @@ holding contextual information."
(funcall org-e-html-format-headline-function
todo todo-type priority text tags))))
(t 'org-e-html-format-headline))))
- (apply format-function
+ (apply format-function
todo todo-type priority text tags
:headline-label headline-label :level level
:section-number section-number extra-keys)))
@@ -2217,7 +2177,7 @@ holding contextual information."
inlinetask info format-function :contents contents)))
;; Otherwise, use a default template.
(t (org-e-html--wrap-label
- inlinetask
+ inlinetask
(format
"\n<div class=\"inlinetask\">\n<b>%s</b><br/>\n%s\n</div>"
(org-e-html-format-headline--wrap inlinetask info)
@@ -2540,7 +2500,7 @@ INFO is a plist holding contextual information. See
;; equivalent line number.
((string= type "coderef")
(let ((fragment (concat "coderef-" path)))
- (format "<a href=#%s %s>%s</a>" fragment
+ (format "<a href=\"#%s\" %s>%s</a>" fragment
(format (concat "class=\"coderef\""
" onmouseover=\"CodeHighlightOn(this, '%s');\""
" onmouseout=\"CodeHighlightOff(this, '%s');\"")
@@ -2766,17 +2726,32 @@ holding contextual information."
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((lang (org-element-property :language src-block))
- (code (org-export-handle-code src-block info nil nil t))
(caption (org-element-property :caption src-block))
- (label (org-element-property :name src-block)))
- ;; FIXME: Handle caption
-
- ;; caption-str (when caption)
- ;; (main (org-export-secondary-string (car caption) 'e-html info))
- ;; (secondary (org-export-secondary-string (cdr caption) 'e-html info))
- ;; (caption-str (org-e-html--caption/label-string caption label info))
- (org-e-html-format-source-code-or-example lang code)))
-
+ (label (org-element-property :name src-block))
+ (caption-str (org-e-html--caption/label-string caption label info))
+ (attr (mapconcat #'identity
+ (org-element-property :attr_html src-block)
+ " "))
+ ;; (switches (org-element-property :switches src-block))
+ (switches nil) ; FIXME
+ (textarea-p (and switches (string-match "-t\\>" switches)))
+ (code (org-e-html-format-code src-block info)))
+ (cond
+ (lang (format
+ "\n<div class=\"org-src-container\">\n%s%s\n</div>"
+ (if (not caption) ""
+ (format "<label class=\"org-src-name\">%s</label>" caption-str))
+ (format "\n<pre class=\"src src-%s\">%s\n</pre>" lang code)))
+ (textarea-p
+ (let ((cols (if (not (string-match "-w[ \t]+\\([0-9]+\\)" switches))
+ 80 (string-to-number (match-string 1 switches))))
+ (rows (if (string-match "-h[ \t]+\\([0-9]+\\)" switches)
+ (string-to-number (match-string 1 switches))
+ (org-count-lines code))))
+ (format
+ "\n<p>\n<textarea cols=\"%d\" rows=\"%d\">\n%s\n</textarea>\n</p>"
+ cols rows code)))
+ (t (format "\n<pre class=\"example\">\n%s\n</pre>" code)))))
;;;; Statistics Cookie
diff --git a/EXPERIMENTAL/org-e-odt.el b/EXPERIMENTAL/org-e-odt.el
index ece643f..9b59954 100644
--- a/EXPERIMENTAL/org-e-odt.el
+++ b/EXPERIMENTAL/org-e-odt.el
@@ -623,38 +623,6 @@ styles congruent with the ODF-1.2 specification."
((string= s "\t") (org-e-odt-format-tabs))
(t (org-e-odt-format-spaces (length s))))) line))
-
-(defun org-e-odt-format-source-line-with-line-number-and-label
- (line fontifier par-style)
- (let (;; (keep-label (not (numberp rpllbl)))
- (ref (org-find-text-property-in-string 'org-coderef line))
- (num (org-find-text-property-in-string 'org-loc line)))
- (setq line (concat line (and ref (format "(%s)" ref))))
- (setq line (funcall fontifier line))
- (when ref
- (setq line (org-e-odt-format-target line (concat "coderef-" ref))))
- (setq line (org-e-odt-format-stylized-paragraph par-style line))
- (if (not num) line
- (org-e-odt-format-tags
- '("<text:list-item>" . "</text:list-item>") line))))
-
-(defun org-e-odt-format-source-code-or-example-plain
- (lines lang caption textareap cols rows num cont rpllbl fmt)
- "Format source or example blocks much like fixedwidth blocks.
-Use this when `org-export-e-odt-fontify-srcblocks' option is turned
-off."
- (let* ((lines (org-split-string lines "[\r\n]"))
- (line-count (length lines))
- (i 0))
- (mapconcat
- (lambda (line)
- (incf i)
- (org-e-odt-format-source-line-with-line-number-and-label
- line 'org-e-odt-encode-plain-text
- (if (= i line-count) "OrgFixedWidthBlockLastLine"
- "OrgFixedWidthBlock")))
- lines "\n")))
-
(defun org-e-odt-hfy-face-to-css (fn)
"Create custom style for face FN.
When FN is the default face, use it's foreground and background
@@ -702,76 +670,6 @@ Update styles.xml with styles that were collected as part of
(goto-char (match-beginning 0))
(insert "\n<!-- Org Htmlfontify Styles -->\n" styles "\n")))))
-(defun org-e-odt-format-source-code-or-example-colored (lines lang caption)
- "Format source or example blocks using `htmlfontify-string'.
-Use this routine when `org-export-e-odt-fontify-srcblocks' option
-is turned on."
- (let* ((lang-m (and lang (or (cdr (assoc lang org-src-lang-modes)) lang)))
- (mode (and lang-m (intern (concat (if (symbolp lang-m)
- (symbol-name lang-m)
- lang-m) "-mode"))))
- (org-inhibit-startup t)
- (org-startup-folded nil)
- (lines (with-temp-buffer
- (insert lines)
- (if (functionp mode) (funcall mode) (fundamental-mode))
- (font-lock-fontify-buffer)
- (buffer-string)))
- (hfy-html-quote-regex "\\([<\"&> ]\\)")
- (hfy-html-quote-map '(("\"" "&quot;")
- ("<" "&lt;")
- ("&" "&amp;")
- (">" "&gt;")
- (" " "<text:s/>")
- (" " "<text:tab/>")))
- (hfy-face-to-css 'org-e-odt-hfy-face-to-css)
- (hfy-optimisations-1 (copy-seq hfy-optimisations))
- (hfy-optimisations (add-to-list 'hfy-optimisations-1
- 'body-text-only))
- (hfy-begin-span-handler
- (lambda (style text-block text-id text-begins-block-p)
- (insert (format "<text:span text:style-name=\"%s\">" style))))
- (hfy-end-span-handler (lambda nil (insert "</text:span>"))))
- (when (fboundp 'htmlfontify-string)
- (let* ((lines (org-split-string lines "[\r\n]"))
- (line-count (length lines))
- (i 0))
- (mapconcat
- (lambda (line)
- (incf i)
- (org-e-odt-format-source-line-with-line-number-and-label
- line 'htmlfontify-string
- (if (= i line-count) "OrgSrcBlockLastLine" "OrgSrcBlock")))
- lines "\n")))))
-
-(defun org-e-odt-format-source-code-or-example (lines lang
- &optional caption ; FIXME
- )
- "Format source or example blocks for export.
-Use `org-e-odt-format-source-code-or-example-plain' or
-`org-e-odt-format-source-code-or-example-colored' depending on the
-value of `org-export-e-odt-fontify-srcblocks."
- (setq ;; lines (org-export-number-lines
- ;; lines 0 0 num cont rpllbl fmt 'preprocess) FIXME
- lines (funcall
- (or (and org-export-e-odt-fontify-srcblocks
- (or (featurep 'htmlfontify)
- ;; htmlfontify.el was introduced in Emacs 23.2
- ;; So load it with some caution
- (require 'htmlfontify nil t))
- (fboundp 'htmlfontify-string)
- 'org-e-odt-format-source-code-or-example-colored)
- 'org-e-odt-format-source-code-or-example-plain)
- lines lang caption))
- (let ((num (org-find-text-property-in-string 'org-loc lines)))
- (if (not num) lines
- (let* ((cont (not (equal num 1)))
- (extra (format " text:continue-numbering=\"%s\""
- (if cont "true" "false"))))
- (org-e-odt-format-tags
- '("<text:list text:style-name=\"OrgSrcBlockNumberedLine\"%s>"
- . "</text:list>") lines extra)))))
-
(defun org-e-odt-remap-stylenames (style-name)
(or
(cdr (assoc style-name '(("timestamp-wrapper" . "OrgTimestampWrapper")
@@ -3325,6 +3223,92 @@ This function shouldn't be used for floats. See
+;;; Transcode Helpers
+
+;;;; Src Code
+
+(defun org-e-odt-htmlfontify-string (line)
+ (let* ((hfy-html-quote-regex "\\([<\"&> ]\\)")
+ (hfy-html-quote-map '(("\"" "&quot;")
+ ("<" "&lt;")
+ ("&" "&amp;")
+ (">" "&gt;")
+ (" " "<text:s/>")
+ (" " "<text:tab/>")))
+ (hfy-face-to-css 'org-e-odt-hfy-face-to-css)
+ (hfy-optimisations-1 (copy-seq hfy-optimisations))
+ (hfy-optimisations (add-to-list 'hfy-optimisations-1
+ 'body-text-only))
+ (hfy-begin-span-handler
+ (lambda (style text-block text-id text-begins-block-p)
+ (insert (format "<text:span text:style-name=\"%s\">" style))))
+ (hfy-end-span-handler (lambda nil (insert "</text:span>"))))
+ (htmlfontify-string line)))
+
+(defun org-e-odt-do-format-code
+ (code &optional lang refs retain-labels num-start)
+ (let* ((lang (or (assoc-default lang org-src-lang-modes) lang))
+ (lang-mode (and lang (intern (format "%s-mode" lang))))
+ (code-lines (org-split-string code "\n"))
+ (code-length (length code-lines))
+ (use-htmlfontify-p (and (functionp lang-mode)
+ org-export-e-odt-fontify-srcblocks
+ (require 'htmlfontify nil t)
+ (fboundp 'htmlfontify-string)))
+ (code (if (not use-htmlfontify-p) code
+ (with-temp-buffer
+ (insert code)
+ (funcall lang-mode)
+ (font-lock-fontify-buffer)
+ (buffer-string))))
+ (fontifier (if use-htmlfontify-p 'org-e-odt-htmlfontify-string
+ 'org-e-odt-encode-plain-text))
+ (par-style (if use-htmlfontify-p "OrgSrcBlock"
+ "OrgFixedWidthBlock"))
+ (i 0))
+ (assert (= code-length (length (org-split-string code "\n"))))
+ (setq code
+ (org-export-format-code
+ code
+ (lambda (loc line-num ref)
+ (setq par-style
+ (concat par-style (and (= (incf i) code-length) "LastLine")))
+
+ (setq loc (concat loc (and ref retain-labels (format " (%s)" ref))))
+ (setq loc (funcall fontifier loc))
+ (when ref
+ (setq loc (org-e-odt-format-target loc (concat "coderef-" ref))))
+ (setq loc (org-e-odt-format-stylized-paragraph par-style loc))
+ (if (not line-num) loc
+ (org-e-odt-format-tags
+ '("<text:list-item>" . "</text:list-item>") loc)))
+ num-start refs))
+ (cond
+ ((not num-start) code)
+ ((equal num-start 0)
+ (org-e-odt-format-tags
+ '("<text:list text:style-name=\"OrgSrcBlockNumberedLine\"%s>"
+ . "</text:list>") code " text:continue-numbering=\"false\""))
+ (t (org-e-odt-format-tags
+ '("<text:list text:style-name=\"OrgSrcBlockNumberedLine\"%s>"
+ . "</text:list>") code " text:continue-numbering=\"true\"")))))
+
+(defun org-e-odt-format-code (element info)
+ (let* ((lang (org-element-property :language element))
+ ;; Extract code and references.
+ (code-info (org-export-unravel-code element))
+ (code (car code-info))
+ (refs (cdr code-info))
+ ;; Does the src block contain labels?
+ (retain-labels (org-element-property :retain-labels element))
+ ;; Does it have line numbers?
+ (num-start (case (org-element-property :number-lines element)
+ (continued (org-export-get-loc element info))
+ (new 0))))
+ (org-e-odt-do-format-code code lang refs retain-labels num-start)))
+
+
+
;;; Template
(defun org-e-odt-template (contents info)
@@ -4192,7 +4176,6 @@ holding contextual information."
CONTENTS holds the contents of the item. INFO is a plist holding
contextual information."
(let* ((lang (org-element-property :language src-block))
- (code (org-export-handle-code src-block info nil nil t))
(caption (org-element-property :caption src-block))
(label (org-element-property :name src-block)))
;; FIXME: Handle caption
@@ -4201,7 +4184,7 @@ contextual information."
;; (main (org-export-secondary-string (car caption) 'e-odt info))
;; (secondary (org-export-secondary-string (cdr caption) 'e-odt info))
;; (caption-str (org-e-odt--caption/label-string caption label info))
- (org-e-odt-format-source-code-or-example code lang)))
+ (org-e-odt-format-code src-block info)))
;;;; Statistics Cookie
diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index f238483..bdd9996 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -388,7 +388,7 @@ This function should be called from `gnus-article-prepare-hook'."
(let ((mails (org-entry-get (point) org-contacts-email-property)))
(unless (member mail (split-string mails))
(when (yes-or-no-p
- (format "Do you want to this address to %s?" (org-get-heading t)))
+ (format "Do you want to add this address to %s?" (org-get-heading t)))
(org-set-property org-contacts-email-property (concat mails " " mail))))))
(defun org-contacts-gnus-check-mail-address ()
diff --git a/contrib/lisp/org-element.el b/contrib/lisp/org-element.el
index 36e0408..3cc5c98 100644
--- a/contrib/lisp/org-element.el
+++ b/contrib/lisp/org-element.el
@@ -3919,6 +3919,8 @@ modified."
((eq (org-element-type element) 'plain-list)
(forward-char))
((memq (org-element-type element) org-element-greater-elements)
+ ;; If contents are hidden, first disclose them.
+ (when (org-element-property :hiddenp element) (org-cycle))
(goto-char (org-element-property :contents-begin element)))
(t (error "No inner element")))))
diff --git a/doc/org.texi b/doc/org.texi
index 68836e0..f213654 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -13673,6 +13673,9 @@ references will not be expanded when the code block is exported.
``Noweb'' syntax references in the body of the code block will be expanded
before the block is evaluated or tangled. However, ``noweb'' syntax
references will not be removed when the code block is exported.
+@item @code{eval}
+``Noweb'' syntax references in the body of the code block will only be
+expanded before the block is evaluated.
@end itemize
@subsubheading Noweb prefix lines
diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el
index 0dde0de..0e9b0c6 100644
--- a/lisp/ob-lilypond.el
+++ b/lisp/ob-lilypond.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
;; Author: Martyn Jago
-;; Keywords: babel language, literate programming
+;; Keywords: babel language, literate programming, music score
;; Homepage: https://github.com/mjago/ob-lilypond
;; This file is part of GNU Emacs.
@@ -23,10 +23,14 @@
;;; Commentary:
-;; Installation / usage info, and examples are available at
-;; https://github.com/mjago/ob-lilypond
+;; Installation, ob-lilypond documentation, and examples are available at
+;; http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-lilypond.html
+;;
+;; Lilypond documentation can be found at
+;; http://lilypond.org/manuals.html
;;; Code:
+
(require 'ob)
(require 'ob-eval)
(require 'ob-tangle)
@@ -37,9 +41,11 @@
(add-to-list 'org-babel-tangle-lang-exts '("LilyPond" . "ly"))
(defvar org-babel-default-header-args:lilypond '()
- "Default header arguments for js code blocks.")
+ "Default header arguments for lilypond code blocks.
+NOTE: The arguments are determined at lilypond compile time.
+See (ly-set-header-args)")
-(defconst ly-version "0.3"
+(defconst ly-version "7.6"
"The version number of the file ob-lilypond.el.")
(defvar ly-compile-post-tangle t
@@ -86,6 +92,10 @@ LY-GEN-SVG to t")
"HTML generation can be turned on by default by setting
LY-GEN-HTML to t")
+(defvar ly-gen-pdf nil
+"PDF generation can be turned on by default by setting
+LY-GEN-PDF to t")
+
(defvar ly-use-eps nil
"You can force the compiler to use the EPS backend by setting
LY-USE-EPS to t")
@@ -203,18 +213,20 @@ FILE-NAME is full path to lilypond (.ly) file"
(arg-2 nil) ;infile
(arg-3 "*lilypond*") ;buffer
(arg-4 t) ;display
- (arg-5 (if ly-gen-png "--png" "")) ;&rest...
- (arg-6 (if ly-gen-html "--html" ""))
- (arg-7 (if ly-use-eps "-dbackend=eps" ""))
- (arg-8 (if ly-gen-svg "-dbackend=svg" ""))
- (arg-9 (concat "--output=" (file-name-sans-extension file-name)))
- (arg-10 file-name))
+ (arg-4 t) ;display
+ (arg-5 (if ly-gen-png "--png" "")) ;&rest...
+ (arg-6 (if ly-gen-html "--html" ""))
+ (arg-7 (if ly-gen-pdf "--pdf" ""))
+ (arg-8 (if ly-use-eps "-dbackend=eps" ""))
+ (arg-9 (if ly-gen-svg "-dbackend=svg" ""))
+ (arg-10 (concat "--output=" (file-name-sans-extension file-name)))
+ (arg-11 file-name))
(if test
- `(,arg-1 ,arg-2 ,arg-3 ,arg-4 ,arg-5
- ,arg-6 ,arg-7 ,arg-8 ,arg-9 ,arg-10)
+ `(,arg-1 ,arg-2 ,arg-3 ,arg-4 ,arg-5 ,arg-6
+ ,arg-7 ,arg-8 ,arg-9 ,arg-10 ,arg-11)
(call-process
- arg-1 arg-2 arg-3 arg-4 arg-5
- arg-6 arg-7 arg-8 arg-9 arg-10))))
+ arg-1 arg-2 arg-3 arg-4 arg-5 arg-6
+ arg-7 arg-8 arg-9 arg-10 arg-11))))
(defun ly-check-for-compile-error (file-name &optional test)
"Check for compile error.
@@ -307,8 +319,12 @@ If TEST is non-nil, the shell command is returned and is not run"
(concat (ly-determine-pdf-path) " " pdf-file)))
(if test
cmd-string
- (shell-command cmd-string)))
- (message "No pdf file generated so can't display!")))))
+ (start-process
+ "\"Audition pdf\""
+ "*lilypond*"
+ (ly-determine-pdf-path)
+ pdf-file)))
+ (message "No pdf file generated so can't display!")))))
(defun ly-attempt-to-play-midi (file-name &optional test)
"Attempt to play the generated MIDI file
@@ -322,7 +338,11 @@ If TEST is non-nil, the shell command is returned and is not run"
(concat (ly-determine-midi-path) " " midi-file)))
(if test
cmd-string
- (shell-command cmd-string)))
+ (start-process
+ "\"Audition midi\""
+ "*lilypond*"
+ (ly-determine-midi-path)
+ midi-file)))
(message "No midi file generated so can't play!")))))
(defun ly-determine-ly-path (&optional test)
@@ -399,6 +419,15 @@ If TEST is non-nil, it contains a simulation of the OS for test purposes"
(message (concat "HTML generation has been "
(if ly-gen-html "ENABLED." "DISABLED."))))
+(defun ly-toggle-pdf-generation ()
+ "Toggle whether pdf will be generated by compilation"
+
+ (interactive)
+ (setq ly-gen-pdf
+ (not ly-gen-pdf))
+ (message (concat "PDF generation has been "
+ (if ly-gen-pdf "ENABLED." "DISABLED."))))
+
(defun ly-toggle-arrange-mode ()
"Toggle whether in Arrange mode or Basic mode"
@@ -428,6 +457,7 @@ mode i.e. ARRANGE-MODE is t"
'((:tangle . "yes")
(:noweb . "yes")
(:results . "silent")
+ (:cache . "yes")
(:comments . "yes")))
(t
'((:results . "file")
@@ -441,6 +471,4 @@ dependent on LY-ARRANGE-MODE"
(provide 'ob-lilypond)
-
-
;;; ob-lilypond.el ends here
diff --git a/lisp/ob-sh.el b/lisp/ob-sh.el
index 6f4cb4f..1fbac1d 100644
--- a/lisp/ob-sh.el
+++ b/lisp/ob-sh.el
@@ -56,14 +56,13 @@ This will be passed to `shell-command-on-region'")
This function is called by `org-babel-execute-src-block'."
(let* ((session (org-babel-sh-initiate-session
(cdr (assoc :session params))))
- (result-params (cdr (assoc :result-params params)))
(stdin ((lambda (stdin) (when stdin (org-babel-sh-var-to-string
(org-babel-ref-resolve stdin))))
(cdr (assoc :stdin params))))
(full-body (org-babel-expand-body:generic
body params (org-babel-variable-assignments:sh params))))
(org-babel-reassemble-table
- (org-babel-sh-evaluate session full-body result-params stdin)
+ (org-babel-sh-evaluate session full-body params stdin)
(org-babel-pick-name
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
(org-babel-pick-name
@@ -134,29 +133,38 @@ Emacs-lisp table, otherwise return the results as a string."
(defvar org-babel-sh-eoe-output "org_babel_sh_eoe"
"String to indicate that evaluation has completed.")
-(defun org-babel-sh-evaluate (session body &optional result-params stdin)
+(defun org-babel-sh-evaluate (session body &optional params stdin)
"Pass BODY to the Shell process in BUFFER.
If RESULT-TYPE equals 'output then return a list of the outputs
of the statements in BODY, if RESULT-TYPE equals 'value then
return the value of the last statement in BODY."
((lambda (results)
(when results
- (if (or (member "scalar" result-params)
- (member "verbatim" result-params)
- (member "output" result-params))
- results
- (let ((tmp-file (org-babel-temp-file "sh-")))
- (with-temp-file tmp-file (insert results))
- (org-babel-import-elisp-from-file tmp-file)))))
+ (let ((result-params (cdr (assoc :result-params params))))
+ (if (or (member "scalar" result-params)
+ (member "verbatim" result-params)
+ (member "output" result-params))
+ results
+ (let ((tmp-file (org-babel-temp-file "sh-")))
+ (with-temp-file tmp-file (insert results))
+ (org-babel-import-elisp-from-file tmp-file))))))
(cond
(stdin ; external shell script w/STDIN
(let ((script-file (org-babel-temp-file "sh-script-"))
- (stdin-file (org-babel-temp-file "sh-stdin-")))
- (with-temp-file script-file (insert body))
+ (stdin-file (org-babel-temp-file "sh-stdin-"))
+ (shebang (cdr (assoc :shebang params)))
+ (padline (not (string= "no" (cdr (assoc :padline params))))))
+ (with-temp-file script-file
+ (when shebang (insert (concat shebang "\n")))
+ (when padline (insert "\n"))
+ (insert body))
+ (set-file-modes script-file #o755)
(with-temp-file stdin-file (insert stdin))
(with-temp-buffer
(call-process-shell-command
- (format "%s %s" org-babel-sh-command script-file)
+ (if shebang
+ script-file
+ (format "%s %s" org-babel-sh-command script-file))
stdin-file
(current-buffer))
(buffer-string))))
@@ -182,7 +190,17 @@ return the value of the last statement in BODY."
(list org-babel-sh-eoe-indicator))))
2)) "\n"))
('otherwise ; external shell script
- (org-babel-eval org-babel-sh-command (org-babel-trim body))))))
+ (if (cdr (assoc :shebang params))
+ (let ((script-file (org-babel-temp-file "sh-script-"))
+ (shebang (cdr (assoc :shebang params)))
+ (padline (not (string= "no" (cdr (assoc :padline params))))))
+ (with-temp-file script-file
+ (when shebang (insert (concat shebang "\n")))
+ (when padline (insert "\n"))
+ (insert body))
+ (set-file-modes script-file #o755)
+ (org-babel-eval script-file ""))
+ (org-babel-eval org-babel-sh-command (org-babel-trim body)))))))
(defun org-babel-sh-strip-weird-long-prompt (string)
"Remove prompt cruft from a string of shell output."
diff --git a/lisp/ob.el b/lisp/ob.el
index 5dae47e..531cd16 100644
--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -59,6 +59,7 @@
(declare-function org-cycle "org" (&optional arg))
(declare-function org-uniquify "org" (list))
(declare-function org-current-level "org" ())
+(declare-function org-strip-protective-commas "org" (beg end))
(declare-function org-table-import "org-table" (file arg))
(declare-function org-add-hook "org-compat"
(hook function &optional append local))
@@ -1874,9 +1875,9 @@ code ---- the results are extracted in the syntax of the source
(setq results-switches
(if results-switches (concat " " results-switches) ""))
(flet ((wrap (start finish)
- (goto-char beg) (insert (concat start "\n"))
(goto-char end) (insert (concat finish "\n"))
- (setq end (point-marker)))
+ (goto-char beg) (insert (concat start "\n"))
+ (goto-char end) (setq end (point-marker)))
(proper-list-p (it) (and (listp it) (null (cdr (last it))))))
;; insert results based on type
(cond
@@ -2115,7 +2116,8 @@ parameters when merging lists."
(setq tangle (or (list (cdr pair)) tangle)))
(:noweb
(setq noweb (e-merge
- '(("yes" "no" "tangle" "no-export" "strip-export"))
+ '(("yes" "no" "tangle" "no-export"
+ "strip-export" "eval"))
noweb
(split-string (or (cdr pair) "")))))
(:cache
@@ -2159,7 +2161,7 @@ CONTEXT may be one of :tangle, :export or :eval."
(intersect (cdr as) bs)))))
(intersect (case context
(:tangle '("yes" "tangle" "no-export" "strip-export"))
- (:eval '("yes" "no-export" "strip-export"))
+ (:eval '("yes" "no-export" "strip-export" "eval"))
(:export '("yes")))
(split-string (or (cdr (assoc :noweb params)) "")))))
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 5152f05..4dac97a 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6213,7 +6213,7 @@ When this is the global TODO list, a prefix argument will be interpreted."
(defvar org-global-tags-completion-table nil)
(defvar org-agenda-filtered-by-category nil)
(defvar org-agenda-filter-form nil)
-
+(defvar org-agenda-filtered-by-category nil)
(defun org-agenda-filter-by-category (strip)
"Keep only those lines in the agenda buffer that have a specific category.
The category is that of the current line."
diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index 1816a07..7ba3d72 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -105,7 +105,7 @@ ln create a hard link. Note that this is not supported
:type '(choice
(const :tag "Don't store link" nil)
(const :tag "Link to origin location" t)
- (const :tag "Link to the attach-dir location" 'attached)))
+ (const :tag "Link to the attach-dir location" attached)))
;;;###autoload
(defun org-attach ()
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 196dd99..3be853e 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -57,6 +57,7 @@
(declare-function org-mark-ring-push "org" (&optional pos buffer))
(declare-function org-show-context "org" (&optional key))
(declare-function org-trim "org" (s))
+(declare-function org-skip-whitespace "org" ())
(declare-function outline-next-heading "outline")
(defvar org-outline-regexp-bol) ; defined in org.el
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 3bd9a7c..48253f7 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -300,6 +300,8 @@ Also exclude files matching `org-mobile-files-exclude-regexp'."
(push (cons file link-name) rtn)))
(nreverse rtn)))
+(defvar org-agenda-filter)
+
;;;###autoload
(defun org-mobile-push ()
"Push the current state of Org affairs to the WebDAV directory.
diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index c475bcc..7a4dc0d 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -50,6 +50,9 @@
:tag "Org"
:group 'org)
+(defvar org-drawer-regexp)
+(defvar org-property-re)
+
(defun org-thing-at-point ()
"Examine the thing at point and let the caller know what it is.
The return value is a string naming the thing at point."
@@ -247,6 +250,8 @@ This needs more work, to handle headings with lots of spaces in them."
lst))
(substring pcomplete-stub 1)))
+(defvar org-drawers)
+
(defun pcomplete/org-mode/drawer ()
"Complete a drawer name."
(let ((spc (save-excursion
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 9cd56d2..cc5a6ca 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -41,7 +41,8 @@
(declare-function org-at-table.el-p "org" ())
(declare-function org-get-indentation "org" (&optional line))
(declare-function org-switch-to-buffer-other-window "org" (&rest args))
-(declare-function org-pop-to-buffer-same-window
+(declare-function org-strip-protective-commas "org" (beg end))
+(declare-function org-pop-to-buffer-same-window
"org-compat" (&optional buffer-or-name norecord label))
(defcustom org-edit-src-region-extra nil
@@ -685,6 +686,8 @@ the language, a switch telling if the content should be in a single line."
(interactive)
(org-src-in-org-buffer (save-buffer)))
+(declare-function org-babel-tangle "ob-tangle" (&optional only-this-block target-file lang))
+
(defun org-src-tangle (arg)
"Tangle the parent buffer."
(interactive)
diff --git a/lisp/org.el b/lisp/org.el
index 951f692..7f8eddb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -76,6 +76,7 @@
(require 'gnus-sum))
(require 'calendar)
+(require 'format-spec)
;; Emacs 22 calendar compatibility: Make sure the new variables are available
(when (fboundp 'defvaralias)
@@ -4930,6 +4931,8 @@ sure that we are at the beginning of the line.")
"Matches an headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
+(defvar bidi-paragraph-direction)
+
;;;###autoload
(define-derived-mode org-mode outline-mode "Org"
"Outline-based notes management and organizer, alias
@@ -12854,7 +12857,7 @@ headlines matching this string."
(buffer-name (buffer-base-buffer)))))))
(case-fold-search nil)
(org-map-continue-from nil)
- lspos tags
+ lspos tags tags-list
(tags-alist (list (cons 0 org-file-tags)))
(llast 0) rtn rtn1 level category i txt
todo marker entry priority)
@@ -14986,6 +14989,7 @@ So these are more for recording a certain time/date."
(defvar org-read-date-final-answer nil)
(defvar org-read-date-analyze-futurep nil)
(defvar org-read-date-analyze-forced-year nil)
+(defvar org-read-date-inactive)
(defun org-read-date (&optional with-time to-time from-string prompt
default-time default-input inactive)
@@ -15185,7 +15189,6 @@ user."
(defvar def)
(defvar defdecode)
(defvar with-time)
-(defvar org-read-date-inactive)
(defun org-read-date-display ()
"Display the current date prompt interpretation in the minibuffer."
(when org-read-date-display-live
@@ -17008,6 +17011,8 @@ Some of the options can be changed using the variable
(error "Unknown conversion type %s for latex fragments"
processing-type)))))))))
+(declare-function format-spec "format-spec" (format specification))
+
(defun org-create-math-formula (latex-frag &optional mathml-file)
"Convert LATEX-FRAG to MathML and store it in MATHML-FILE.
Use `org-latex-to-mathml-convert-command'. If the conversion is
diff --git a/testing/lisp/test-ob-lilypond.el b/testing/lisp/test-ob-lilypond.el
index 03df6ef..306c48a 100644
--- a/testing/lisp/test-ob-lilypond.el
+++ b/testing/lisp/test-ob-lilypond.el
@@ -42,10 +42,10 @@
(should (boundp 'ly-version)))
(ert-deftest ob-lilypond/ly-version-command ()
- (should (equal "ob-lilypond version 0.3" (ly-version)))
+ (should (equal "ob-lilypond version 7.6" (ly-version)))
(with-temp-buffer
(ly-version t)
- (should (equal "ob-lilypond version 0.3"
+ (should (equal "ob-lilypond version 7.6"
(buffer-substring (point-min) (point-max))))))
(ert-deftest ob-lilypond/ly-compile-lilyfile ()
@@ -56,6 +56,7 @@
t ;display
,(if ly-gen-png "--png" "") ;&rest...
,(if ly-gen-html "--html" "")
+ ,(if ly-gen-pdf "--pdf" "")
,(if ly-use-eps "-dbackend=eps" "")
,(if ly-gen-svg "-dbackend=svg" "")
"--output=test-file"
@@ -116,6 +117,9 @@
(ert-deftest ob-lilypond/ly-gen-html ()
(should (boundp 'ly-gen-html)))
+(ert-deftest ob-lilypond/ly-gen-html ()
+ (should (boundp 'ly-gen-pdf)))
+
(ert-deftest ob-lilypond/use-eps ()
(should (boundp 'ly-use-eps)))
@@ -296,6 +300,18 @@
(ly-toggle-pdf-display)
(should (not ly-display-pdf-post-tangle))))
+(ert-deftest ob-lilypond/ly-toggle-pdf-generation-toggles-flag ()
+ (if ly-gen-pdf
+ (progn
+ (ly-toggle-pdf-generation)
+ (should (not ly-gen-pdf))
+ (ly-toggle-pdf-generation)
+ (should ly-gen-pdf))
+ (ly-toggle-pdf-generation)
+ (should ly-gen-pdf)
+ (ly-toggle-pdf-generation)
+ (should (not ly-gen-pdf))))
+
(ert-deftest ob-lilypond/ly-toggle-arrange-mode ()
(if ly-arrange-mode
(progn
@@ -348,6 +364,7 @@
(should (equal '((:tangle . "yes")
(:noweb . "yes")
(:results . "silent")
+ (:cache . "yes")
(:comments . "yes"))
(ly-set-header-args t)))
(should (equal '((:results . "file")
@@ -359,6 +376,7 @@
(should (equal '((:tangle . "yes")
(:noweb . "yes")
(:results . "silent")
+ (:cache . "yes")
(:comments . "yes"))
org-babel-default-header-args:lilypond))
(ly-set-header-args nil)