Commit Graph

18086 Commits

Author SHA1 Message Date
Daniel Kraus fbbc8b55cf
ob-sql.el: Respect all params when using dbconnection
* etc/ORG-NEWS (Miscellaneous): Document the change.
* lisp/ob-sql.el (org-babel-find-db-connection-param): Make it
possible to overwrite parameters that are set from :dbconnection.
2022-11-01 09:55:35 +08:00
Ihor Radchenko 5dc8ea0abe
org-paste-subtree: Fix when `kill-ring' is empty
* lisp/org.el (org-paste-subtree): Allow pasting from system
clipboard.
2022-11-01 09:41:38 +08:00
Ihor Radchenko 33cbb11d5a
org-kill-is-subtree-p: Handle clipboard
* lisp/org.el (org-kill-is-subtree-p): Allow `current-kill' to return
clipboard (even when `kill-ring' is empty).  Do not throw error when
clipboard is also empty.
2022-11-01 09:28:48 +08:00
Max Nikulin 57abbd4b92
org.el: Fix first call of `org-paste-subtree'
* lisp/org.el (org-paste-subtree): Do not check `kill-ring' before
calling `current-kill' since the latter can pull content of clipboard.

First call of `org-paste-subtree' failed if nothing had been yanked
before since Emacs start but system clipboard had text with valid
subtree originating from other application.  The bug was where since
the commit adding `org-paste-subtree'.

If both `kill-ring' and system clipboard are empty then `current-kill'
generates meaningful error.
2022-11-01 09:26:50 +08:00
Ihor Radchenko 6ef33b6dd6
org-latex-src-block--listings: Put options within lstlisting environment
* lisp/ox-latex.el (org-latex-src-block--listings): Do not use global
\lstset to set options.  Prefer optional argument to lstlisting
environment instead.

Reported-by: Denis Bitouzé <denis.bitouze@univ-littoral.fr>
Link: https://orgmode.org/list/87pmepvb7u.fsf@example.com
2022-10-31 16:15:11 +08:00
Ihor Radchenko c12175003a
org-ctags: Fix interactive calls to `visit-tags-table'
* lisp/org-ctags.el (org-ctags-get-filename-for-tag):
(org-ctags-all-tags-in-current-tags-table):
(org-ctags-rebuild-tags-file-then-find-tag): Fix the calls.
2022-10-31 14:22:40 +08:00
Ihor Radchenko 2ab762e93b
ob-scheme: Use new `geiser' function when available
* lisp/ob-scheme.el (geiser): Add new declare.
(org-babel-scheme-get-repl): When possible, call the newer `geiser'
instead of the obsolete `run-geiser'.
2022-10-31 14:22:39 +08:00
Daniel Kraus bd68ece99c
ob-clojure.el: Auto detect backend
* lisp/ob-clojure.el (org-babel-clojure-backend): Set the backend
to an available cli program or elisp package.
2022-10-30 12:18:58 +01:00
Ihor Radchenko e0a87eba18
org-element-cache: Fix cache updates from indirect buffers
* lisp/org-element.el (org-element--cache-active-p):
(org-element--cache-put):
(org-element--cache-process-request):
(org-element--parse-to): Ensure that cache updates are done in base
buffer.
(org-element--cache-remove): Ensure that cache updates are done in base
buffer.  Watch for cache size to be non-negative.
2022-10-30 10:14:51 +08:00
Ihor Radchenko e675affe93
org-macs: Add new macro `org-with-base-buffer'
* lisp/org-macs.el (org-with-base-buffer): New macro to run code in
base buffer of current or given buffer.
* lisp/org-element.el (org-element-org-data-parser):
(org-element--cache-find):
(org-element--cache-sync):
(org-element--cache-before-change):
(org-element--cache-after-change):
(org-element--cache-submit-request):
(org-persist-after-read-hook): Use the new macro.
2022-10-30 10:14:50 +08:00
Ihor Radchenko a182add4a4
org-clock-x11idle-program-name: Fix link to x11idle source code
* lisp/org-clock.el (org-clock-x11idle-program-name): Fix the link to
default x11idle program.  It is not distributed via WORG.
2022-10-30 10:14:49 +08:00
Daniel Kraus a51cf1cc6b
ob-clojure.el: Fix bug with inline comments
* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out
  nil values from cider evaluation.
2022-10-29 22:22:12 +02:00
Kyle Meyer 0681babab4 Fix recent doc string quoting issues
* lisp/org-agenda.el (org-agenda-show-outline-path):
* lisp/org.el (org-display-outline-path): Surround symbols with `...'
rather than using leading quote.

See 6013cb161 (Fix doc string quoting problems with ', 2022-07-25) for
a more detailed explanation.
2022-10-29 15:49:04 -04:00
Kyle Meyer 6ca9022dc4 ob-lob: Clean up spacing to pass Emacs's pre-commit check
* lisp/ob-lob.el (org-babel-lob-get-info): Remove trailing whitespace
from docstring.
2022-10-29 15:23:00 -04:00
Kyle Meyer bfc859fedf org-cycle: Silence byte-compiler under 'make single'
These are warnings that would show up when these changes made their
way to the Emacs repo.
2022-10-29 15:22:58 -04:00
Kyle Meyer 0b6a138bd3 ob-core: Silence byte-compiler 2022-10-29 15:15:29 -04:00
Kyle Meyer 27bc5c9a28 Merge branch 'km/from-emacs-master' 2022-10-29 15:15:03 -04:00
Stefan Kangas 4f0a4e07fd Backport commit db2ed9f33 from Emacs
; Fix several symbol name typos
db2ed9f333879e5ac283fb48c8b06ed4022f0af9
Stefan Kangas
Wed Oct 26 23:04:23 2022 +0200
2022-10-29 14:22:29 -04:00
Nikolay Kudryavtsev 6156b57bdf
ob-maxima.el: Fix execution on MS Windows
* ob-maxima.el (org-babel-execute:maxima): Change command line
invocation to a one that should work everywhere.

TINYCHANGE
2022-10-29 14:03:10 +08:00
Ihor Radchenko 7880695221
org-set-tags-command: Fix handling `org-loop-over-headlines-in-active-region'
* lisp/org.el (org-set-tags-command): Respect the non-nil value of
`org-loop-over-headlines-in-active-region'.  The code is adapted from
similar uses in other commands.

Reported-by: Alex Giorev <alex.giorev@gmail.com>
Link: https://orgmode.org/list/CAMq3WZh1sGW+BNKW1hZA+wP=iFskzShF-D-wUqWYqb_EponZ8g@mail.gmail.com
2022-10-29 13:25:38 +08:00
Ihor Radchenko c70a422082
org-babel-execute-src-block: Ensure that buffer is not changed
* lisp/ob-core.el (org-babel-execute-src-block): Ensure that we insert
results into the buffer where the src block is located.  Even when the
execution yields changing current buffer.

Reported-by: John Kitchin <jkitchin@andrew.cmu.edu>
Link: https://orgmode.org/list/CAJ51ETqMBqiHy+W3CZ+EtSPzVb1ihbX6v+NQsZKojN6jF8zoBQ@mail.gmail.com
2022-10-29 12:43:03 +08:00
Ihor Radchenko a51bb2c448
org-x11idle-exists-p: Do not demand X window system at load time
* lisp/org-clock.el (org-x11idle-exists-p): Do not check if load-time
`window-system' is `x'.  Instead, rely on the check in
`org-user-idle-seconds'.

Emacs may start as a daemon and hence `window-system' may not yet be
`x' during startup.

Reported-by: Julien Cubizolles <j.cubizolles@free.fr>
Link: https://orgmode.org/list/871qqs6gqs.fsf@free.fr
2022-10-29 10:44:08 +08:00
Ihor Radchenko b93a61af9c
org-latex-line-break-safe: Use safer value of "\\[0pt]"
* lisp/ox-latex.el (org-latex-line-break-safe):
(org-latex-table-row):
Change \empty ending to explicit optional argument.  \empty still has
undesired side effects in some cases.

* testing/lisp/test-org-table.el (test-org-table/to-latex):
* testing/lisp/test-ox-latex.el (test-ox-latex/verse): Update tests.

Reported-by: Juan Manuel Macías <maciaschain@posteo.net>
Link: https://orgmode.org/list/87o7u9rz1a.fsf@posteo.net
2022-10-29 10:34:05 +08:00
Daniel Kraus 0e175f11fd
lisp/ob-clojure.el: Fix header argument :var binding
* lisp/ob-clojure.el (org-babel-expand-body:clojure): Always quote
the variables passed from org-mode in Clojure let binding.
When a variable is a table or list, it's value is "(..data..)"
and without quotes, Clojure would try to execute the first
value as a function.
2022-10-28 11:50:03 +02:00
Bastien efcfaca72d lisp/ob-clojure.el: Update headers 2022-10-28 10:48:16 +02:00
Ihor Radchenko d87a496b54
org-babel-eval-error-notify: Always display exit code
* lisp/ob-eval.el (org-babel-eval-error-notify): Display exit code
even when stderr is not empty.

Link: https://orgmode.org/list/m21qqux0ga.fsf@me.com
2022-10-27 11:49:05 +08:00
Ihor Radchenko 6bbd08f5aa
org-datetree-insert-line: Fix blank line insertion
* lisp/org-datetree.el (org-datetree-insert-line): Use
`org--blank-before-heading-p' check.

* testing/lisp/test-org-datetree.el (test-org-datetree/find-date-create):
(test-org-datetree/find-month-create):
(test-org-datetree/find-iso-week-create): Explicitly set
`org-blank-before-new-entry' assumed throughout the tests.

Note that the `auto' behavior in `org-blank-before-new-entry' is
somewhat arbitrary.  It currently prefers no blank lines by
default (when no other headings are present in the buffer).  I went
with fixing the tests rather than changing
`org--blank-before-heading-p' to prefer inserting blank lines.  This
should make lesser impact on the end users.

Reported-by: Richard Walker <walkerrichardj@gmail.com>
Link: https://list.orgmode.org/orgmode/CAFyNgSE4mAt+b0Ks8L9bg2LbHcXnayOh+bYyONTQ4jN+zx3C1w@mail.gmail.com/
2022-10-26 15:25:24 +08:00
stardiviner 46b71f9108
org.el: Support auto display inline images when cycling
* lisp/org.el (org-toggle-inline-images): Support region.
(org-display-inline-images): Fix refresh argument logic.
(org-remove-inline-images): Support region.

* lisp/org-keys.el (org-toggle-inline-images): Update arguments.

* lisp/org-cycle.el (org-cycle-inline-images-display): Add new option to
control whether auto display inline images when cycling.
(org-cycle-display-inline-images): Add new hook function to auto display
inline images when cycling.
(org-cycle-hook): Add `org-cycle-display-inline-images' into cycling
hook by default.

* doc/org-manual.org (Exporting):
* etc/ORG-NEWS: Document the new option.
2022-10-26 12:43:07 +08:00
Ihor Radchenko 9490baa8bc
ob-python: Handle newer version of python-mode.el
* lisp/ob-python.el (py-choose-shell):
(py-toggle-shells): Use the new function name.
(py-default-interpreter): Remove the variable that is no longer
provided by python-mode.el.
(org-babel-python-initiate-session-by-key): Use `py-choose-shell'.

Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
2022-10-26 12:40:05 +08:00
Ihor Radchenko bb40848458
org-odt-plain-text: Fix stripping spaces around plain-text segments
* lisp/ox-odt.el (org-odt-plain-text): Do not strip whitespace around
individual plain-text objects.

Reported-by: András Simonyi <andras.simonyi@gmail.com>
Link: https://orgmode.org/list/CAOWRwxC2MTqAmXVXtLJi39f=KEC-6tmWJ6XC3OMTXqvC2hC_xw@mail.gmail.com
2022-10-26 12:33:55 +08:00
Ihor Radchenko e022a0cea1
org-make-tags-matcher: Do not treat PROPERTY="[X]" as timestamp match
* lisp/org.el (org-make-tags-matcher): Improve heuristics used to
detect timestamps in the matcher.

Reported-by: Daniel J. Sinder <djsinder@gmail.com>
Link: https://orgmode.org/list/CAHND-wwBsoAQs2a5XTGKyX-=fFL5AwCPup=uA+R=FRH=1rUeVg@mail.gmail.com
2022-10-25 18:36:25 +08:00
Ihor Radchenko cd835dcad8
org-babel-demarcate-block: Fix when within blank after src block
* lisp/ob-core.el (org-babel-where-is-src-block-head): Clarify that
return value is nil within blank after src block.
(org-babel-demarcate-block): Insert new block inheriting language when
within blank lines after existing src block.  Document the behavior.

Reported-by: dalanicolai <dalanicolai@gmail.com>
Link: https://orgmode.org/list/CACJP=3nCekgX4RuYBWf=R_2t05-s4ikx-L9qP7W0cSicNG55BA@mail.gmail.com
2022-10-25 17:38:35 +08:00
Mikhail Skorzhinskii c3aa6a6d43
org-refile.el: Show refile targets with a title
* lisp/org-refile.el (org-refile-get-targets): Use a document
title (#+TITLE) instead of file or buffer name in outline path, if a
corresponding customisation option is set to 'title.  Fallback to a
filename if there is no title in the document.

* lisp/org-refile.el (org-refile-use-outline-path): Add a new option
'title, see above.
2022-10-25 14:53:14 +08:00
Mikhail Skorzhinskii 55767b792e
org-agenda.el: Show document title in outline path
* lisp/org-agenda.el (org-agenda-show-outline-path): Add an option to
show a document title at start of an outline path, instead of a file or
a buffer name.

* lisp/org.el (org-display-outline-path): Show a document title (#+TITLE
value) and an outline path in an echo area if the customisation option
is set to 'title.  Fallback to a file or a buffer name if the document
title is absent.
2022-10-25 14:53:14 +08:00
Mikhail Skorzhinskii d4e7bcb4bd
org-clock.el: Rename org-clock-get-file-title
* lisp/org.el (org-get-title): A new function to collect a document
title from an org-mode buffer, based on a `org-clock-get-file-title'
implementation.

* lisp/org-clock.el (org-clock-get-file-title): Removed.
2022-10-25 14:53:01 +08:00
Ihor Radchenko 2b9f9646ef
org-cite: Fix style completion
* lisp/oc.el (org-cite-make-insert-processor): Provide the required
argument to SELECT-STYLE.

Reported-by: Kierin Bell <bellkierin@gmail.com>
Link: https://orgmode.org/list/875yg940z8.fsf@gmail.com
2022-10-25 14:25:37 +08:00
Ihor Radchenko 48b237d9e2
org-attach-attach: Fix storing link to attached files
* lisp/org-attach.el (org-attach-attach): Fix typo when
`org-attach-store-link-p' is set to t.  Instead of `file', we need
`attach-file': the link to the attached file, not the original.
2022-10-24 12:37:32 +08:00
Ihor Radchenko d4e3598ab8
fixup! org-babel-read: Fix cells like '"string" more' 2022-10-23 15:33:24 +08:00
Ihor Radchenko 633ca9e69e
org-babel-read: Fix cells like '"string" more'
* lisp/ob-core.el (org-babel-read): Do not consider every cell
starting from \" as `read'able.  Check closing \" at least.

Reported-by: Greg Minshall <minshall@umich.edu>
Link: https://orgmode.org/list/4033335.1638552531@apollo2.minshall.org
2022-10-23 14:44:07 +08:00
Ihor Radchenko 9a3dd429bb
org-babel-import-elisp-from-file: Fix when \"s are not around
* lisp/ob-core.el (org-babel-string-read): Only considered \" at the
string boundaries, not inside.
* testing/lisp/test-ob-shell.el (ob-shell/results-table): Add a test.
2022-10-23 14:30:57 +08:00
Ihor Radchenko f8a9cd2308
org-babel-eval: Return command output even upon failure
* lisp/ob-eval.el (org-babel-eval): Return the available command
output even when the command fails.

This is useful for bash scripts that can produce useful output even
upon failing.  The error window is still displayed to inform users.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2czakgpk8.fsf@me.com
2022-10-23 12:22:25 +08:00
Ihor Radchenko ab7eff9d9c
org-babel-eval-error-notify: Avoid uninformative empty error buffer
* lisp/ob-eval.el (org-babel-eval-error-notify): When STDERR is empty,
display the exit code in the error buffer rather than empty buffer.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2czakgpk8.fsf@me.com
2022-10-23 12:21:15 +08:00
Ihor Radchenko 1ef420b19d
org-babel-comint-with-output: Handle output without trailing newlines
* lisp/ob-comint.el (org-babel-comint-with-output): Consider scenarios
when comint emits output without trailing newlines.  The strategy to
split the full concatenated output using `comint-prompt-regexp' does
not work when the regexp matches bol.  Use a constant string as a
separator instead of relying upon `comint-prompt-regexp'.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2czakgpk8.fsf@me.com
2022-10-23 12:08:37 +08:00
Ihor Radchenko 69e3a4db3d
org-babel: Refactor temporary directory usage
* lisp/ob-core.el (org-babel-temp-directory): Fix return value for
remote directory.
(org-babel-temp-file): Simplify using `org-babel-temp-directory'.  Fix
incorrect file location when PREFIX is "".
(org-babel-temp-stable-directory): New macro returning suitable
temporary stable directory.
(org-babel-temp-stable-file): Simplify using
`org-babel-temp-stable-directory'.  Fix incorrect file location when
PREFIX is "".
* lisp/ob-java.el (org-babel-execute:java): Use
`org-babel-temp-directory'.

Reported-by: Ferdinand Pieper <fer@pie.tf>
Link: https://orgmode.org/list/87r0yz7u9q.fsf_-_@pie.tf
2022-10-23 11:49:00 +08:00
Ihor Radchenko 2f5e7103e5
ox-odt: Improve link generation in 4e5c737311
* lisp/ox-odt.el (org-odt-link): Use file: link code branch when
exporting id: links to document property drawers.  Call `org-odt-link'
with equivalent file: link instead of duplicating the existing code.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tiubca$1252$1@ciao.gmane.io
2022-10-22 12:55:11 +08:00
Ihor Radchenko 801c93638a
ob-shell: Fix multi-line scripts in sessions
* lisp/ob-comint.el (org-babel-comint-with-output): Clean up empty
output.  Such output is emitted unnecessarily for multi-line scripts.
* lisp/ob-shell.el (org-babel-shell-set-prompt-commands): Disable
PS2 and equivalent prompts.  Make sure that PROMPT_COMMAND does not
interfere with PS1 setting in POSIX shells.
(org-babel-sh-evaluate): Do not send input line-by-line.  Instead, let
`org-babel-coming-with-output' handle waiting for the output as well
as recording it.  Update to the new `org-babel-coming-with-output'
behavior of cleaning empty outputs.
* testing/lisp/test-ob-shell.el (test-ob-shell/session): Add a test.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/orgmode/m2r0zboix1.fsf@me.com/
2022-10-22 12:15:51 +08:00
Vikas Kumar e700578799
ob-core.el: Fix indentation of multiline text in list output
* lisp/ob-core.el (org-babel-format-result): Use `org-list-to-org'
instead of `org-list-to-generic' to format result in Org list.

The problem was in formatting a multiline text result into an Org
list.  Additional lines of a list item should be indented with the
first line of the item.  The method used for this
formatting (`org-list-to-generic') does not add the extra indentation
to additional lines of an item.  Using `org-list-to-org' instead fixes
the problem.

TINYCHANGE
2022-10-21 14:33:05 +08:00
Ihor Radchenko 85ab64c2b3
org-clock-select-task: Do not offer non-printable characters in selection
* lisp/org-clock.el (org-clock-insert-selection-line): Display N/A
when non-printable character selection is requested.  Non-printable
characters cannot be entered through `read-char'.

Reported-by: Kevin Brubeck Unhammer <unhammer@fsfe.org>
Link: https://orgmode.org/list/87y2krmzol.fsf@trigram.no
2022-10-21 13:59:17 +08:00
Ihor Radchenko 3502ce2dbb
ox-odt: Fix newlines replaced by spaces in Han script
* lisp/ox-odt.el (org-odt-plain-text): Use `fill-region' to unfill the
paragraphs with newlines accounting for scripts without spaces between
words.

Reported-by: James Harkins <jamshark70@zoho.com>
Link: https://orgmode.org/list/sbhnlv$4t1$1@ciao.gmane.io
2022-10-21 13:37:17 +08:00
Ihor Radchenko d98a496480
org-lint: Fix regexp when matching header-args
* lisp/org-lint.el (org-lint-wrong-header-argument): Correctly handle
header-args:lang+ properties.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/m2y1ta9rqe.fsf@me.com
2022-10-21 11:58:50 +08:00