mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-23 07:18:53 +00:00
Merge branch 'origin-maint'
This commit is contained in:
commit
2395c3eff1
19
doc/org.texi
19
doc/org.texi
@ -708,6 +708,7 @@ Specific header arguments
|
|||||||
* session:: Preserve the state of code evaluation
|
* session:: Preserve the state of code evaluation
|
||||||
* noweb:: Toggle expansion of noweb references
|
* noweb:: Toggle expansion of noweb references
|
||||||
* noweb-ref:: Specify block's noweb reference resolution target
|
* noweb-ref:: Specify block's noweb reference resolution target
|
||||||
|
* noweb-sep:: String used to separate noweb references
|
||||||
* cache:: Avoid re-evaluating unchanged code blocks
|
* cache:: Avoid re-evaluating unchanged code blocks
|
||||||
* sep:: Delimiter for writing tabular results outside Org
|
* sep:: Delimiter for writing tabular results outside Org
|
||||||
* hlines:: Handle horizontal lines in tables
|
* hlines:: Handle horizontal lines in tables
|
||||||
@ -13017,6 +13018,7 @@ argument in lowercase letters. The following header arguments are defined:
|
|||||||
* session:: Preserve the state of code evaluation
|
* session:: Preserve the state of code evaluation
|
||||||
* noweb:: Toggle expansion of noweb references
|
* noweb:: Toggle expansion of noweb references
|
||||||
* noweb-ref:: Specify block's noweb reference resolution target
|
* noweb-ref:: Specify block's noweb reference resolution target
|
||||||
|
* noweb-sep:: String used to separate noweb references
|
||||||
* cache:: Avoid re-evaluating unchanged code blocks
|
* cache:: Avoid re-evaluating unchanged code blocks
|
||||||
* sep:: Delimiter for writing tabular results outside Org
|
* sep:: Delimiter for writing tabular results outside Org
|
||||||
* hlines:: Handle horizontal lines in tables
|
* hlines:: Handle horizontal lines in tables
|
||||||
@ -13640,7 +13642,7 @@ Note that noweb replacement text that does not contain any newlines will not
|
|||||||
be affected by this change, so it is still possible to use inline noweb
|
be affected by this change, so it is still possible to use inline noweb
|
||||||
references.
|
references.
|
||||||
|
|
||||||
@node noweb-ref, cache, noweb, Specific header arguments
|
@node noweb-ref, noweb-sep, noweb, Specific header arguments
|
||||||
@subsubsection @code{:noweb-ref}
|
@subsubsection @code{:noweb-ref}
|
||||||
When expanding ``noweb'' style references the bodies of all code block with
|
When expanding ``noweb'' style references the bodies of all code block with
|
||||||
@emph{either} a block name matching the reference name @emph{or} a
|
@emph{either} a block name matching the reference name @emph{or} a
|
||||||
@ -13684,11 +13686,18 @@ inheritance}).}.
|
|||||||
#+END_SRC
|
#+END_SRC
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
The @code{org-babel-noweb-separator} variable holds the string used to
|
The @code{:noweb-sep} (see @ref{noweb-sep}) header argument holds the string
|
||||||
separate accumulate noweb references like those above. By default this
|
used to separate accumulate noweb references like those above. By default a
|
||||||
variable holds a newline.
|
newline is used.
|
||||||
|
|
||||||
@node cache, sep, noweb-ref, Specific header arguments
|
@node noweb-sep, cache, noweb-ref, Specific header arguments
|
||||||
|
@subsubsection @code{:noweb-sep}
|
||||||
|
|
||||||
|
The @code{:noweb-sep} header argument holds the string used to separate
|
||||||
|
accumulate noweb references (see @ref{noweb-ref}). By default a newline is
|
||||||
|
used.
|
||||||
|
|
||||||
|
@node cache, sep, noweb-sep, Specific header arguments
|
||||||
@subsubsection @code{:cache}
|
@subsubsection @code{:cache}
|
||||||
|
|
||||||
The @code{:cache} header argument controls the use of in-buffer caching of
|
The @code{:cache} header argument controls the use of in-buffer caching of
|
||||||
|
18
lisp/ob.el
18
lisp/ob.el
@ -120,11 +120,6 @@ be used."
|
|||||||
:group 'org-babel
|
:group 'org-babel
|
||||||
:type 'string)
|
:type 'string)
|
||||||
|
|
||||||
(defcustom org-babel-noweb-separator "\n"
|
|
||||||
"String used to separate accumulated noweb references."
|
|
||||||
:group 'org-babel
|
|
||||||
:type 'string)
|
|
||||||
|
|
||||||
(defvar org-babel-src-name-regexp
|
(defvar org-babel-src-name-regexp
|
||||||
"^[ \t]*#\\+name:[ \t]*"
|
"^[ \t]*#\\+name:[ \t]*"
|
||||||
"Regular expression used to match a source name line.")
|
"Regular expression used to match a source name line.")
|
||||||
@ -388,6 +383,7 @@ then run `org-babel-pop-to-session'."
|
|||||||
(noeval)
|
(noeval)
|
||||||
(noweb . ((yes no tangle)))
|
(noweb . ((yes no tangle)))
|
||||||
(noweb-ref . :any)
|
(noweb-ref . :any)
|
||||||
|
(noweb-sep . :any)
|
||||||
(padline . ((yes no)))
|
(padline . ((yes no)))
|
||||||
(results . ((file list vector table scalar verbatim)
|
(results . ((file list vector table scalar verbatim)
|
||||||
(raw org html latex code pp wrap)
|
(raw org html latex code pp wrap)
|
||||||
@ -2204,6 +2200,8 @@ block but are passed literally to the \"example-block\"."
|
|||||||
(while (re-search-forward rx nil t)
|
(while (re-search-forward rx nil t)
|
||||||
(let* ((i (org-babel-get-src-block-info 'light))
|
(let* ((i (org-babel-get-src-block-info 'light))
|
||||||
(body (org-babel-expand-noweb-references i))
|
(body (org-babel-expand-noweb-references i))
|
||||||
|
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||||
|
"\n"))
|
||||||
(full (if comment
|
(full (if comment
|
||||||
((lambda (cs)
|
((lambda (cs)
|
||||||
(concat (c-wrap (car cs)) "\n"
|
(concat (c-wrap (car cs)) "\n"
|
||||||
@ -2211,13 +2209,15 @@ block but are passed literally to the \"example-block\"."
|
|||||||
(c-wrap (cadr cs))))
|
(c-wrap (cadr cs))))
|
||||||
(org-babel-tangle-comment-links i))
|
(org-babel-tangle-comment-links i))
|
||||||
body)))
|
body)))
|
||||||
(setq expansion (cons full expansion))))
|
(setq expansion (cons sep (cons full expansion)))))
|
||||||
(org-babel-map-src-blocks nil
|
(org-babel-map-src-blocks nil
|
||||||
(let ((i (org-babel-get-src-block-info 'light)))
|
(let ((i (org-babel-get-src-block-info 'light)))
|
||||||
(when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
|
(when (equal (or (cdr (assoc :noweb-ref (nth 2 i)))
|
||||||
(nth 4 i))
|
(nth 4 i))
|
||||||
source-name)
|
source-name)
|
||||||
(let* ((body (org-babel-expand-noweb-references i))
|
(let* ((body (org-babel-expand-noweb-references i))
|
||||||
|
(sep (or (cdr (assoc :noweb-sep (nth 2 i)))
|
||||||
|
"\n"))
|
||||||
(full (if comment
|
(full (if comment
|
||||||
((lambda (cs)
|
((lambda (cs)
|
||||||
(concat (c-wrap (car cs)) "\n"
|
(concat (c-wrap (car cs)) "\n"
|
||||||
@ -2225,9 +2225,9 @@ block but are passed literally to the \"example-block\"."
|
|||||||
(c-wrap (cadr cs))))
|
(c-wrap (cadr cs))))
|
||||||
(org-babel-tangle-comment-links i))
|
(org-babel-tangle-comment-links i))
|
||||||
body)))
|
body)))
|
||||||
(setq expansion (cons full expansion))))))))
|
(setq expansion
|
||||||
(mapconcat #'identity (nreverse expansion)
|
(cons sep (cons full expansion)))))))))
|
||||||
org-babel-noweb-separator))
|
(mapconcat #'identity (nreverse (cdr expansion)) ""))
|
||||||
;; possibly raise an error if named block doesn't exist
|
;; possibly raise an error if named block doesn't exist
|
||||||
(if (member lang org-babel-noweb-error-langs)
|
(if (member lang org-babel-noweb-error-langs)
|
||||||
(error "%s" (concat
|
(error "%s" (concat
|
||||||
|
@ -217,6 +217,7 @@ src_sh{echo 3} Here is one at the beginning of a line.
|
|||||||
* using the =:noweb-ref= header argument
|
* using the =:noweb-ref= header argument
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8a0
|
:ID: 54d68d4b-1544-4745-85ab-4f03b3cbd8a0
|
||||||
|
:noweb-sep: ""
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
#+begin_src sh :tangle yes :noweb yes :shebang #!/bin/sh
|
#+begin_src sh :tangle yes :noweb yes :shebang #!/bin/sh
|
||||||
|
@ -644,11 +644,11 @@ on two lines
|
|||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+name: foo
|
#+name: foo
|
||||||
#+begin_src sh
|
#+begin_src sh :noweb-sep \"\"
|
||||||
bar
|
bar
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src sh :noweb-ref foo
|
#+begin_src sh :noweb-ref foo :noweb-sep \"\"
|
||||||
baz
|
baz
|
||||||
#+end_src"
|
#+end_src"
|
||||||
(should (string= (org-babel-expand-noweb-references) "barbaz"))))
|
(should (string= (org-babel-expand-noweb-references) "barbaz"))))
|
||||||
|
Loading…
Reference in New Issue
Block a user