Merge branch 'maint' into emacs-sync

This commit is contained in:
Kyle Meyer 2017-12-25 12:32:03 -05:00
commit 3db01cd656
26 changed files with 267 additions and 113 deletions

View File

@ -74,7 +74,6 @@
(declare-function org-mark-ring-push "org" (&optional pos buffer))
(declare-function org-narrow-to-subtree "org" ())
(declare-function org-next-block "org" (arg &optional backward block-regexp))
(declare-function org-number-sequence "org-compat" (from &optional to inc))
(declare-function org-open-at-point "org" (&optional in-emacs reference-buffer))
(declare-function org-outline-overlay-data "org" (&optional use-markers))
(declare-function org-previous-block "org" (arg &optional block-regexp))
@ -82,7 +81,7 @@
(declare-function org-reverse-string "org" (string))
(declare-function org-set-outline-overlay-data "org" (data))
(declare-function org-show-context "org" (&optional key))
(declare-function org-src-coderef-format "org-src" (element))
(declare-function org-src-coderef-format "org-src" (&optional element))
(declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
(declare-function org-table-align "org-table" ())
(declare-function org-table-end "org-table" (&optional table-type))
@ -2761,22 +2760,27 @@ block but are passed literally to the \"example-block\"."
(if org-babel-use-quick-and-dirty-noweb-expansion
(while (re-search-forward rx nil t)
(let* ((i (org-babel-get-src-block-info 'light))
(body (org-babel-expand-noweb-references i))
(body (if (org-babel-noweb-p (nth 2 i) :eval)
(org-babel-expand-noweb-references i)
(nth 1 i)))
(sep (or (cdr (assq :noweb-sep (nth 2 i)))
"\n"))
(full (if comment
(let ((cs (org-babel-tangle-comment-links i)))
(concat (funcall c-wrap (car cs)) "\n"
body "\n"
(funcall c-wrap (cadr cs))))
(concat (funcall c-wrap (car cs)) "\n"
body "\n"
(funcall c-wrap (cadr cs))))
body)))
(setq expansion (cons sep (cons full expansion)))))
(org-babel-map-src-blocks nil
(let ((i (org-babel-get-src-block-info 'light)))
(let ((i (let ((org-babel-current-src-block-location (point)))
(org-babel-get-src-block-info 'light))))
(when (equal (or (cdr (assq :noweb-ref (nth 2 i)))
(nth 4 i))
source-name)
(let* ((body (org-babel-expand-noweb-references i))
(let* ((body (if (org-babel-noweb-p (nth 2 i) :eval)
(org-babel-expand-noweb-references i)
(nth 1 i)))
(sep (or (cdr (assq :noweb-sep (nth 2 i)))
"\n"))
(full (if comment

View File

@ -116,6 +116,8 @@ code."
(timefmt (cdr (assq :timefmt params)))
(time-ind (or (cdr (assq :timeind params))
(when timefmt 1)))
(directory (and (buffer-file-name)
(file-name-directory (buffer-file-name))))
(add-to-body (lambda (text) (setq body (concat text "\n" body)))))
;; append header argument settings to body
(when title (funcall add-to-body (format "set title '%s'" title)))
@ -161,7 +163,10 @@ code."
(format "\\$%s" (car pair)) (cdr pair) body)))
vars)
(when prologue (funcall add-to-body prologue))
(when epilogue (setq body (concat body "\n" epilogue))))
(when epilogue (setq body (concat body "\n" epilogue)))
;; Setting the directory needs to be done first so that
;; subsequent 'output' directive goes to the right place.
(when directory (funcall add-to-body (format "cd '%s'" directory))))
body))
(defun org-babel-execute:gnuplot (body params)

View File

@ -59,14 +59,23 @@
(defvar org-babel-haskell-eoe "\"org-babel-haskell-eoe\"")
(defvar haskell-prompt-regexp)
(defun org-babel-execute:haskell (body params)
"Execute a block of Haskell code."
(require 'inf-haskell)
(add-hook 'inferior-haskell-hook
(lambda ()
(setq-local comint-prompt-regexp
(concat haskell-prompt-regexp "\\|^λ?> "))))
(let* ((session (cdr (assq :session params)))
(result-type (cdr (assq :result-type params)))
(full-body (org-babel-expand-body:generic
body params
(org-babel-variable-assignments:haskell params)))
(session (org-babel-haskell-initiate-session session params))
(comint-preoutput-filter-functions
(cons 'ansi-color-filter-apply comint-preoutput-filter-functions))
(raw (org-babel-comint-with-output
(session org-babel-haskell-eoe t full-body)
(insert (org-trim full-body))

View File

@ -239,6 +239,15 @@ def main():
open('%s', 'w').write( pprint.pformat(main()) )")
(defconst org-babel-python--exec-tmpfile
(concat
"__org_babel_python_fname = '%s'; "
"__org_babel_python_fh = open(__org_babel_python_fname); "
"exec(compile("
"__org_babel_python_fh.read(), __org_babel_python_fname, 'exec'"
")); "
"__org_babel_python_fh.close()"))
(defun org-babel-python-evaluate
(session body &optional result-type result-params preamble)
"Evaluate BODY as Python code."
@ -306,16 +315,23 @@ last statement in BODY, as elisp."
(results
(pcase result-type
(`output
(mapconcat
#'org-trim
(butlast
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator t body)
(funcall input-body body)
(funcall send-wait) (funcall send-wait)
(insert org-babel-python-eoe-indicator)
(funcall send-wait))
2) "\n"))
(let ((body (if (string-match-p ".\n+." body) ; Multiline
(let ((tmp-src-file (org-babel-temp-file
"python-")))
(with-temp-file tmp-src-file (insert body))
(format org-babel-python--exec-tmpfile
tmp-src-file))
body)))
(mapconcat
#'org-trim
(butlast
(org-babel-comint-with-output
(session org-babel-python-eoe-indicator t body)
(funcall input-body body)
(funcall send-wait) (funcall send-wait)
(insert org-babel-python-eoe-indicator)
(funcall send-wait))
2) "\n")))
(`value
(let ((tmp-file (org-babel-temp-file "python-")))
(org-babel-comint-with-output

View File

@ -65,24 +65,21 @@
(declare-function org-show-context "org" (&optional key))
(declare-function org-trim "org" (s &optional keep-lead))
(defvar org-babel-ref-split-regexp
"[ \f\t\n\r\v]*\\(.+?\\)[ \f\t\n\r\v]*=[ \f\t\n\r\v]*\\(.+\\)[ \f\t\n\r\v]*")
(defvar org-babel-update-intermediate nil
"Update the in-buffer results of code blocks executed to resolve references.")
(defun org-babel-ref-parse (assignment)
"Parse a variable ASSIGNMENT in a header argument.
If the right hand side of the assignment has a literal value
return that value, otherwise interpret as a reference to an
external resource and find its value using
`org-babel-ref-resolve'. Return a list with two elements. The
first element of the list will be the name of the variable, and
the second will be an emacs-lisp representation of the value of
the variable."
(when (string-match org-babel-ref-split-regexp assignment)
(let ((var (match-string 1 assignment))
(ref (match-string 2 assignment)))
return that value, otherwise interpret it as a reference to an
external resource and find its value using `org-babel-ref-resolve'.
Return a list with two elements: the name of the variable, and an
Emacs Lisp representation of the value of the variable."
(when (string-match "\\(.+?\\)=" assignment)
(let ((var (org-trim (match-string 1 assignment)))
(ref (org-trim (substring assignment (match-end 0)))))
(cons (intern var)
(let ((out (save-excursion
(when org-babel-current-src-block-location

View File

@ -40,6 +40,7 @@
;;; Code:
(require 'ob)
(require 'geiser nil t)
(require 'geiser-impl nil t)
(defvar geiser-repl--repl) ; Defined in geiser-repl.el
(defvar geiser-impl--implementation) ; Defined in geiser-impl.el
(defvar geiser-default-implementation) ; Defined in geiser-impl.el

View File

@ -49,11 +49,12 @@
(defcustom org-babel-stan-cmdstan-directory nil
"CmdStan source directory.
'make' will be called from this directory to compile the Stan
block. When nil, executing Stan blocks dumps the content to a
plain text file."
Call \"make\" from this directory to compile the Stan block.
When nil, executing Stan blocks dumps the content to a file."
:group 'org-babel
:type 'string)
:type '(choice
(directory :tag "Compilation directory")
(const :tag "Dump to a file" nil)))
(defvar org-babel-default-header-args:stan
'((:results . "file")))

View File

@ -395,35 +395,35 @@ the daily/weekly agenda, see `org-agenda-skip-function'.")
(choice
:tag "Condition type"
(list :tag "Regexp matches" :inline t
(const :format "" 'regexp)
(const :format "" regexp)
(regexp))
(list :tag "Regexp does not match" :inline t
(const :format "" 'notregexp)
(const :format "" notregexp)
(regexp))
(list :tag "TODO state is" :inline t
(const 'todo)
(const todo)
(choice
(const :tag "Any not-done state" 'todo)
(const :tag "Any done state" 'done)
(const :tag "Any state" 'any)
(const :tag "Any not-done state" todo)
(const :tag "Any done state" done)
(const :tag "Any state" any)
(list :tag "Keyword list"
(const :format "" quote)
(repeat (string :tag "Keyword")))))
(list :tag "TODO state is not" :inline t
(const 'nottodo)
(const nottodo)
(choice
(const :tag "Any not-done state" 'todo)
(const :tag "Any done state" 'done)
(const :tag "Any state" 'any)
(const :tag "Any not-done state" todo)
(const :tag "Any done state" done)
(const :tag "Any state" any)
(list :tag "Keyword list"
(const :format "" quote)
(repeat (string :tag "Keyword")))))
(const :tag "scheduled" 'scheduled)
(const :tag "not scheduled" 'notscheduled)
(const :tag "deadline" 'deadline)
(const :tag "no deadline" 'notdeadline)
(const :tag "timestamp" 'timestamp)
(const :tag "no timestamp" 'nottimestamp))))))
(const :tag "scheduled" scheduled)
(const :tag "not scheduled" notscheduled)
(const :tag "deadline" deadline)
(const :tag "no deadline" notdeadline)
(const :tag "timestamp" timestamp)
(const :tag "no timestamp" nottimestamp))))))
(list :tag "Non-standard skipping condition"
:value (org-agenda-skip-function)
(const org-agenda-skip-function)

View File

@ -429,7 +429,7 @@ Archiving time is retained in the ARCHIVE_TIME node property."
(looking-at org-outline-regexp)
(setq leader (match-string 0)
level (funcall outline-level))
(setq pos (point))
(setq pos (point-marker))
(condition-case nil
(outline-up-heading 1 t)
(error (setq e (point-max)) (goto-char (point-min))))

View File

@ -1456,8 +1456,7 @@ The time is always returned as UTC."
(day (nth 3 dt)))
(if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
(setf (nth 2 dt) org-extend-today-until)
(setq dt (append (list 0 0) (nthcdr 2 dt) '(t)))
(apply #'encode-time dt)))
(apply #'encode-time (append (list 0 0) (nthcdr 2 dt)))))
((or (equal cmt "all")
(and (or (not cmt) (equal cmt "auto"))
(not lr)))

View File

@ -32,12 +32,12 @@
(require 'cl-lib)
(require 'org-macs)
(declare-function org-at-table.el-p "org" (&optional table-type))
(declare-function org-at-table.el-p "org" ())
(declare-function org-element-at-point "org-element" ())
(declare-function org-element-type "org-element" (element))
(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
(declare-function org-link-set-parameters "org" (type &rest rest))
(declare-function org-table-end (&optional table-type))
(declare-function org-table-end "org-table" (&optional table-type))
(declare-function outline-next-heading "outline" ())
(declare-function table--at-cell-p "table" (position &optional object at-column))

View File

@ -51,7 +51,7 @@
(require 'cl-lib)
(require 'org-macs)
(declare-function org-trim "org-trim" (s &optional keep-lead))
(declare-function org-trim "org" (s &optional keep-lead))
;;; Public variables
@ -99,8 +99,8 @@ sure to call the following command:
:set (lambda (var val) (set-default var val) (org-duration-set-regexps))
:initialize 'custom-initialize-changed
:type '(choice
(const :tag "H:MM" 'h:mm)
(const :tag "H:MM:SS" 'h:mm:ss)
(const :tag "H:MM" h:mm)
(const :tag "H:MM:SS" h:mm:ss)
(alist :key-type (string :tag "Unit")
:value-type (number :tag "Modifier"))))

View File

@ -45,7 +45,7 @@
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-type "org-element" (element))
(declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
(declare-function org-fill-paragraph "org" (&optional justify))
(declare-function org-fill-paragraph "org" (&optional justify region))
(declare-function org-in-block-p "org" (names))
(declare-function org-in-regexp "org" (re &optional nlines visually))
(declare-function org-in-verbatim-emphasis "org" ())

View File

@ -41,11 +41,6 @@
;;;; Customization variables
(defgroup org-complete nil
"Outline-based notes management and organizer."
:tag "Org"
:group 'org)
(defvar org-drawer-regexp)
(defvar org-property-re)
(defvar org-current-tag-alist)

View File

@ -496,6 +496,12 @@ variable is initialized with `org-table-analyze'.")
(concat "\\(" "@[-0-9I$]+" "\\|" "[a-zA-Z]\\{1,2\\}\\([0-9]+\\|&\\)" "\\)")
"Match a reference that needs translation, for reference display.")
(defconst org-table-separator-space
(propertize " " 'display '(space :width 1))
"Space used around fields when aligning the table.
This space serves as a segment separator for the purposes of the
bidirectional reordering.")
(defmacro org-table-save-field (&rest body)
"Save current field; execute BODY; restore field.
Field is restored even in case of abnormal exit."
@ -882,7 +888,10 @@ edit. Full value is:\n"
;; Compute the formats needed for output of the table.
(let ((hfmt (concat indent "|"))
(rfmt (concat indent "|"))
(rfmt1 " %%%s%ds |")
(rfmt1 (concat org-table-separator-space
"%%%s%ds"
org-table-separator-space
"|"))
(hfmt1 "-%s-+"))
(dolist (l lengths (setq hfmt (concat (substring hfmt 0 -1) "|")))
(let ((ty (if (pop typenums) "" "-"))) ; Flush numbers right.

View File

@ -1710,7 +1710,7 @@ doesn't specify any upper case character."
:type '(choice
(const :tag "Case-sensitive" nil)
(const :tag "Case-insensitive" t)
(const :tag "Case-insensitive for lower case searches only" 'smart)))
(const :tag "Case-insensitive for lower case searches only" smart)))
(defcustom org-occur-hook '(org-first-headline-recenter)
"Hook that is run after `org-occur' has constructed a sparse tree.
@ -4167,7 +4167,10 @@ A string will be inserted as-is in the header of the document."
(list :tag "options/package pair"
(string :tag "options")
(string :tag "package")
(boolean :tag "Snippet"))
(boolean :tag "Snippet")
(choice
(const :tag "For all compilers" nil)
(repeat :tag "Allowed compiler" string)))
(string :tag "A line of LaTeX"))))
(defcustom org-latex-packages-alist nil
@ -7181,11 +7184,12 @@ are at least `org-cycle-separator-lines' empty lines before the headline."
"Return `org-agenda-files' list, plus all open Org files.
This is useful for operations that need to scan all of a user's
open and agenda-wise Org files."
(let ((files (mapcar 'expand-file-name (org-agenda-files))))
(let ((files (mapcar #'expand-file-name (org-agenda-files))))
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (and (derived-mode-p 'org-mode) (buffer-file-name))
(cl-pushnew (expand-file-name (buffer-file-name)) files))))
(cl-pushnew (expand-file-name (buffer-file-name)) files
:test #'equal))))
files))
(defsubst org-entry-beginning-position ()
@ -9949,20 +9953,24 @@ according to FMT (default from `org-email-link-description-format')."
(reverse slines))) "\n")))))
(mapconcat #'identity (split-string s) " ")))
(defconst org-link-escape-chars
;;%20 %5B %5D %25
'(?\s ?\[ ?\] ?%)
"List of characters that should be escaped in a link when stored to Org.
This is the list that is used for internal purposes.")
(defun org-make-link-string (link &optional description)
"Make a link with brackets, consisting of LINK and DESCRIPTION."
(unless (org-string-nw-p link) (error "Empty link"))
(let ((uri (cond ((string-match org-link-types-re link)
(concat (match-string 1 link)
(org-link-escape (substring link (match-end 1)))))
;; For readability, url-encode internal links only
;; when absolutely needed (i.e, when they contain
;; square brackets). File links however, are
;; encoded since, e.g., spaces are significant.
((or (file-name-absolute-p link)
(string-match-p "\\`\\.\\.?/\\|[][]" link))
(string-match-p "\\`\\.\\.?/" link))
(org-link-escape link))
(t link)))
;; For readability, do not encode space characters
;; in fuzzy links.
(t (org-link-escape link (remq ?\s org-link-escape-chars)))))
(description
(and (org-string-nw-p description)
;; Remove brackets from description, as they are fatal.
@ -9973,12 +9981,6 @@ according to FMT (default from `org-email-link-description-format')."
uri
(if description (format "[%s]" description) ""))))
(defconst org-link-escape-chars
;;%20 %5B %5D %25
'(?\s ?\[ ?\] ?%)
"List of characters that should be escaped in a link when stored to Org.
This is the list that is used for internal purposes.")
(defun org-link-escape (text &optional table merge)
"Return percent escaped representation of TEXT.
TEXT is a string with the text to escape.
@ -12185,7 +12187,7 @@ There are two templates for each key, the first uses the original Org syntax,
the second uses Emacs Muse-like syntax tags. These Muse-like tags become
the default when the /org-mtags.el/ module has been loaded. See also the
variable `org-mtags-prefer-muse-templates'."
:group 'org-completion
:group 'org-edit-structure
:type '(repeat
(list
(string :tag "Key")

View File

@ -2180,19 +2180,16 @@ contextual information."
(nth (1- level) '("i" "ii" "iii" "iv"))
(1- count)))))
(checkbox (cl-case (org-element-property :checkbox item)
(on "$\\boxtimes$ ")
(off "$\\square$ ")
(trans "$\\boxminus$ ")))
(on "$\\boxtimes$")
(off "$\\square$")
(trans "$\\boxminus$")))
(tag (let ((tag (org-element-property :tag item)))
;; Check-boxes must belong to the tag.
(and tag (format "[{%s}] "
(concat checkbox
(org-export-data tag info)))))))
(and tag (org-export-data tag info)))))
(concat counter
"\\item"
(cond
(tag)
(checkbox (concat " " checkbox))
((and checkbox tag) (format "[{%s %s}] " checkbox tag))
((or checkbox tag) (format "[{%s}] " (or checkbox tag)))
;; Without a tag or a check-box, if CONTENTS starts with
;; an opening square bracket, add "\relax" to "\item",
;; unless the brackets comes from an initial export

View File

@ -500,14 +500,15 @@ TEXT is the string to transcode. INFO is a plist holding
contextual information."
(when (plist-get info :with-smart-quotes)
(setq text (org-export-activate-smart-quotes text :html info)))
;; The below series of replacements in `text' is order sensitive.
;; Protect `, *, _, and \
(setq text (replace-regexp-in-string "[`*_\\]" "\\\\\\&" text))
;; Protect ambiguous #. This will protect # at the beginning of
;; a line, but not at the beginning of a paragraph. See
;; `org-md-paragraph'.
(setq text (replace-regexp-in-string "\n#" "\n\\\\#" text))
;; Protect ambiguous !
(setq text (replace-regexp-in-string "\\(!\\)\\[" "\\\\!" text nil nil 1))
;; Protect `, *, _ and \
(setq text (replace-regexp-in-string "[`*_\\]" "\\\\\\&" text))
;; Handle special strings, if required.
(when (plist-get info :with-special-strings)
(setq text (org-html-convert-special-strings text)))

View File

@ -721,16 +721,17 @@ nil Ignore math snippets.
imagemagick to convert pdf files to png files.
`mathjax' Do MathJax preprocessing and arrange for MathJax.js to
be loaded.
t Synonym for `mathjax'."
Any other symbol is a synonym for `mathjax'."
:group 'org-export-odt
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice
(const :tag "Do not process math in any way" nil)
(const :tag "Leave math verbatim" verbatim)
(const :tag "Use dvipng to make images" dvipng)
(const :tag "Use imagemagick to make images" imagemagick)
(const :tag "Use MathJax to display math" mathjax)
(const :tag "Leave math verbatim" verbatim)))
(other :tag "Use MathJax to display math" mathjax)))
;;;; Links

View File

@ -57,10 +57,10 @@ Every function in this hook will be called with two arguments:
the name of the original file and the name of the file
produced.")
(defgroup org-publish nil
(defgroup org-export-publish nil
"Options for publishing a set of files."
:tag "Org Publishing"
:group 'org)
:group 'org-export)
(defcustom org-publish-project-alist nil
"Association list to control publishing behavior.

View File

@ -3699,7 +3699,9 @@ the communication channel used for export, as a plist."
:translate-alist all-transcoders
:exported-data (make-hash-table :test #'eq :size 401)))))
;; `:internal-references' are shared across back-ends.
(prog1 (funcall transcoder data contents new-info)
(prog1 (if (eq type 'plain-text)
(funcall transcoder data new-info)
(funcall transcoder data contents new-info))
(plist-put info :internal-references
(plist-get new-info :internal-references)))))))

View File

@ -168,6 +168,31 @@ for export
(should
(eq (org-babel-execute-src-block nil (org-babel-lob-get-info)) 1)))))
(ert-deftest test-ob-lob/assignment-with-newline ()
"Test call lines with an argument containing a newline character."
(should
(equal " foo"
(org-test-with-temp-text "
#+name: test-newline
#+begin_src emacs-lisp :var x=\"a\"
'foo
#+end_src
call_test-newline[:eval yes :results raw](\"a\nb\")<point>"
(org-babel-execute-src-block nil (org-babel-lob-get-info))
(buffer-substring (point) (point-max)))))
(should
(equal " bar"
(org-test-with-temp-text "
#+name: test-newline
#+begin_src emacs-lisp :var x=\"a\"
'bar
#+end_src
call_test-newline[:eval yes :results raw]('(1\n2))<point>"
(org-babel-execute-src-block nil (org-babel-lob-get-info))
(buffer-substring (point) (point-max))))))
(provide 'test-ob-lob)
;;; test-ob-lob.el ends here

View File

@ -101,6 +101,23 @@ return x
(should (equal '(("col") ("a") ("b"))
(org-babel-execute-src-block)))))
(ert-deftest test-ob-python/session-multiline ()
;; FIXME workaround to prevent starting prompt leaking into output
(run-python)
(sleep-for 0 10)
(org-test-with-temp-text "
#+begin_src python :session :results output
foo = 0
for _ in range(10):
foo += 1
foo += 1
print(foo)
#+end_src"
(org-babel-next-src-block)
(should (equal "20" (org-babel-execute-src-block)))))
(provide 'test-ob-python)
;;; test-ob-python.el ends here

View File

@ -668,8 +668,12 @@ x
(check-eval "never-export" nil)
(check-eval "no-export" nil))))
(ert-deftest test-ob/noweb-expansion-1 ()
(org-test-with-temp-text "#+begin_src sh :results output :tangle yes
(ert-deftest test-ob/noweb-expansion ()
;; Standard test.
(should
(string=
"bar"
(org-test-with-temp-text "#+begin_src sh :results output :tangle yes
<<foo>>
#+end_src
@ -677,10 +681,12 @@ x
#+begin_src sh
bar
#+end_src"
(should (string= (org-babel-expand-noweb-references) "bar"))))
(ert-deftest test-ob/noweb-expansion-2 ()
(org-test-with-temp-text "#+begin_src sh :results output :tangle yes
(org-babel-expand-noweb-references))))
;; Handle :noweb-sep.
(should
(string=
"barbaz"
(org-test-with-temp-text "#+begin_src sh :results output :tangle yes
<<foo>>
#+end_src
@ -692,7 +698,67 @@ x
#+begin_src sh :noweb-ref foo :noweb-sep \"\"
baz
#+end_src"
(should (string= (org-babel-expand-noweb-references) "barbaz"))))
(org-babel-expand-noweb-references))))
;; :noweb-ref is extracted from definition, not point of call.
(should
(string=
"(+ 1 1)"
(org-test-with-temp-text
"
* Call
:PROPERTIES:
:header-args: :noweb-ref bar
:END:
<point>#+begin_src emacs-lisp :results output :tangle yes
<<foo>>
#+end_src
* Evaluation
:PROPERTIES:
:header-args: :noweb-ref foo
:END:
#+begin_src sh :noweb-sep \"\"
(+ 1 1)
#+end_src"
(org-babel-expand-noweb-references))))
;; Handle recursive expansion.
(should
(equal "baz"
(org-test-with-temp-text "
#+begin_src emacs-lisp :noweb yes<point>
<<foo>>
#+end_src
#+name: foo
#+begin_src emacs-lisp :noweb yes
<<bar>>
#+end_src
#+name: bar
#+begin_src emacs-lisp
baz
#+end_src"
(org-babel-expand-noweb-references))))
;; During recursive expansion, obey to `:noweb' property.
(should
(equal "<<bar>>"
(org-test-with-temp-text "
#+begin_src emacs-lisp :noweb yes<point>
<<foo>>
#+end_src
#+name: foo
#+begin_src emacs-lisp :noweb no
<<bar>>
#+end_src
#+name: bar
#+begin_src emacs-lisp
baz
#+end_src"
(org-babel-expand-noweb-references)))))
(ert-deftest test-ob/splitting-variable-lists-in-references ()
(org-test-with-temp-text ""

View File

@ -640,7 +640,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|--------------+---------|
| *Total time* | *26:00* |
|--------------+---------|
| [[Foo%20%5B%5Bhttp://orgmode.org%5D%5BOrg%20mode%5D%5D][Foo Org mode]] | 26:00 |"
| [[Foo %5B%5Bhttp://orgmode.org%5D%5BOrg mode%5D%5D][Foo Org mode]] | 26:00 |"
(org-test-with-temp-text
"* Foo [[http://orgmode.org][Org mode]]
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
@ -651,7 +651,7 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"
|------------------------+---------|
| *Total time* | *26:00* |
|------------------------+---------|
| [[Foo%20%5B%5Bhttp://orgmode.org%5D%5D][Foo http://orgmode.org]] | 26:00 |"
| [[Foo %5B%5Bhttp://orgmode.org%5D%5D][Foo http://orgmode.org]] | 26:00 |"
(org-test-with-temp-text
"* Foo [[http://orgmode.org]]
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00"

View File

@ -1771,12 +1771,19 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline footnote]
(equal "Success"
(let (org-export-registered-backends)
(org-export-define-backend 'test
'((plain-text . (lambda (text contents info) "Failure"))))
'((verbatim . (lambda (text contents info) "Failure"))))
(org-export-define-backend 'test2
'((plain-text . (lambda (text contents info) "Success"))))
(org-export-with-backend 'test2 "Test"))))
'((verbatim . (lambda (text contents info) "Success"))))
(org-export-with-backend 'test2 '(verbatim (:value "=Test="))))))
;; Corner case: plain-text transcoders have a different arity.
(should
(equal "Success"
(org-export-with-backend
(org-export-create-backend
:transcoders '((plain-text . (lambda (text info) "Success"))))
"Test")))
;; Provide correct back-end if transcoder needs to use recursive
;; calls anyway.
;; calls.
(should
(equal "Success\n"
(let ((test-back-end