Commit Graph

23435 Commits

Author SHA1 Message Date
Vasilij Schneidermann 5082e436a7 org-datetree.el: Respect `org-blank-before-new-entry'
* lisp/org-datetree.el (org-datetree-insert-line): Respect
`org-blank-before-new-entry'.

* 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): Update tests.

TINYCHANGE

See <https://orgmode.org/list/20200903085054.GA21638@odonien.localdomain/>
2020-09-09 10:07:29 +02:00
Bastien Guerry 7a12e14990 org.el (org-display-outline-path): Fix faces of the message
* lisp/org.el (org-display-outline-path): Set :height as the
default face height, and don't change other face attributes.

See a3576543f for a previous fix, and this discussion:
<https://orgmode.org/list/21ef0e94-e766-455c-a45c-fe30e316c121@Spark>
2020-09-09 09:57:45 +02:00
Bastien Guerry 570bd6ce93 org.el: Fix `org-display-outline-path'
* lisp/org.el (org-display-outline-path): Always remove faces when
setting the outline path to display.

See <https://orgmode.org/list/21ef0e94-e766-455c-a45c-fe30e316c121@Spark>
2020-09-09 09:42:37 +02:00
Bastien Guerry f17d301e17 lisp/org.el (org-forward-heading-same-level): Add a comment
* lisp/org.el (org-forward-heading-same-level): Add a comment adding
a FIXME, in case this change appears to impact Org itself.
2020-09-08 11:25:03 +02:00
D a700fadd72 org.el: Let `org-forward-heading-same-level' check for fully invisible lines
* lisp/org.el (org--line-fully-invisible-p): New function.
(org-forward-heading-same-level): Use it to check whether the line
is fully invisible.

TINYCHANGE

See <https://orgmode.org/list/51b41109-997c-db37-c0ed-44e8d0154cee@posteo.net/>
2020-09-08 11:17:51 +02:00
No Wayman 4f49ebb6d6 org.el: Fix `org-add-planning-info'
* lisp/org.el (org-add-planning-info): * lisp/org.el
(org-add-planning-info): Use `org-time-was-given' and
`org-end-time-was-given' if the variables are bound from an
outside call.

This allows e.g. programmatically passing a time of day to
`org-schedule'.

TINYCHANGE
2020-09-08 10:27:13 +02:00
Bastien 7c4b67d49a lisp/org-plot.el: Add a maintainer
* lisp/org-plot.el: Add a maintainer.
2020-09-08 09:14:54 +02:00
Kyle Meyer 824a4a14b0 ol-gnus: Prefer nnselect to nnir if available
* lisp/ol-gnus.el (org-gnus-store-link): Use nnselect when available.

In the master branch of the Emacs repository, f103e89c1d (Add aliases
for recent Gnus nnselect changes, 2020-09-07) switched
org-gnus-store-link over to using nnselect, but that can't be ported
as is because it isn't backward compatible.  Make a similar change
that includes compatibility kludges.
2020-09-07 23:19:15 -04:00
Kyle Meyer 1c5bebdad9 Merge branch 'maint' into master 2020-09-07 21:23:16 -04:00
Nicolas Goaziou 13dfab3fb2 ox-texinfo: Tiny refactoring
* lisp/ox-texinfo.el (org-texinfo-link): Use
`org-texinfo--sanitize-content'.

(cherry picked from commit 8fd24c0a53)
[km]: This fixes a double-escaping regression introduced by 706970efb
      (ox-texinfo.el: Fix escaping special chars in raw-path,
      2020-06-05).
2020-09-07 21:15:40 -04:00
Bastien 19b741583d org-agenda.el (org-find-top-headline): Fix bug
* lisp/org-agenda.el (org-find-top-headline): Fix bug: don't
inclure the statistic cookie in the headline text as this can be
updated during agenda interaction.

Reported-by: William Horne <will.m.horne@gmail.com>
See <https://orgmode.org/list/CA+2+CK-TofaNS1FOyZGhd3jPKb-XNOYM-0ouP9=tW=qepKm7wg@mail.gmail.com>
2020-09-07 20:15:38 +02:00
Bastien 07c6b11258 ob-shell.el: New option `org-babel-shell-results-defaults-to-output'
* lisp/ob-shell.el (org-babel-shell-results-defaults-to-output):
New option.

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline): Fix test.

See <https://orgmode.org/list/CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com>
2020-09-07 19:30:04 +02:00
Jack Kamm 6f9929fc3b ob-python: Replace session value format string with function
* lisp/ob-python.el (org-babel-python--eval-ast): Removed.
(org-babel-python-format-session-value): New function that returns
Python code to evaluate for sessions with value results.
(org-babel-python-evaluate-session): Replace
org-babel-python--eval-ast with org-babel-python-format-session-value.

Motivation is that the new function is more flexible than the old
format string.  We can pass in the full result-params, which can be
used to add more formatting options in future.  We could also add more
optional arguments in the future to extend this functionality.

This function will be particularly helpful for a couple patches after
9.4:
- ob-reticulate
  - https://orgmode.org/list/875z98gj4f.fsf@gmail.com/
- Improved formatting
  - https://orgmode.org/list/87eenpfe77.fsf@gmail.com/

However, I add this function in now 9.4, so those future patches can
rely on it in 9.4.  In particular, ob-reticulate will probably be
packaged separately from org-mode, and I want to provide a stable
interface to it so that it can be released after 9.4.
2020-09-07 09:39:21 -07:00
Bastien dfad6488d3 Merge branch 'maint' 2020-09-07 17:41:04 +02:00
Bastien dab32da708 lisp/org.el: Bump version to 9.3.8
* lisp/org.el: Bump version to 9.3.8.
2020-09-07 17:40:17 +02:00
Bastien 11ef7454ab org.el (org-fixup-indentation): Fix logbook drawers indentation
* lisp/org.el (org-fixup-indentation): Fix logbook drawers
indentation.

Reported-by: Matt Lundin <mdl@imapmail.org>
https://orgmode.org/list/87r1t8sdhd.fsf@fastmail.fm/
2020-09-07 09:17:21 +02:00
Bastien 81d49b5adb ob-emacs-lisp.el: Don't wrap execution within `save-window-excursion'
* lisp/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): Don't wrap
execution within `save-window-excursion'.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
https://orgmode.org/list/87tv5vt545.fsf@gmail.com
2020-09-07 07:37:19 +02:00
Bastien 69a91ba8bc Merge branch 'maint' 2020-09-07 07:32:28 +02:00
Bastien 7769518f3a Use the `org-block' face for every true blocks
* lisp/org-faces.el (org-block): Tiny docstring enhancement.

* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Use the
`org-block' face for every true blocks.

Reported-by: Sébastien Miquel <sebastien.miquel@posteo.eu>
https://orgmode.org/list/42749c98-ddfe-bad4-43a5-1119e24972bd@posteo.eu
2020-09-07 07:31:11 +02:00
Bastien 9f0af69dd2 Skip archived headings when tangling and exporting
* lisp/org.el (org-in-archived-heading-p): New function.

* lisp/ob-exp.el (org-babel-exp-process-buffer):
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Use
`org-in-archived-heading-p' to skip archived headings when tangling
and exporting.

* testing/lisp/test-org.el (test-org/in-archived-heading-p): Add
test for `org-in-archived-heading-p'.

Reported-by: flare <gabrielxaviersmith@gmail.com>
See https://orgmode.org/list/877dt9ey2c.fsf@gmail.com/
2020-09-07 06:51:06 +02:00
Jack Kamm 4df12ea391 ob-python: Improve robustness of session evaluation
* lisp/ob-python.el (py-send-string-no-output): Remove external function.
(py-shell-send-string): Add external function.
(org-babel-python--eval-ast): Remove blank lines.
(org-babel-python--send-string): New function to send string to Python
process and return output.
(org-babel-python-evaluate-session): Call
org-babel-python--send-string to evaluate code.

New function to send code to Python session.  It has the following
desirable properties:
- Wait for evaluation to finish before returning.
- Input can have arbitrary spaces/newlines.
- Avoid echoing input to the session.
- Echo all output to the session.
- Output is also captured and returned separately.
- Avoid adding extra prompts to the session.
- Work well with both Python and IPython repls.

The implementation borrows from `python-shell-send-string-no-output'
and `org-babel-comint-with-output'.  This commit is related to
632ceabb1, which tried to implement the same thing, but also
introduced bugs, and had to be partially reverted in b5709ddc9.
2020-09-06 18:15:04 -07:00
Jack Kamm 5d289d2b3e ob-python: fix startup messages leaking into output
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Remove
workaround for emacs<24.1.  Sleep after starting Python, to prevent
startup messages leaking into output results.
* testing/lisp/test-ob-python.el (test-ob-python/session-multiline):
Remove workaround for startup message leaking into results.
2020-09-06 18:15:04 -07:00
Bastien 74b6860b76 Merge branch 'maint' 2020-09-06 23:36:50 +02:00
Bastien ba2405b12e testing/lisp/test-org-inlinetask.el: Fix test
* testing/lisp/test-org-inlinetask.el
(test-org-inlinetask/folding-directly-consecutive-tasks/1): Fix
test.

This test was broken by ee3c3b55.
2020-09-06 23:35:32 +02:00
Bastien 15a6836e4f ob-core.el: Fix `org-babel--string-to-number'
* lisp/ob-core.el (org-babel--string-to-number): Exclude strings
not matching "^[0-9-e.+ ]+$" from being interpreted as numbers.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
https://orgmode.org/list/CAFyQvY14iek+op12Vm7+jrniGEVU2yha7kuPtNtFQAso6d=PjQ@mail.gmail.com/
2020-09-06 22:41:21 +02:00
Bastien 3e191242dc Fix tests wrt 2f53429413
* testing/lisp/test-ob.el (test-ob/inline-src_blk-default-results-replace-line-1)
(test-ob/just-one-results-block)
(test-ob/org-babel-remove-result--results-default)
(test-ob/specific-colnames): Fix tests.

* testing/lisp/test-ob-tangle.el (ob-tangle/comment-links-at-left-margin): Ditto.

* testing/lisp/test-ob-shell.el (ob-shell/generic-uses-no-arrays)
(ob-shell/bash-uses-arrays)
(ob-shell/generic-uses-no-assoc-arrays)
(ob-shell/bash-uses-assoc-arrays, ob-shell/simple-list): Ditto.

* testing/lisp/test-ob-exp.el (ob-exp/exports-inline)
(ob-exp/exports-inline-code): Ditto.

* testing/examples/ob-shell-test.org (Generic shell: no arrays)
(Bash shell: support for arrays)
(Generic shell: no special handing)
(Bash shell: support for associative arrays)
(Generic shell: no special handing)
(Bash shell: support for associative arrays with lists): Ditto.
2020-09-06 22:37:32 +02:00
Bastien 612f4db090 ob-shell.el: Fix previous commit
* lisp/ob-shell.el (org-babel-execute:shell)
(org-babel-sh-evaluate): Use the value only when value is set or
when no :result is set.
2020-09-06 22:35:28 +02:00
Bastien 2f53429413 ob-shell.el: Use the exit status as the default result
* lisp/ob-shell.el (org-babel-execute:shell)
(org-babel-sh-evaluate): Use the exit code as the value and,
consequently, as the result when no :results header is set.

See this thread:
https://orgmode.org/list/CA+A2iZaziAfMeGpBqL6qGrzrWEVvLvC0DUw++T4gCF3NGuW-DQ@mail.gmail.com/

And Tim's useful summary here:
https://orgmode.org/list/87sgiszqc1.fsf@gmail.com/

This commit resolves the issue by deciding not to make an exception
for ob-shell.el:

- the "value" of executing a shell/bash script is the exit code
- when no :results header is set, use the value as the result
- use :results output to use the stdout
2020-09-06 19:12:22 +02:00
Bastien d03a52d37b Merge branch 'maint' 2020-09-06 12:02:41 +02:00
Bastien 73a78c2518 Revert "org.el (org-add-planning-info): Use caller's `org-time-was-given' value"
This reverts commit c7abcd514a.
2020-09-06 12:01:54 +02:00
Bastien ec80dd6c17 Merge branch 'maint' 2020-09-06 11:59:31 +02:00
Bastien 15e2d83313 ob-sqlite.el: Inhibit Lisp evaluation when reading the result
* lisp/ob-sqlite.el (org-babel-sqlite-table-or-scalar): Inhibit
Lisp evaluation when reading the result.

Reported-by: rrandresf@gmail.com
2020-09-06 11:58:53 +02:00
Bastien 9a2e22d87a Merge branch 'maint' 2020-09-06 11:50:36 +02:00
Bastien 989f50a53b ob-java.el: Inhibit Lisp evaluation when reading the result
* lisp/ob-java.el (org-babel-execute:java): Inhibit Lisp
evaluation when reading the result.

Reported-by: Jarmo Hurri <jarmo.hurri@iki.fi>
2020-09-06 11:48:20 +02:00
Bastien f0a9677d90 ob-core.el: Silence byte-compiler 2020-09-06 11:27:11 +02:00
Bastien d50823be14 fixup! Merge branch 'maint' 2020-09-06 10:05:43 +02:00
Bastien 1170e39bea org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers
* lisp/org/org-crypt.el (org-encrypt-entry, org-decrypt-entry): Skip
  _all_ meta data before looking for PGP content.

TINYCHANGE
2020-09-06 10:05:31 +02:00
Trevor Murphy c93983613d org-crypt.el: Fix encrypt/decrypt in presence of arbitrary drawers
* lisp/org/org-crypt.el (org-encrypt-entry, org-decrypt-entry): Skip
  _all_ meta data before looking for PGP content.

TINYCHANGE
2020-09-06 10:00:34 +02:00
Bastien 55d1d32f5e org.el: Tiny docstring fixes
* lisp/org.el (org-keyword-regexp, org-ctrl-k-protect-subtree)
(org-priority-default, org-fast-tag-selection-single-key)
(org--check-org-structure-template-alist)
(org-after-todo-statistics-hook, org-log-note-effective-time)
(org-occur, org-days-to-iso-week, org-ctrl-c-ctrl-c-hook)
(org-ctrl-c-ctrl-c-final-hook, org-ctrl-c-ret, org-mode-restart)
(org-install-agenda-files-menu): Tiny docstring fixes.
2020-09-06 08:14:15 +02:00
Bastien 9410fbe060 Merge branch 'maint' 2020-09-06 07:52:28 +02:00
Bastien 351a0a0b0c org-manual.org: Add a footnote for the difference between C-. and .
* doc/org-manual.org (The date/time prompt): Add a footnote for
the difference between `C-.' and `.' in the date prompt.

See <https://orgmode.org/list/20200905161804.3inpmz5o3nensyna@gmail.com>
2020-09-06 07:46:47 +02:00
Kyle Meyer d4f48821c1 Merge branch 'maint' into master 2020-09-05 23:41:50 -04:00
Kyle Meyer 799e5dac92 org.el: Silence byte-compiler
* lisp/org.el (org-optimize-window-after-visibility-change): Drop
unused let-binding added in a8e812e60.
2020-09-05 23:39:56 -04:00
Kyle Meyer e535da6e4f ob-core: Avoid duplicate body expansion logic
* lisp/ob-core.el (org-babel--expand-body): New function.
(org-babel-check-confirm-evaluate):
(org-babel-execute-src-block): Use org-babel--expand-body.

As of 727c6d7fe (lisp/ob-core.el: org-babel-check-confirm-evaluate
strip coderefs, 2020-09-04), org-babel-check-confirm-evaluate and
org-babel-execute-src-block use the same logic to expand the body and
strip coderefs.  Move that code to a helper function.

This patch is functionally equivalent to the patch originally proposed
by Tom Gillespie at
https://orgmode.org/list/CA+G3_PNi3uMvBiWgBdKuC3C6VJt1T1j-RKH43LRqYbr+4NS8ZA@mail.gmail.com
2020-09-05 23:39:08 -04:00
Kyle Meyer f24c3d11cc ob-core: Test that org-confirm-babel-evaluate does not see coderefs
* testing/lisp/test-ob.el (test-ob/check-eval-noweb-expanded): Add
test.

With df5a83637 (ob-core: Call org-confirm-babel-evaluate with expanded
noweb refs, 2020-08-02), org-confirm-babel-evaluate gets called with
an expanded body and coderefs.  As of the last commit, the coderefs
are stripped.

Cf: https://orgmode.org/list/CA+G3_PPYS2KAaXiBDeujTTpswCTzTuJRQsXwaji1MuRoc8N7vw@mail.gmail.com
2020-09-05 23:38:43 -04:00
Tom Gillespie 3e1c0b0f44 lisp/ob-core.el: org-babel-check-confirm-evaluate strip coderefs
* lisp/ob-core.el (org-babel-check-confirm-evaluate): strip coderefs
before passing the body of the block to org-confirm-babel-evaluate
using the same let block as is used in org-babel-execute-src-block.
2020-09-05 23:38:35 -04:00
Bastien 7e895baaba Merge branch 'maint' 2020-09-05 17:59:07 +02:00
Nicholas Vollmer c7abcd514a org.el (org-add-planning-info): Use caller's `org-time-was-given' value
* lisp/org.el (org-add-planning-info): Fix bug by not ignoring the
caller's `org-time-was-given' value.

See <https://orgmode.org/list/87zh6rfvmi.fsf@gmail.com>

TINYCHANGE
2020-09-05 17:54:46 +02:00
Bastien c09518b5f6 org.el (org-read-date-display-live): Enhance docstring
* lisp/org.el (org-read-date-display-live): Document that live
display is only available when `org-read-date-popup-calendar' is
non-nil.

See <https://orgmod.org/list/20200630180259.zj3krk57x5iqmbsj@orion>

Reported-by: Edmund Christian Herenz <eherenz@eso.org>
2020-09-05 17:33:04 +02:00
Bastien 479e09a8e2 Merge branch 'maint' 2020-09-05 16:41:03 +02:00