Commit Graph

553 Commits

Author SHA1 Message Date
Ihor Radchenko e03402b931
Merge branch 'bugfix' 2023-10-24 12:28:20 +03:00
Ihor Radchenko 84fa57ad1f
org-babel-insert-result: Do not modify RESULT for side effects
* lisp/ob-core.el (org-babel-insert-result): In some scenarios, result
of evaluation is a mutable Elisp string.  Avoid modifying it for side
effects as it may affect side effects of Elisp code blocks.

Reported-by: Jeff Trull <edaskel@att.net>
Link: https://orgmode.org/list/CAF_DUeEYVMytS=V2_aGjLyhddVZaPd7FWG_5Sbys6qcB0zGnyw@mail.gmail.com
2023-10-24 12:25:12 +03:00
Ihor Radchenko 9bbc21df84
Merge branch 'bugfix' 2023-10-16 16:05:05 +03:00
hrdl f5e41b4724
org-babel-result-names: Do not alter window configuration
* lisp/ob-core.el (org-babel-result-names): Do not change
  visibility of windows when called.

TINYCHANGE
2023-10-16 16:04:27 +03:00
Ihor Radchenko 1f88acd013
* lisp/ob-core.el (org-babel-result-cond): Document all the arguments 2023-09-07 15:05:40 +03:00
Ihor Radchenko 21654e9a44
* lisp/ob-core.el (org-babel-examplify-region): Document all the arguments 2023-09-02 12:53:08 +03:00
Ihor Radchenko af9c063edf
* lisp/ob-core.el (org-babel-remove-result): Document function arguments 2023-09-01 14:03:39 +03:00
Ihor Radchenko 91a532b40e
org-babel-expand-noweb-references: Document all the function arguments
* lisp/ob-core.el (org-babel-expand-noweb-references): Fix the
docstring, documenting every argument.
2023-08-31 14:27:36 +03:00
Ihor Radchenko d8af9c40e0
org-babel-remove-result-one-or-many: Document the prefix argument
* lisp/ob-core.el (org-babel-remove-result-one-or-many): Rename prefix
argument to the conventional ARG and document it in the docstring.
2023-08-30 08:24:11 +03:00
Ihor Radchenko cd0e225e34
* lisp/ob-core.el (org-babel-import-elisp-from-file): Document all function arguments 2023-08-29 12:47:12 +03:00
Ihor Radchenko 3f6c33b7b6
* lisp/ob-core.el (org-babel-temp-stable-file): Document all function arguments 2023-08-29 12:46:58 +03:00
Ihor Radchenko 320c29c021
* lisp/ob-core.el (org-babel-remove-inline-result): Document DATUM argument 2023-08-27 14:04:25 +03:00
Ihor Radchenko 9f12a1b9e4
org-babel-map-executables: Avoid using `save-match-data'
* lisp/ob-core.el (org-babel-map-executables): Drop
`save-match-data' as it may be costly.
2023-08-27 13:10:44 +03:00
Ihor Radchenko 05064052ad
org-babel-map-call-lines: Avoid using `save-match-data'
* lisp/ob-core.el (org-babel-map-call-lines): Drop
`save-match-data' as it may be costly.
2023-08-27 13:10:26 +03:00
Ihor Radchenko 99b65bb212
org-babel-map-inline-src-blocks: Avoid using `save-match-data'
* lisp/ob-core.el (org-babel-map-inline-src-blocks): Drop
`save-match-data' as it may be costly.
2023-08-27 13:09:51 +03:00
Ihor Radchenko b3c7ebecac
* lisp/ob-core.el (org-babel-format-result): Document SEP argument 2023-08-26 15:06:20 +03:00
Ihor Radchenko 99c40177ad
org-babel-demarcate-block: Document prefix argument in the docstring 2023-08-25 14:26:44 +03:00
Ihor Radchenko d5ee33fed8
lisp/ob-core: List all the arguments in some docstrings
* lisp/ob-core.el (org-babel-parse-multiple-vars):
(org-babel-goto-named-src-block):
(org-babel-goto-named-result): Describe all the function arguments in
the docstring.
2023-08-24 13:27:58 +03:00
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