The check for appropriate context in `org-babel-header-arg-expand' was
inadequate: a colon was deemed appropriate anywhere in the source
block, not just in the header.
* lisp/ob-core.el (org-babel-header-arg-expand): The function now uses
`org-babel-in-src-block-header-p' to check for appropriate context.
(org-babel-in-src-block-header-p): New function.
Reported-by: use @Addlai on Emacs SE.
Link: https://list.orgmode.org/orgmode/87zfnrb2nu.fsf@pierrot.dokosmarshall.org/
* lisp/ob-core.el (org-babel-get-src-block-info): Use `copy-tree'
when using `org-babel-default-header-args*' variables to prepare the
`info' variable used in src block evaluation. The `info' variable gets
modified, and the modifications were affecting the values of the user
variables. In particular, the `:file' setting was modified in the presence
of a `:output-dir' setting, concatenating more and more copies of the directory
every time the block was evaluated.
Reported-by: @lyndhurst on SE Emacs
Link: https://emacs.stackexchange.com/questions/82261/
* lisp/ob-core.el (org-babel-view-src-block-info): Query in-buffer
header arguments (`org-entry-get') from Org buffer. It does nothing
from *Help* buffer.
In the previous version, when the user interactively calls
`org-babel-view-src-block-info' and the point is on a code block, these
two warnings are shown in the buffer *Warnings*:
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *Help*> (help-mode)
⛔ Warning (org-element): ‘org-element-at-point’ cannot be used in non-Org buffer #<buffer *Help*> (help-mode)
This happened because `org-babel-view-src-block-info'
calls (org-entry-get (point) "header-args" t) while being in
the *Help* buffer. `org-babel-view-src-block-info' should call
org-entry-get while being in the Org Mode buffer and then switch to
the *Help* buffer once it has all the information that is then
displayed in the *Help* buffer.
In the introduced changes, we execute (org-entry-get (point)
"header-args" t) while being in the Org Mode buffer and we switch
to *Help* when we have the necessary information that is then shown in
the *Help* buffer.
TINYCHANGE
* lisp/ob-core.el (org-babel-demarcate-block): Keep case in
#+BEGIN_SRC and #+END_SRC keywords splitting src block.
* testing/lisp/test-ob.el (test-ob/keep-case): New test.
Reported-by: Rudolf Adamkovič <rudolf@adamkovic.org>
Link: https://orgmode.org/list/m2y152f8s3.fsf@adamkovic.org
* lisp/ob-core.el (org-babel-insert-result): Explain that
RESULT-PARAMS is a list. Clarify the treatment of INFO. Fix
incorrect :file parameters that is actually not used. Instead,
document :file-desc parameter that is being used.
Reported-by: Stefan Kangas <stefankangas@gmail.com>
Link: https://orgmode.org/list/871q4fzx0k.fsf@localhost
* lisp/ob-core.el (org-babel-execute-src-block): Make sure that point
remain on src block after evaluation. The function logic later
implicitly assumes that the point is on the block that has been
evaluated.
* lisp/ob-core.el (org-babel-execute-src-block): Fix indentation of
line.
Emacs's bd80717d8e7 (Re-enable TTY glyph production for batch mode
frames on Android, 2024-06-10) reverted all changes from 8d1d9798f77
(Fix bootstrap of org.texi, 2024-06-10) aside from an indentation fix.
Apply the indentation fix to avoid overwriting it on sync.
* lisp/ob-core.el (org-babel-read): When reading "string", ignore
leading/trailing newlines in addition to spaces.
* testing/lisp/test-ob.el (test-ob/org-babel-read): Add more tests.
Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/v15lva$hhl$1@ciao.gmane.io
* lisp/ob-core.el (org-babel-expand-noweb-references): After closing
comment, when using :comments noweb, leave trailing newline after the
closing comment.
* testing/lisp/test-ob-tangle.el (ob-tangle/comment-noweb-relative):
Modify test to check for the newline.
Reported-by: João Pedro <jpedrodeamorim@gmail.com>
Link: https://orgmode.org/list/87fruy2rw6.fsf@ergo
* lisp/ob-core.el (org-babel-read): Fix naive regexp for matching
escaped quotes. Instead, check if `read' can read the whole CELL in
one go.
* testing/lisp/test-ob.el (test-ob/org-babel-read): Add tests.
Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/v10k4s$et9$1@ciao.gmane.io
* lisp/org-table.el (org-table-convert-region): When detecting
delimiter in, do not unconditionally fall back to CSV parser. Only do
it when the line contains commas and use a simple single tab/space
split otherwise. Add new special delimeter-detection strategy when
SEPARATOR is 'babel-auto - convert to | full line | table instead of
falling back to tab/space split when the region contains a single
line.
* lisp/ob-core.el (org-babel-import-elisp-from-file): Force special
strategy when converting data to lisp.
The commit fixes the problem with first `re-search-forward' in the
`cond' moving point to end of the region, making the third `cond'
branch never match.
A special strategy specific to babel is necessary to preserve the
historic behavior with lines like
: single line with spaces
being converted to a single table cell
: | single line with space |
Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/18f24d87b62.d55e94e24743657.3252620114689708448@excalamus.com
* lisp/ob-core.el (org-babel-get-colnames): When table starts with
horizontal lines, consider column names to be the first non-hline row.
(org-babel-disassemble-tables): When detecting automatic column names,
do not assign colnames when the first row is an hline.
* doc/org-manual.org (Passing arguments): Update the manual, detailing
that leading hline rows are skipped for :colnames yes.
Link: https://orgmode.org/list/87wmqexjoj.fsf@localhost
* lisp/ob-babel.el (org-babel-demarcate-block): Modify a copy
of (org-element-at-point) to replace the old source block with 2 or 3
new modified copies by means of `org-element-interpret-data'. The 1st
source block contains the text from the body of the old block before
point or region, the 2nd block contains the body text after point or
body text within region, and in case of region, the 3rd block contains
the text after region. The caption and the name are deleted from the
1 or 2 blocks below the upper source block. Indent all blocks
immediately after insertion. Use :post-blank to control white lines
between inserted blocks. Leave point at the last inserted block.
Trying to split when point or region is not within the body of the old
source block raises an user-error.
* lisp/ob-babel (org-get-src-block-info): add the "within blank lines
after a source block" condition to the doc-string to match it with the
doc-string of and a comment in `org-babel-demarcate-block'.
* testing/lisp/test-ob.el (test-ob/demarcate-block-split-duplication)
(test-ob/demarcate-block-split-prefix-point)
(test-ob/demarcate-block-split-prefix-region)
(test-ob/demarcate-block-split-user-errors)
(test-ob/demarcate-block-wrap-point)
(test-ob/demarcate-block-wrap-region): New tests to check test cases
that broke earlier versions of this patch.
Link: https://list.orgmode.org/7e41f9b6e9026a404e256f33371e974c@posteo.net/
* lisp/ob-core.el (org-babel-do-in-edit-buffer): Avoid throwing an
error when something is not right with the code block. We already
ignore errors when major mode fails to load and we generally don't
want this macro to fail as it is used during indentation.
Link: https://list.orgmode.org/orgmode/87wmqo3it5.fsf@localhost/
* lisp/ob-core.el (org-babel-session-buffer): New API function that
return session buffer, if such buffer exists and is live.
(org-babel-execute-src-block): Use `org-babel-session-buffer'.
* lisp/ob-lua.el (org-babel-session-buffer:lua):
* lisp/ob-python.el (org-babel-session-buffer:python): Provide API to
retrieve session buffer name.
(org-babel-python-initiate-session-by-key): Use
`org-babel-session-buffer:python'.
* etc/ORG-NEWS (Org babel backends are now expected to define an
additional API function ~org-babel-session-buffer:<lang>~): Declare
the API addition.
Link: https://orgmode.org/list/87r0hr9f3b.fsf@localhost
* lisp/ob-core.el (org-babel-execute-src-block): Force eval directory
to follow live session buffer, if any. This is consistent with what
we promise in the manual section "16.4 Environment of a Code
Block">Choosing a working directory.
Link: https://orgmode.org/list/87mssi8ht2.fsf@gmail.com