1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-11 09:20:32 +00:00
Commit Graph

535 Commits

Author SHA1 Message Date
Ihor Radchenko
5e7427c6d1
* lisp/ob-core.el (org-babel-hide-result-toggle): Document FORCE argument 2023-08-23 14:24:53 +03:00
Ihor Radchenko
168b99ba94
org-babel-join-splits-near-ch: Fix the docstring
* lisp/ob-core.el (org-babel-join-splits-near-ch): Explain all the
arguments and what the function does.
2023-08-21 13:01:54 +03:00
Ihor Radchenko
06714dea79
org-babel-current-result-hash: Mark unused argument
* lisp/ob-core.el (org-babel-current-result-hash): Mark INFO argument
as unused.  `org-babel-where-is-src-block-results' does not use INFO
argument even when passed.
2023-08-20 11:45:04 +03:00
Ihor Radchenko
35960e1614
org-babel-execute-subtree: Document the argument in the docstring
* lisp/ob-core.el (org-babel-execute-subtree): Clarify the meaning of
command argument in the docstring.
2023-08-19 12:47:53 +03:00
Ihor Radchenko
79aa149143
org-babel-map-executable: Describe header arg in the docstring
* lisp/ob-core.el (org-babel-execute-buffer): Mention in the docstring
how prefix argument is handled.
2023-08-18 13:15:10 +03:00
Ihor Radchenko
3b49db8755
Revert "Prefer `string-search' when matching exact strings"
This reverts commit e9110a8dd7.

`string-search' is not available in Emacs<28 and also always
case-sensitive.
2023-08-18 11:00:13 +03:00
Ihor Radchenko
d0c7cd48eb
org-babel-do-key-sequence-in-edit-buffer: Mention argument in docstring
* lisp/ob-core.el (org-babel-do-key-sequence-in-edit-buffer): Mention
argument KEY in the docstring.
2023-08-17 15:54:20 +03:00
Ihor Radchenko
cc435cba71
lisp/ob-core.el: Fix some docstrings that do not detail all the arguments
* lisp/ob-core.el (org-babel-initiate-session):
(org-babel-switch-to-session):
(org-babel-switch-to-session-with-code): Explain all the arguments in
the docstring.
2023-08-16 13:32:06 +03:00
Ihor Radchenko
9fd547dd3a
org-babel-where-is-src-block-result: Fix inside affiliated parsed keyword
* lisp/ob-core.el (org-babel-where-is-src-block-result): Do not assume
that parent has contents-end and that we are inside contents, but not
inside secondary object/affiliated keyword.
*
testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1):
Add tests.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Link: https://orgmode.org/list/CA+G3_PNt7WqkCzChV+dx1FeSPgTEVkNSE41a3qC5wv3g+jTwrQ@mail.gmail.com
2023-08-16 11:07:20 +03:00
Ihor Radchenko
99c8425bc7
org-babel-insert-result: Remove duplicate let-binding
* lisp/ob-core.el (org-babel-insert-result): Remove duplicate
computation of the INLINE value.
2023-08-16 11:05:31 +03:00
Ihor Radchenko
487f39efa6
org-babel-insert-result: Err on :results drawer inline src block
* lisp/ob-core.el (org-babel-insert-result): Throw an error when
trying to insert :results drawer in inline src blocks.
2023-08-16 11:04:14 +03:00
Ihor Radchenko
5496f5277f
org-babel-load-in-session: Document argument INFO
* lisp/ob-core.el (org-babel-load-in-session): Update the docstring,
describing what INFO argument does.
2023-08-15 14:50:58 +03:00
Ihor Radchenko
b89bc55867
org-babel-insert-header-arg: Describe arguments in the docstring
* lisp/ob-core.el (org-babel-insert-header-arg): Fix the docstring,
describing when the arguments do.
2023-08-14 14:59:11 +03:00
Ihor Radchenko
36dcb2a23c
org-babel-combine-header-arg-lists: Describe arguments in the docstring
* lisp/ob-core.el (org-babel-combine-header-arg-lists): Describe all
the header arguments in the docstring.
2023-08-13 13:35:53 +03:00
Ihor Radchenko
70a082c9fb
org-babel-expand-src-block: Mention all the header arguments in the docstring
* lisp/ob-core.el (org-babel-expand-src-block): Explain all the header
arguments in the docstring.
2023-08-12 12:06:12 +03:00
Ihor Radchenko
cfea24dc15
org-babel-expand-body:generic: Document all the arguments in the docstring
* lisp/ob-core.el (org-babel-expand-body:generic): Document VAR-LINES
in the docstring.
2023-08-11 14:22:28 +03:00
Ihor Radchenko
0a5dd8cf68
org-babel--file-desc: Update docstring
* lisp/ob-core.el (org-babel--file-desc): Describe all the argument in
the docstring and clarify what the function returns.
2023-08-05 15:09:59 +03:00
Ihor Radchenko
8dc71d915e
lisp/ob-core.el: Fix some checkdoc warnings
* lisp/ob-core.el (org-babel-where-is-src-block-head): Quote
`match-data'.
(org-babel-insert-result): Ensure two spaces between sentences.
(org-babel-temp-file): Clarify that `temporary-file-directory' refers
to a function.
2023-08-04 11:33:33 +03:00
Ihor Radchenko
6eb117da06
* lisp/ob-core.el (org-babel--expand-body): Document all the arguments 2023-08-04 11:33:18 +03:00
Ihor Radchenko
4fb8ad9990
lisp/ob-core.el: Add some missing docstrings
* lisp/ob-core.el (org-babel-execute-safely-maybe):
(org-babel-execute-maybe):
(org-babel-active-location-p): Add docstrings.
2023-08-04 11:33:01 +03:00
Ihor Radchenko
de9f89e4be
org-babel-execute-src-block: Fix with :cache yes :results append/prepend
* lisp/ob-core.el (org-babel-execute-src-block): Do not remove
previous result when :cache is yes, but :results requests
appending/prepending the new result.
2023-07-28 12:11:31 +03:00
Ihor Radchenko
c730caf512
org-babel-result-to-file: Fix when in indirect buffer
* lisp/ob-core.el (org-babel-result-to-file): Consider file name in
base buffer when calculating base directory.

Reported-by: 赵一宇 <zhyznd@163.com>
Link: https://list.orgmode.org/orgmode/3d69c850.69db.18953ae45da.Coremail.zhyznd@163.com/
2023-07-17 12:04:05 +03:00
Ihor Radchenko
1967aa43e5
org-src-preserve-indentation: Refactor handling src block flags
* lisp/org-src.el (org-src-preserve-indentation-p): New function
checking whether block should preserve indentation.  This function
abstracts away the check for block type, indentation flag, and
customized `org-src-preserve-indentation' value.
(org-src--edit-element):
* lisp/ob-core.el (org-babel--normalize-body):
(org-babel-read-element):
(org-babel-update-block-body):
* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/org-element.el (org-element-example-block-interpreter):
(org-element-src-block-interpreter):
* lisp/org.el (org-fixup-indentation):
(org-indent-region):
* lisp/ox.el (org-export-unravel-code): Use the new function instead
of duplicating code.

* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Add FIXME.  We
do not have access to the block element here and cannot easily check
the flag.

* lisp/ob-tangle.el (org-babel-tangle-single-block):
* lisp/org-src.el (org-src-font-lock-fontify-block):
* lisp/org.el (org-indent-line): Check block flag in addition to `org-src-preserve-indentation'.

This commit unifies logic deciding whether to preserve block
indentation into a single place to avoid confusion.
2023-07-13 11:51:15 +03:00
Ihor Radchenko
f93d855c51
Prefer forward-line' over beginning-of-line'
The latter is much slower.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#98
2023-07-01 14:36:14 +03:00
Ihor Radchenko
bc29f5de41
org-element: New `org-element-*property*' functions
* lisp/org-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties.  The functions are `setf'-able.

Update all the relevant code in Org to use the new functions instead
of genetic property queries.
2023-07-01 14:35:43 +03:00
Ihor Radchenko
ea4f4fdf58
Rename org-export-get-parent' to org-element-parent' 2023-07-01 14:35:41 +03:00
Ihor Radchenko
a7d1dfa171
Use `org-element-type-p'
Use `org-element-type-p' across Org source, except some tests, where `eq' can
produce more meaningful failure explanations.
2023-07-01 14:35:35 +03:00
Ihor Radchenko
080710797a
fixup! org-babel-common-header-args-w-values: Add docstring 2023-05-03 19:51:33 +02:00
Ihor Radchenko
f268819d19
org-babel-common-header-args-w-values: Add docstring
* lisp/ob-core.el (org-babel-common-header-args-w-values): Add missing
docstring.
2023-05-03 19:19:28 +02:00
Kyle Meyer
e5ae9c0ce7 Merge branch 'bugfix' 2023-04-30 19:55:54 -04:00
Mattias Engdegård
b77a209f78 Backport commit 4f0849a9e from Emacs
* lisp/ob-core.el (org-babel-insert-result): Silence
ignored-return-value warnings about calls to side-effect-free
functions in the last clause of `cond` statements whose values are
unused.

Remove unused values in effect context
4f0849a9e6d29e25d23e061bd81bacce9468856d
Mattias Engdegård
Sun Apr 9 16:45:40 2023 +0200
2023-04-30 19:19:03 -04:00
Ihor Radchenko
a8dbe8eb38
Merge branch 'bugfix' 2023-04-27 22:42:58 +02:00
Ihor Radchenko
52dc48050e
Handle compiler warnings from Emacs master
* lisp/ob-core.el (org-babel-insert-result): Comment out unused `cond'
clause.  Still leave it there for readability of the logic.
* lisp/org.el (org-agenda-restrict-begin):
(org-agenda-restrict):
(org-agenda-restrict-end): Mark variables from org-agenda.
2023-04-27 22:42:39 +02:00
Ihor Radchenko
eaf274909f
Consistently allow null character in block and drawer bodies
Also, do not use [^\000] as a poor-man's replacement for
(rx (or any newline)).

* lisp/ob-core.el (org-babel-src-block-regexp):
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs):
* lisp/org-compat.el (org-hide-block-toggle-all):
* lisp/org-element.el:
* lisp/org-feed.el (org-feed-read-previous-status):
(org-feed-parse-rss-feed):
(org-feed-parse-rss-entry):
* lisp/ox-org.el (org-org-publish-to-org):
* testing/lisp/test-ob-tangle.el:
* lisp/org.el (org-block-regexp):
(org-clock-drawer-re): Use \(.\|\n\) regexp instead of [^\000].
(org-latex-regexps): Do not try to match \000 inside latex fragments -
we now use parser for this purpose.

Reported-by: Tommy Kelly <tommy.kelly@verilab.com>
Link: https://orgmode.org/list/875yfk9vlv.fsf@localhost
2023-04-25 21:06:50 +02:00
Ihor Radchenko
6376237779
org-babel-parse-multiple-vars: Do no err on empty :var
* lisp/ob-core.el (org-babel-parse-multiple-vars): Parse empty :var
header argument into (:var) alist element.
2023-04-24 14:00:49 +02:00
Ihor Radchenko
e9110a8dd7
Prefer `string-search' when matching exact strings
* lisp/ob-core.el (org-babel-inline-result-wrap):
(org-babel-demarcate-block):
* lisp/org-agenda.el (org-agenda-get-represented-categories):
* lisp/org-persist.el (org-persist--read-elisp-file):
* lisp/ox-beamer.el (org-beamer--format-frame):
* lisp/ox-latex.el (org-latex--environment-type):
(org-latex--inline-image): Use a simple and faster `string-search'
when searching for non-regexps.
2023-03-29 15:54:24 +02:00
Ihor Radchenko
88f7bea169
org-babel-temp-stable-file: Avoid `sxhash' collisions
* lisp/org-macs.el (org-sxhash-safe): New function to calculate object
hashes.  Unlike `sxhash', the new function ensures that
if (= (org-sxhash-safe A) (org-sxhash-safe b)) then (equal A B)
Not just the opposite.
* lisp/ob-core.el (org-babel-temp-stable-file): Use the new function.

Reported-by: Thomas Worthington <thomas.worthington@cosector.com>
Link: https://orgmode.org/list/877cwrcdh2.fsf@localhost
2023-03-29 15:10:19 +02:00
Ihor Radchenko
12883765d2
org-babel-import-elisp-from-file: Fix the docstring
* lisp/ob-core.el (org-babel-import-elisp-from-file): Document all the
arguments.
2023-03-07 14:03:02 +01:00
Ihor Radchenko
52f29d4da3
Merge branch 'bugfix' 2023-01-18 12:19:34 +03:00
Ihor Radchenko
cbb288eaa5
ob-core: Do not use `temporary-file-directory' function
* lisp/ob-core.el (org-babel-temporary-stable-directory): Use
`temporary-file-directory' variable instead of function.  The function
returns value depending on the `default-directory' at Org startup time
thus creating unpredictable temporary babel locations that may
sometimes litter current directory.

Reported-by: bhrgunatha <bhrgunatha@gmail.com>
Link: https://orgmode.org/list/93b040e1-6dc6-487f-de89-a4cea9a560ff@gmail.com
2023-01-18 12:16:19 +03:00
Ihor Radchenko
e002168d64
Merge branch 'bugfix' 2023-01-02 10:53:14 +03:00
Ihor Radchenko
3454021483
Revert "org-babel-read: Obey `org-confirm-babel-evaluate'"
This reverts commit 10e857d428.

* lisp/ob-core.el:
(org-babel-merge-params):
(org-babel-process-params):
(org-babel-read):
* lisp/org-table.el: Add FIXME comments to places where arbitrary code
execution may happen.

The extra query is reverted until we develop a better code execution
safety system for Org.  The commit introduced too many user queries,
making the whole idea of asking users to execute code from Org files
not useful.

Link: https://orgmode.org/list/878rinadlq.fsf@localhost
2023-01-02 10:49:45 +03:00
Kyle Meyer
96a402780c Merge branch 'bugfix' 2023-01-01 13:15:12 -05:00
Kyle Meyer
2f15b3c528 Merge branch 'km/from-emacs-29' into bugfix 2023-01-01 12:45:33 -05:00
Eli Zaretskii
e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko
5de86ffaba
Merge branch 'bugfix' 2022-12-26 12:25:28 +03:00
Ihor Radchenko
b11abb409c
org-babel-insert-result: Output strings as is for lists of strings
* lisp/ob-core.el (org-babel-insert-result): Do not use %S format for
lists of strings in :results list output.  This is more consistent
with single string output.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/1852d9eb52f.c4c534f9581400.7140516675874523594@excalamus.com
2022-12-26 12:24:51 +03:00
Ihor Radchenko
3a5b2555df
Merge branch 'bugfix' 2022-12-25 14:00:14 +03:00
Ihor Radchenko
7f2f73c414
org-babel-read: Small fix
* lisp/ob-core.el (org-babel-read): Remove redundant `format' call for
code block body.  The body is already a string.  Make the block name
more human readable using %s `format' arg.

Reported-by: Tom Gillespie <tgbugs@gmail.com>
Link: https://orgmode.org/list/CA+G3_PPFHcx6eeKGuvxDcuy3NjSpTnrbye0gHJePtvi2a-5wrg@mail.gmail.com
2022-12-25 13:58:06 +03:00
Ihor Radchenko
18fec7623c
ob-core: Fix :results list when result is a table
* lisp/ob-core.el (org-babel-insert-result): Do not treat table lines
in RESULT verbatim.
* testing/lisp/test-ob-shell.el (ob-shell/results-list): Add new test.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2tu1v8gj8.fsf@me.com
2022-12-18 14:32:50 +03:00