forked from mirrors/org-mode
"src block" -> "source block" in documentation and comments
* etc/ORG-NEWS (Maxima: new headers ~:prologue~ and ~:epilogue~): (Texinfo exports inline source blocks as ~@code{}~): (Default lexical evaluation of emacs-lisp source blocks): * lisp/ob-clojure.el (org-babel-clojure-default-ns): * lisp/ob-core.el (org-babel-named-src-block-regexp-for-name): (org-babel-current-src-block-location): (org-babel-mark-block): (org-babel-insert-result): * lisp/ob-emacs-lisp.el (org-babel-default-header-args:emacs-lisp): * lisp/ob-exp.el (org-babel-exp-process-buffer): * lisp/ob-lob.el (org-babel-lob-ingest): * lisp/ob-ref.el: * lisp/org-element.el (org-element-object-restrictions): (org-element-src-block-parser): (org-element-inline-src-block-parser): * lisp/org-lint.el: (org-lint--checkers): * lisp/org-pcomplete.el (pcomplete/org-mode/block-option/src): * lisp/org-src.el (org-edit-inline-src-code): * lisp/org.el (org-ctrl-c-ctrl-c): (org-in-src-block-p): (org-fill-element): * lisp/ox-html.el (org-html--textarea-block): (org-html-format-code): * lisp/ox-latex.el (org-latex-minted-options): (org-latex-custom-lang-environments): * lisp/ox-md.el: * lisp/ox-odt.el (org-odt-format-code): * lisp/ox.el (org-export-collect-listings): * testing/lisp/test-ob-exp.el (ob-exp/src-block-with-affiliated-keyword): * testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Correct "src block" occurrences when they do not specifically refer to the element type `src-block'.
This commit is contained in:
parent
4c8b227144
commit
17edaf8c14
|
@ -609,7 +609,7 @@ value of the code will be displayed in the results section.
|
|||
|
||||
**** Maxima: new headers ~:prologue~ and ~:epilogue~
|
||||
Babel options ~:prologue~ and ~:epilogue~ have been implemented for
|
||||
Maxima src blocks which prepend and append, respectively, the given
|
||||
Maxima source blocks which prepend and append, respectively, the given
|
||||
code strings. This can be useful for specifying formatting settings
|
||||
which would add clutter to exported code. For instance, you can use
|
||||
this ~:prologue "fpprintprec: 2; linel: 50;"~ for presenting Maxima
|
||||
|
@ -891,7 +891,7 @@ is now obsolete.
|
|||
Now ~=...=~ markup uses ~@samp{}~ instead of ~@verb{}~. You can use
|
||||
~@verb{}~ again by customizing the variable.
|
||||
*** Texinfo exports example blocks as ~@example~
|
||||
*** Texinfo exports inline src blocks as ~@code{}~
|
||||
*** Texinfo exports inline source blocks as ~@code{}~
|
||||
*** Texinfo default table markup is ~@asis~
|
||||
It used to be ~@samp~ but ~@asis~ is neutral and, therefore, more
|
||||
suitable as a default value.
|
||||
|
@ -1708,9 +1708,9 @@ docstring for more information.
|
|||
|
||||
** New features
|
||||
|
||||
*** Default lexical evaluation of emacs-lisp src blocks
|
||||
*** Default lexical evaluation of emacs-lisp source blocks
|
||||
|
||||
Emacs-lisp src blocks in babel are now evaluated using lexical
|
||||
Emacs-lisp source blocks in Babel are now evaluated using lexical
|
||||
scoping. There is a new header to control this behavior.
|
||||
|
||||
The default results in an eval with lexical scoping.
|
||||
|
|
|
@ -80,7 +80,7 @@ If the value is nil, timeout is disabled."
|
|||
(const :tag "SLIME" slime)))
|
||||
|
||||
(defcustom org-babel-clojure-default-ns "user"
|
||||
"Default Clojure namespace for src block when all find ns ways failed."
|
||||
"Default Clojure namespace for source block when finding ns failed."
|
||||
:type 'string
|
||||
:group 'org-babel)
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ to raise errors for all languages.")
|
|||
"Hook for functions to be called after `org-babel-execute-src-block'")
|
||||
|
||||
(defun org-babel-named-src-block-regexp-for-name (&optional name)
|
||||
"This generates a regexp used to match a src block named NAME.
|
||||
"This generates a regexp used to match a source block named NAME.
|
||||
If NAME is nil, match any name. Matched name is then put in
|
||||
match group 9. Other match groups are defined in
|
||||
`org-babel-src-block-regexp'."
|
||||
|
@ -555,7 +555,7 @@ Remove final newline character and spurious indentation."
|
|||
|
||||
;;; functions
|
||||
(defvar org-babel-current-src-block-location nil
|
||||
"Marker pointing to the src block currently being executed.
|
||||
"Marker pointing to the source block currently being executed.
|
||||
This may also point to a call line or an inline code block. If
|
||||
multiple blocks are being executed (e.g., in chained execution
|
||||
through use of the :var header argument) this marker points to
|
||||
|
@ -1855,7 +1855,7 @@ With optional prefix argument ARG, jump backward ARG many source blocks."
|
|||
|
||||
;;;###autoload
|
||||
(defun org-babel-mark-block ()
|
||||
"Mark current src block."
|
||||
"Mark current source block."
|
||||
(interactive)
|
||||
(let ((head (org-babel-where-is-src-block-head)))
|
||||
(when head
|
||||
|
@ -2216,10 +2216,10 @@ code ---- the results are extracted in the syntax of the source
|
|||
optional LANG argument.
|
||||
|
||||
list ---- the results are rendered as a list. This option not
|
||||
allowed for inline src blocks.
|
||||
allowed for inline source blocks.
|
||||
|
||||
table --- the results are rendered as a table. This option not
|
||||
allowed for inline src blocks.
|
||||
allowed for inline source blocks.
|
||||
|
||||
INFO may provide the values of these header arguments (in the
|
||||
`header-arguments-alist' see the docstring for
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
(defvar org-babel-default-header-args:emacs-lisp '((:lexical . "no"))
|
||||
"Default arguments for evaluating an emacs-lisp source block.
|
||||
|
||||
A value of \"yes\" or t causes src blocks to be eval'd using
|
||||
A value of \"yes\" or t causes source blocks to be eval'd using
|
||||
lexical scoping. It can also be an alist mapping symbols to
|
||||
their value. It is used as the optional LEXICAL argument to
|
||||
`eval', which see.")
|
||||
|
|
|
@ -209,9 +209,9 @@ this template."
|
|||
(progn (goto-char end)
|
||||
(skip-chars-forward " \t")
|
||||
(point)))
|
||||
;; Otherwise: remove inline src block but
|
||||
;; preserve following white spaces. Then
|
||||
;; insert value.
|
||||
;; Otherwise: remove inline source block
|
||||
;; but preserve following white spaces.
|
||||
;; Then insert value.
|
||||
(delete-region begin end)
|
||||
(insert replacement)))))
|
||||
((or `babel-call `inline-babel-call)
|
||||
|
|
|
@ -62,7 +62,7 @@ should not be inherited from a source block.")
|
|||
(cons (cons source info)
|
||||
(assq-delete-all source org-babel-library-of-babel))))
|
||||
(cl-incf lob-ingest-count))))
|
||||
(message "%d src block%s added to Library of Babel"
|
||||
(message "%d source block%s added to Library of Babel"
|
||||
lob-ingest-count (if (> lob-ingest-count 1) "s" ""))
|
||||
lob-ingest-count))
|
||||
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
|
||||
;; - resource-id :: the id or name of the resource
|
||||
|
||||
;; So an example of a simple src block referencing table data in the
|
||||
;; same file would be
|
||||
;; So an example of a simple source block referencing table data in
|
||||
;; the same file would be
|
||||
|
||||
;; #+NAME: sandbox
|
||||
;; | 1 | 2 | 3 |
|
||||
|
|
|
@ -307,8 +307,9 @@ Don't modify it, set `org-element-affiliated-keywords' instead.")
|
|||
(strike-through ,@standard-set)
|
||||
(subscript ,@standard-set)
|
||||
(superscript ,@standard-set)
|
||||
;; Ignore inline babel call and inline src block as formulas are
|
||||
;; possible. Also ignore line breaks and statistics cookies.
|
||||
;; Ignore inline babel call and inline source block as formulas
|
||||
;; are possible. Also ignore line breaks and statistics
|
||||
;; cookies.
|
||||
(table-cell bold code entity export-snippet footnote-reference italic
|
||||
latex-fragment link macro radio-target strike-through
|
||||
subscript superscript target timestamp underline verbatim)
|
||||
|
@ -2399,7 +2400,7 @@ containing `:closed', `:deadline', `:scheduled', `:begin',
|
|||
;;;; Src Block
|
||||
|
||||
(defun org-element-src-block-parser (limit affiliated)
|
||||
"Parse a src block.
|
||||
"Parse a source block.
|
||||
|
||||
LIMIT bounds the search. AFFILIATED is a list of which CAR is
|
||||
the buffer position at the beginning of the first affiliated
|
||||
|
@ -2455,7 +2456,7 @@ Assume point is at the beginning of the block."
|
|||
(string-match "-l +\"\\([^\"\n]+\\)\"" switches)
|
||||
(match-string 1 switches)))
|
||||
;; Should labels be retained in (or stripped from)
|
||||
;; src blocks?
|
||||
;; source blocks?
|
||||
(retain-labels
|
||||
(or (not switches)
|
||||
(not (string-match "-r\\>" switches))
|
||||
|
@ -2929,7 +2930,7 @@ When at an inline source block, return a list whose car is
|
|||
`:language', `:value', `:parameters' and `:post-blank' as
|
||||
keywords. Otherwise, return nil.
|
||||
|
||||
Assume point is at the beginning of the inline src block."
|
||||
Assume point is at the beginning of the inline source block."
|
||||
(save-excursion
|
||||
(catch :no-object
|
||||
(when (let ((case-fold-search nil))
|
||||
|
|
|
@ -69,13 +69,13 @@
|
|||
;; - duplicate footnote definitions
|
||||
;; - orphaned affiliated keywords
|
||||
;; - obsolete affiliated keywords
|
||||
;; - missing language in src blocks
|
||||
;; - missing language in source blocks
|
||||
;; - missing back-end in export blocks
|
||||
;; - invalid Babel call blocks
|
||||
;; - NAME values with a colon
|
||||
;; - deprecated export block syntax
|
||||
;; - deprecated Babel header properties
|
||||
;; - wrong header arguments in src blocks
|
||||
;; - wrong header arguments in source blocks
|
||||
;; - misuse of CATEGORY keyword
|
||||
;; - "coderef" links with unknown destination
|
||||
;; - "custom-id" links with unknown destination
|
||||
|
@ -162,7 +162,7 @@
|
|||
:trust 'low)
|
||||
(make-org-lint-checker
|
||||
:name 'missing-language-in-src-block
|
||||
:description "Report missing language in src blocks"
|
||||
:description "Report missing language in source blocks"
|
||||
:categories '(babel))
|
||||
(make-org-lint-checker
|
||||
:name 'missing-backend-in-export-block
|
||||
|
|
|
@ -346,8 +346,9 @@ This needs more work, to handle headings with lots of spaces in them."
|
|||
(substring pcomplete-stub 1)))
|
||||
|
||||
(defun pcomplete/org-mode/block-option/src ()
|
||||
"Complete the arguments of a begin_src block.
|
||||
Complete a language in the first field, the header arguments and switches."
|
||||
"Complete the arguments of a source block.
|
||||
Complete a language in the first field, the header arguments and
|
||||
switches."
|
||||
(pcomplete-here
|
||||
(mapcar
|
||||
(lambda(x) (symbol-name (nth 3 x)))
|
||||
|
|
|
@ -1037,7 +1037,7 @@ name of the sub-editing buffer."
|
|||
(org-src--construct-edit-buffer-name (buffer-name) lang)
|
||||
lang-f
|
||||
(lambda ()
|
||||
;; Inline src blocks are limited to one line.
|
||||
;; Inline source blocks are limited to one line.
|
||||
(while (re-search-forward "\n[ \t]*" nil t) (replace-match " "))
|
||||
;; Trim contents.
|
||||
(goto-char (point-min))
|
||||
|
|
|
@ -20241,7 +20241,7 @@ This command does many different things, depending on context:
|
|||
;; Act according to type of element or object at point.
|
||||
;;
|
||||
;; Do nothing on a blank line, except if it is contained in
|
||||
;; a src block. Hence, we first check if point is in such
|
||||
;; a source block. Hence, we first check if point is in such
|
||||
;; a block and then if it is at a blank line.
|
||||
(pcase type
|
||||
((or `inline-src-block `src-block)
|
||||
|
@ -21226,8 +21226,8 @@ If there is no description, use the link target."
|
|||
|
||||
(defun org-in-src-block-p (&optional inside)
|
||||
"Whether point is in a code source block.
|
||||
When INSIDE is non-nil, don't consider we are within a src block
|
||||
when point is at #+BEGIN_SRC or #+END_SRC."
|
||||
When INSIDE is non-nil, don't consider we are within a source
|
||||
block when point is at #+BEGIN_SRC or #+END_SRC."
|
||||
(let ((case-fold-search t))
|
||||
(or (and (eq (get-char-property (point) 'src-block) t))
|
||||
(and (not inside)
|
||||
|
@ -22030,7 +22030,7 @@ a footnote definition, try to fill the first paragraph within."
|
|||
;; First check if point is in a blank line at the beginning of
|
||||
;; the buffer. In that case, ignore filling.
|
||||
(cl-case (org-element-type element)
|
||||
;; Use major mode filling function is src blocks.
|
||||
;; Use major mode filling function is source blocks.
|
||||
(src-block (org-babel-do-key-sequence-in-edit-buffer (kbd "M-q")))
|
||||
;; Align Org tables, leave table.el tables as-is.
|
||||
(table-row (org-table-align) t)
|
||||
|
|
|
@ -1706,7 +1706,7 @@ object unless a different class is specified with an attribute."
|
|||
|
||||
(defun org-html--textarea-block (element)
|
||||
"Transcode ELEMENT into a textarea block.
|
||||
ELEMENT is either a src block or an example block."
|
||||
ELEMENT is either a source or an example block."
|
||||
(let* ((code (car (org-export-unravel-code element)))
|
||||
(attr (org-export-read-attribute :attr_html element)))
|
||||
(format "<p>\n<textarea cols=\"%s\" rows=\"%s\">\n%s</textarea>\n</p>"
|
||||
|
@ -2250,14 +2250,14 @@ line of code."
|
|||
|
||||
(defun org-html-format-code (element info)
|
||||
"Format contents of ELEMENT as source code.
|
||||
ELEMENT is either an example block or a src block. INFO is
|
||||
a plist used as a communication channel."
|
||||
ELEMENT is either an example or a source block. INFO is a plist
|
||||
used as a communication channel."
|
||||
(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?
|
||||
;; Does the source block contain labels?
|
||||
(retain-labels (org-element-property :retain-labels element))
|
||||
;; Does it have line numbers?
|
||||
(num-start (org-export-get-loc element info)))
|
||||
|
|
|
@ -1027,7 +1027,7 @@ value. For example,
|
|||
(setq org-latex-minted-options
|
||||
\\='((\"bgcolor\" \"bg\") (\"frame\" \"lines\")))
|
||||
|
||||
will result in src blocks being exported with
|
||||
will result in source blocks being exported with
|
||||
|
||||
\\begin{minted}[bgcolor=bg,frame=lines]{<LANG>}
|
||||
|
||||
|
@ -1048,12 +1048,13 @@ block-specific options, you may use the following syntax:
|
|||
(defcustom org-latex-custom-lang-environments nil
|
||||
"Alist mapping languages to language-specific LaTeX environments.
|
||||
|
||||
It is used during export of src blocks by the listings and minted
|
||||
latex packages. The environment may be a simple string, composed of
|
||||
only letters and numbers. In this case, the string is directly the
|
||||
name of the latex environment to use. The environment may also be
|
||||
a format string. In this case the format string will be directly
|
||||
exported. This format string may contain these elements:
|
||||
It is used during export of source blocks by the listings and
|
||||
minted latex packages. The environment may be a simple string,
|
||||
composed of only letters and numbers. In this case, the string
|
||||
is directly the name of the latex environment to use. The
|
||||
environment may also be a format string. In this case the format
|
||||
string will be directly exported. This format string may contain
|
||||
these elements:
|
||||
|
||||
%s for the formatted source
|
||||
%c for the caption
|
||||
|
@ -1075,7 +1076,7 @@ would have the effect that if Org encounters a Python source block
|
|||
during LaTeX export it will produce
|
||||
|
||||
\\begin{pythoncode}
|
||||
<src block body>
|
||||
<source block body>
|
||||
\\end{pythoncode}
|
||||
|
||||
and if Org encounters an Ocaml source block during LaTeX export it
|
||||
|
@ -1083,7 +1084,7 @@ will produce
|
|||
|
||||
\\begin{listing}
|
||||
\\begin{minted}[<attr_latex options>]{ocaml}
|
||||
<src block body>
|
||||
<source block body>
|
||||
\\end{minted}
|
||||
\\caption{<caption>}
|
||||
\\label{<label>}
|
||||
|
|
|
@ -175,7 +175,7 @@ channel."
|
|||
value)))
|
||||
|
||||
|
||||
;;;; Example Block, Src Block and export Block
|
||||
;;;; Example Block, Src Block and Export Block
|
||||
|
||||
(defun org-md-example-block (example-block _contents info)
|
||||
"Transcode EXAMPLE-BLOCK element into Markdown format.
|
||||
|
|
|
@ -3139,7 +3139,7 @@ and prefix with \"OrgSrc\". For example,
|
|||
(code-info (org-export-unravel-code element))
|
||||
(code (car code-info))
|
||||
(refs (cdr code-info))
|
||||
;; Does the src block contain labels?
|
||||
;; Does the source block contain labels?
|
||||
(retain-labels (org-element-property :retain-labels element))
|
||||
;; Does it have line numbers?
|
||||
(num-start (org-export-get-loc element info)))
|
||||
|
|
|
@ -5310,11 +5310,11 @@ Return a list of elements recognized as figures."
|
|||
(org-export-collect-elements 'paragraph info predicate))
|
||||
|
||||
(defun org-export-collect-listings (info)
|
||||
"Build a list of src blocks.
|
||||
"Build a list of source blocks.
|
||||
|
||||
INFO is a plist used as a communication channel.
|
||||
|
||||
Return a list of src-block elements with a caption."
|
||||
Return a list of `src-block' elements with a caption."
|
||||
(org-export-collect-elements 'src-block info))
|
||||
|
||||
(defun org-export-excluded-from-toc-p (headline info)
|
||||
|
|
|
@ -575,7 +575,7 @@ src_emacs-lisp{(+ 1 1)}"
|
|||
|
||||
(ert-deftest ob-exp/src-block-with-affiliated-keyword ()
|
||||
"Test exporting a code block with affiliated keywords."
|
||||
;; Pathological case: affiliated keyword matches inline src block
|
||||
;; Pathological case: affiliated keyword matches inline source block
|
||||
;; syntax.
|
||||
(should
|
||||
(equal "#+name: call_foo\n#+BEGIN_SRC emacs-lisp\n42\n#+END_SRC"
|
||||
|
|
|
@ -1434,7 +1434,7 @@ echo \"$data\"
|
|||
(org-babel-execute-src-block))))))
|
||||
|
||||
(ert-deftest test-ob/preserve-results-indentation ()
|
||||
"Preserve indentation when executing a src block."
|
||||
"Preserve indentation when executing a source block."
|
||||
(should
|
||||
(equal
|
||||
'(2 2)
|
||||
|
|
Loading…
Reference in New Issue