1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00
org-mode/lisp
Jack Kamm 3ff21c7138 Add options to skip extra processing in org-babel-comint-with-output
This patch adds options to org-babel-comint-with-output to skip prompt
removal.  Allowing individual languages to handle this cleanup can be
more robust than relying on the generic ob-comint implementation.
This allows ob-python to switch back to using
`org-babel-comint-with-output' rather than its own bespoke
reimplementation, reducing code duplication.  Furthermore, this adds a
new implementation of ob-R non-async session output evaluation, that
is similar to the ob-python approach in that it avoids leaking
prompts, rather than relying on the cleanup from
`org-babel-comint-with-output'.  A test is added to test-ob-R.el to
demonstrate the improved robustness of the new approach; previously,
this test would fail due to a false positive prompt, but now passes.

* lisp/ob-comint.el (org-babel-comint--remove-prompts-p): New helper
function to parse the prompt-handling argument in
`org-babel-comint-with-output' and `org-babel-comint-async-register'.
(org-babel-comint-with-output): Add a new argument
to prevent extra processing for prompt cleanup.  Also, search for the
end-of-execution sentinel within the collected output rather than the
comint buffer, which doesn't depend on the position of point during
evaluation.
(org-babel-comint-async-register): Move parsing of prompt-handling
argument to `org-babel-comint--remove-prompts-p'.
* lisp/ob-python.el: Require subr-x for Emacs 27 compatibility.
(org-babel-python-send-string): Switch to using
`org-babel-comint-with-output', rather than bespoke reimplementation.
* lisp/ob-R.el: Require subr-x for Emacs 27 compatibility.
(ess-send-string): Declare external function.
(org-babel-R-evaluate-session): New implementation of output
evaluation that avoids leaking prompts, by writing the code block to a
tmp file and then sourcing it.
* testing/lisp/test-ob-R.el (test-ob-r/session-output-with->-bol): New
test for robustness against false positive prompts at the beginning of
a line.
2024-11-12 19:54:28 -08:00
..
Makefile Fix parallel execution of Makefiles 2024-06-20 18:27:04 +02:00
ob-awk.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-C.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-calc.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ob-clojure.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ob-comint.el Add options to skip extra processing in org-babel-comint-with-output 2024-11-12 19:54:28 -08:00
ob-core.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ob-css.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-ditaa.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-dot.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-emacs-lisp.el fixup! lisp/ob-emacs-lisp.el: Throw an error when session is requested 2024-04-09 16:35:44 +03:00
ob-eshell.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ob-eval.el ob-core: Unify Org Babel related buffer names using constant variable 2024-07-16 19:09:45 +02:00
ob-exp.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ob-forth.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-fortran.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-gnuplot.el Merge branch 'bugfix' 2024-08-22 14:37:15 +02:00
ob-groovy.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-haskell.el Rename org-babel-comint-prompt-regexp-old' to ...-fallback' 2024-08-05 17:02:56 +02:00
ob-java.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-js.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-julia.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ob-latex.el org-babel-latex-process-alist: Use latemk or run latex trice 2024-06-03 16:32:02 +02:00
ob-lilypond.el Backport commit 45a20d781 from Emacs 2024-07-01 22:33:10 -04:00
ob-lisp.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-lob.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
ob-lua.el Backport commit a7dff8c53 from Emacs 2024-06-27 23:13:47 -04:00
ob-makefile.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-matlab.el Backport commit 8e1c56ae4 from Emacs 2024-01-06 15:48:23 -05:00
ob-maxima.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-ocaml.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-octave.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-org.el Clean up spacing to pass Emacs's pre-commit check 2024-05-27 21:18:59 -04:00
ob-perl.el Backport commit 8e1c56ae4 from Emacs 2024-01-06 15:48:23 -05:00
ob-plantuml.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
ob-processing.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-python.el Add options to skip extra processing in org-babel-comint-with-output 2024-11-12 19:54:28 -08:00
ob-R.el Add options to skip extra processing in org-babel-comint-with-output 2024-11-12 19:54:28 -08:00
ob-ref.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-ruby.el Rename org-babel-comint-prompt-regexp-old' to ...-fallback' 2024-08-05 17:02:56 +02:00
ob-sass.el Backport commit 8e1c56ae4 from Emacs 2024-01-06 15:48:23 -05:00
ob-scheme.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
ob-screen.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-sed.el ob-*: Do not emit redundant messages about code block evaluation 2024-06-13 15:22:28 +02:00
ob-shell.el org-babel-sh-prompt: Fix Emacs 27 CI failures 2024-08-06 20:11:45 +02:00
ob-sql.el Merge branch 'bugfix' 2024-07-25 13:22:41 +02:00
ob-sqlite.el ob-sqlite: Add ability to open a database in readonly mode 2024-06-25 12:53:52 +02:00
ob-table.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ob-tangle.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
ob.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
oc-basic.el Backport commit c0eefebab from Emacs 2024-06-27 22:47:14 -04:00
oc-biblatex.el oc-biblatex: Allow native biblatex options in CITE_EXPORT 2024-04-26 15:23:29 +03:00
oc-bibtex.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
oc-csl.el oc-csl: New custom option `org-cite-csl-bibtex-titles-to-sentence-case' 2024-06-20 07:41:56 +02:00
oc-natbib.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
oc.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ol-bbdb.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-bibtex.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-docview.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-doi.el Merge branch 'bugfix' 2024-01-06 16:02:02 -05:00
ol-eshell.el org-id.el: Add search strings, inherit parent IDs 2024-02-24 15:56:44 +03:00
ol-eww.el org-id.el: Add search strings, inherit parent IDs 2024-02-24 15:56:44 +03:00
ol-gnus.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-info.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-irc.el org-id.el: Add search strings, inherit parent IDs 2024-02-24 15:56:44 +03:00
ol-man.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-mhe.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-rmail.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ol-w3m.el Backport commit 0f3be9596 from Emacs 2024-05-28 22:58:43 -04:00
ol.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-agenda.el org-agenda-write: Remove redundant `set-buffer' 2024-07-28 20:49:25 +02:00
org-archive.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-attach-git.el Backport commit 8e1c56ae4 from Emacs 2024-01-06 15:48:23 -05:00
org-attach.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-capture.el org-capture-templates: Allow headline/olp target to be function or symbol 2024-06-18 14:33:55 +02:00
org-clock.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-colview.el org-colview: Fix ignoring org-agenda-columns-add-appointments-to-effort-sum 2024-10-12 09:31:44 +02:00
org-compat.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-crypt.el Never pass error message verbatim as the first argument for message'/error' 2024-02-25 13:15:04 +03:00
org-ctags.el org-ctags: Don't assume ctags-program-name is bound 2024-05-28 23:23:39 -04:00
org-cycle.el Backport commit 77d0eed74 from Emacs 2024-06-09 20:50:50 -04:00
org-datetree.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-duration.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-element-ast.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-element.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-entities.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-faces.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
org-feed.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-fold-core.el Backport commit a6cab228d from Emacs 2024-07-20 15:24:27 -04:00
org-fold.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
org-footnote.el org-footnote-new: Do not throw an error at bol for inline/anonymous footnotes 2024-10-13 11:03:32 +02:00
org-goto.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-habit.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
org-id.el org-id: Guard against unwarranted major-mode change when querying id 2024-09-22 12:41:54 +02:00
org-indent.el Backport commit fb11294d4 from Emacs 2024-06-27 23:13:49 -04:00
org-inlinetask.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
org-keys.el Add repeat-mode keymap for navigation commands 2024-10-12 19:39:56 +02:00
org-lint.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-list.el org-list-struct-apply-struct: Fix item contents breaking out of the item 2024-07-10 15:39:26 +02:00
org-macro.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-macs.el Merge branch 'bugfix' 2024-11-01 17:14:48 -07:00
org-mobile.el Backport commit 6757f8e67 from Emacs 2024-07-14 12:20:46 -04:00
org-mouse.el org-mouse-context-menu: Fix `grep' command to handle filenames starting with '-' 2024-11-09 15:33:38 +01:00
org-num.el org-num-skip-tags: Avoid using function that is not pre-loaded in autoloads 2024-06-14 14:25:03 +02:00
org-pcomplete.el Backport commit 77d0eed74 from Emacs 2024-06-09 20:50:50 -04:00
org-persist.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-plot.el org-plot/gnuplot-to-data: Do not assume that `orgtbl-to-generic' preserves buffer 2024-07-24 12:32:32 +02:00
org-protocol.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-refile.el org-refile: calculate file part of the outline path once per file 2024-10-15 20:48:10 +02:00
org-src.el Merge branch 'bugfix' 2024-07-25 13:22:41 +02:00
org-table.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
org-tempo.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org-timer.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
org.el Merge branch 'bugfix' 2024-11-09 15:01:40 +01:00
ox-ascii.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-beamer.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-24 17:04:40 +08:00
ox-html.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ox-icalendar.el ox-icalendar: Fix export of diary-style timestamps 2024-09-22 12:22:33 +02:00
ox-koma-letter.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-latex.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00
ox-man.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-md.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-odt.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-org.el Merge branch 'km/from-emacs-master' 2024-05-28 23:01:23 -04:00
ox-publish.el lisp/ox-publish.el: Use publish time in publish cache 2024-08-15 20:24:42 +02:00
ox-texinfo.el ox-texinfo: Fix definitions containing Org markup 2024-10-26 10:36:59 +02:00
ox.el Replace use of if-let and when-let, obsolete in Emacs 31.0.50 2024-10-27 10:34:05 +08:00