Commit Graph

26245 Commits

Author SHA1 Message Date
Ihor Radchenko 1a6d5f11d0
Merge branch 'bugfix' 2023-03-29 16:59:01 +02:00
Ihor Radchenko 638e0ecc0b
Fix some compiler warnings
* lisp/org.el (org-remove-timestamp-with-keyword): Use `delete-char'
instead of for-interactive-use-only `backward-delete-char'.
(org-fast-tag-selection): Remove unnecessary `condition-case'.
(org-delete-backward-char): Make it explicit that we fall back to
normal interactive call.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62518
2023-03-29 16:58:43 +02:00
Ihor Radchenko f53205a443
org-export-data: Clarify that filters are not applied
* lisp/ox.el (org-export-data): Clarify the docstring.
2023-03-29 16:34:11 +02:00
Ihor Radchenko c1bb68ab9d
ox: Make export errors more prominent
* lisp/ox-html.el (org-html-fontify-code):
* lisp/ox-latex.el (org-latex-generate-engraved-preamble):
(org-latex-inline-src-block):
(org-latex-src-block):
(org-latex-src--engrave-code):
* lisp/ox-odt.el:
(org-odt--table):
(org-odt--translate-latex-fragments):
(org-odt--export-wrap): Use `warn' instead of `message' when external
dependency/tool is missing/fails.
2023-03-29 16:30:41 +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 05ae268973
org-fold-show-children: Only display direct children by default
* lisp/org-fold.el (org-fold-show-children): Clarify the docstring
emphasizing that direct children are always displayed.  Fix
grandchildren being displayed when the first child has deeper level
than the next children.
2023-03-29 14:58:28 +02:00
Ihor Radchenko e80ba42d62
Merge branch 'bugfix' 2023-03-27 13:14:02 +02:00
Stephen J. Eglen 1e38519b02
doc/org-manual.org: Document `org-hide-emphasis-markers'
* doc/org-manual.org (Emphasis and Monospace): Document
`org-hide-emphasis-markers'.
2023-03-27 13:12:59 +02:00
Stephen J. Eglen fcd813c406
lisp/org.el: Docstring fixes
* lisp/org.el (org-hide-emphasis-markers)
(org-hide-macro-markers)
(org-pretty-entities-include-sub-superscripts): Follow elisp
convention for docstrings: 'Non-nil means ...'.
2023-03-27 13:11:08 +02:00
Ihor Radchenko c1e8e2ffc7
Update version number for the 9.6.2 release 2023-03-26 11:33:48 +02:00
Ihor Radchenko 44e1cbb094
org-compile-file: Fix when `org-batch-test' is not defined
* lisp/org-macs.el (org-compile-file): Avoid error when
`org-batch-test' is not defined.
2023-03-24 14:59:36 +01:00
Ihor Radchenko 866ed1a3c5
org-babel-comint-with-output: Fix edge case for partial prompts
* lisp/ob-comint.el (org-babel-comint-with-output): Do not try to
filter out prompts in `comint-output-filter-functions'.  The prompts
may arrive there arbitrarily - multiple prompts together, partial
prompts, full prompts, etc.  For example "ghci> " prompt may arrive as
"gh" + "ci> " with second part still matching `comint-prompt-regexp'.
As a result, if we keep using `comint-output-filter-functions', the
split prompts may sometimes retain their initial part, littering the
results.  Now, we postpone filtering to after receiving the output,
still making sure that agglomerated prompts gets filtered using a
custom regexp derived from `comint-prompt-regexp'.
2023-03-24 11:15:58 +01:00
Ihor Radchenko a8a516ba33
org-babel-comint-with-output: Handle agglomerated prompts better
* lisp/ob-comint.el (org-babel-comint-with-output): Consider that
comint can sometimes agglomerate multiple prompts together even within
a single output increment as passed to
`comint-output-filter-functions'.

Example in GHC comint buffer:

GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> ghci> :{
main :: IO ()
main = putStrLn "Hello World!"
:}

main
"org-babel-haskell-eoe"
ghci| ghci| ghci| ghci> ghci> Hello World!
ghci> "org-babel-haskell-eoe"
ghci>
2023-03-24 10:46:05 +01:00
Matthew Trzcinski 6c9104f59c etc/ORG-NEWS: Announce :async header in ob-shell.el 2023-03-23 15:30:31 -04:00
Ihor Radchenko 03d15dd724
org-logind-dbus-session-path: Fix CI tests failure
* lisp/org-clock.el (org-logind-dbus-session-path): Do not try to use
dbus when `dbus-call-method' errs.

`dbus-call-method' may throw
Debugger entered--Lisp error: (dbus-error "org.freedesktop.login1.NoSessionForPID" "PID 7361 does not belong to any known session")
Do not try to use dbus method in such scenario.

Link: https://builds.sr.ht/~bzg/job/961763
2023-03-23 13:47:38 +01:00
Daniel Kraus 880782660a
ob-clojure.el: Reword docstring for ob-clojure-eval-with-cider
* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Mention in the
docstring that the Babel params argument is not used anymore.
2023-03-23 13:25:15 +01:00
Aaron L. Zeng 04087be6b3
lisp/org.el: Make predicates non-interactive
* lisp/org.el (org-at-date-range-p):
(org--math-p):
(org-first-sibling-p): Remove interactive spec.

Predicates like `org-first-sibling-p' are no use when called
interactively, and should not appear in the M-x prompt.

TINYCHANGE
2023-03-23 12:59:27 +01:00
Nathaniel Nicandro 693df6fd90
lisp/org-clock.el: Add support for logind
* lisp/org-timer.el (org-logind-dbus-session-path): New variable.
(org-logind-user-idle-seconds): New function.
(org-user-idle-seconds): Use them.
* etc/ORG-NEWS (Add support for ~logind~ idle time in
~org-user-idle-seconds~): Document the new feature.
2023-03-23 12:43:30 +01:00
Matthew Trzcinski f7aa8c19f5 ob-shell.el: Add async evaluation
* ob-shell.el (org-babel-sh-evaluate): Add condition for async within
session.  Allow :async header argument to be either t or blank.

* test-ob-shell.el:
(test-ob-shell/session-async-valid-header-arg-values): Check that
:async header works for both t and blank values.
(test-ob-shell/session-async-inserts-uuid-before-results-are-returned):
Check that UUID is used as placeholder until results return.
(test-ob-shell/session-async-evaluation): Check that asynchronously
evaluated results are eventually placed in the buffer.

Link: https://list.orgmode.org/186283d230a.129f5feb61660123.3289004102603503414@excalamus.com/
2023-03-22 14:55:11 -04:00
Matthew Trzcinski 180c1c37a9 ob-comint.el: Fix off-by-one error in async result
* ob-comint.el (org-babel-comint-async-filter): Fix region returned
after async calculation completes so that the trailing prompt ends in
a space.

Link: https://list.orgmode.org/18705dca9b8.f4f7e70c165671.6021704484862511260@excalamus.com/
2023-03-22 14:25:51 -04:00
Matthew Trzcinski cb95d88936 ob-R.el/ob-python: Update `md5' calls to `org-id-uuid'
* ob-R.el (ob-session-async-org-babel-R-evaluate-session): Use
`org-id-uuid' instead of `md5' as results placeholder.

* ob-python.el (org-babel-python-async-evaluate-session): Use
`org-id-uuid' instead of `md5' as results placeholder.
2023-03-22 14:20:47 -04:00
Matthew Trzcinski 5a52ee57d4 org-macs.el: Move UUID related code
* org-id.el (org-id-uuid): Move to org-macs.el.

* org.el (org-uuidgen-p): Move to org-macs.el.  Expose regexp used to
match UUID.

* org-macs.el (org-uuid-regexp): Refactor `org-uuidgen-p' to expose
regexp used to match UUID.
2023-03-22 14:08:08 -04:00
Ihor Radchenko 20b33106cd
org-element-headline-parser: Fix empty headings with tags
* lisp/org-element.el (org-element-headline-parser): Allow empty title
with tags.  Do not consider space after COMMENT to be a part of title.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add tests.

Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87zg8t4zgo.fsf@localhost
2023-03-22 16:08:32 +01:00
Ihor Radchenko 93bf820384
org-element-headline-parser: Treat "* TODO" as empty title + TODO keyword
* lisp/org-element.el (org-element-headline-parser): Allow end of line
instead of space after todo keyword.
*
testing/lisp/test-org-element.el (test-org-element/headline-todo-keyword):
Add new test.
2023-03-22 15:52:24 +01:00
Daniel Kraus cd2355a204
ob-clojure.el: Fix compiler warning
* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Silence compiler
warning about unused argument 'params'.
2023-03-19 21:39:07 +01:00
Ihor Radchenko a645a6d679
Merge branch 'bugfix' 2023-03-19 14:06:34 +01:00
Ihor Radchenko 4c01eba265
org-texinfo-supports-math-p: Fix CI test failures
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Consider
compilation error as indication that math is not supported.  texinfo
compiler throws "unknown command `displaymath'" error in such case,
causing `org-texinfo-compile' to err as well.

Fixes CI tests failures when testing with Texinfo versions with no
math support.

https://builds.sr.ht/~bzg/job/959487
2023-03-19 13:58:07 +01:00
Ihor Radchenko 533a83a989
org-compile-file: Expose logs when running Org tests
* lisp/org-macs.el (org-compile-file): Output logs on failure when
running Org test suite.  This is useful to expose more information in
CI tests.
2023-03-19 11:10:04 +01:00
Max Nikulin 07ea7fc443
org-manual.org: $n$-th is not math
* doc/org-manual.org (LaTeX fragments): Do not state that dash is
allowed after single "$" math delimiter and recommend "\(...\)".

Detection of "$-" as closing math delimiters has been broken since 2015
as a side effect of using punctuation class in regular expressions while
dash is considered as a word constituent.  See commits
6779f8f424 and c0369a7984.  Bring the manual in accordance to the code
instead of allowing "($-2 change)" false positives.  Users who do not
like "\(...\)" constructs may use a helper for typing it and may change
how it is displayed to minimize visual noise by fontification, see

- Eric S Fraga to emacs-orgmode. Re: Depreciating TeX-style LaTeX
  fragments. Sun, 16 Jan 2022 12:10:30 +0000.
  <https://list.orgmode.org/87k0ezdgp5.fsf@ucl.ac.uk>
- Ihor Radchenko to emacs-orgmode. Re: [PATCH] Add support for $…$ latex
  fragments followed by a dash. Thu, 27 Jan 2022 16:28:10 +0800.
  <https://list.orgmode.org/87r18t7fc5.fsf@localhost>
2023-03-18 13:19:40 +01:00
Ihor Radchenko 6bf8e44d3f
Merge branch 'bugfix' 2023-03-18 13:03:31 +01:00
Ihor Radchenko 92471e5303
org-agenda-run-series: Fix `org-agenda-list' call
* lisp/org-agenda.el (org-agenda-run-series): Fix arguments in the
call.  "agenda*" should include appointments and thus HOURS argument
should be non-nil.  See `org-agenda' for analogous call.
2023-03-18 13:01:58 +01:00
Ihor Radchenko 3b9ffc6868
org-latex-export-to-latex: Use nil arg for `write-region'
* lisp/ox.el: Use BEG=nil instead of explicit arguments to
`write-region'.  This simplifies the code.
2023-03-18 12:33:15 +01:00
Ihor Radchenko 4cad6c8eaf
* lisp/Makefile: Remove references to org-contrib
Since org-contrib is now a separate package, the parts of Makefile
that are referring to it are no longer needed.
2023-03-16 13:34:34 +01:00
Daniel Kraus 6efb073463
ob-clojure.el: Fix results output, support clojure-cli
* lisp/ob-clojure.el (org-babel-clojure-backend): Add support for
clojure-cli.
* lisp/ob-clojure.el (org-babel-clojurescript-backend): Move nbb to
clojurescript.
* lisp/ob-clojure.el (org-babel-expand-body:clojure)
* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Return only the
last expression when :results is not set or value, and return only
stdout when :results is set to output.
* lisp/ob-clojure.el (ob-clojure-eval-with-cmd): Rename function as
it is not only for babashka.
* lisp/ob-clojure.el (org-babel-execute:clojure): Differentiate
between Clojure and ClojureScript source blocks.

The problem was that the ob-clojure results where not correctly
taking the results parameter into account.
E.g. with the cider backend, you would get all printed or returned
values for each line in your block:

(def small-map {:a 2 :b 4 :c 8})
{:some :map}
(prn :xx)
(:b small-map)

| #'user/small-map |
| {:some :map}     |
| 4                |

or for babashka you would only get the printed values but not the
last return value:
(def small-map {:a 2 :b 4 :c 8})
{:some :map}
(prn :xx)
(:b small-map)

: :xx

Now when you specify :results value, the result is only the last
returned value, and with :results output you get all values
printed to stdout.
So the examples above would all result in the same:
(def small-map {:a 2 :b 4 :c 8})
{:some :map}
(prn :xx)
(:b small-map)

: 4
2023-03-16 11:25:41 +01:00
Ihor Radchenko 635a601dd5
org-self-insert-command: Do not trigger folding checks
* lisp/org.el (org-self-insert-command): Do not trigger folding checks
for interactive edits.
2023-03-15 15:18:23 +01:00
Ihor Radchenko 0e7b5626ef
Merge branch 'bugfix' 2023-03-14 14:51:57 +01:00
Ihor Radchenko 6fc420167c
org-persist: Fix file path calculation
* lisp/org-persist.el (org-persist-read:file):
(org-persist-read:url): Use `org-file-name-concat' instead of simple
`concat'.
2023-03-14 14:45:00 +01:00
Ihor Radchenko d2e8a118f6
Merge branch 'bugfix' 2023-03-14 13:21:28 +01:00
Pedro Andres Aranda Gutierrez 3eb51d8dbc
* lisp/ox-latex.el (org-latex-generate-engraved-preamble): Fix typo 2023-03-14 13:20:29 +01:00
Ihor Radchenko 3d04af3826
org-latex-paragraph: Ensure that paragraphs are not split by empty lines
* lisp/ox-latex.el (org-latex-paragraph): If export creates single
paragraph contents with empty lines, remove the empty lines to ensure
that we retain a single paragraph.

Reported-by: Max Nikulin <manikulin@gmail.com>
Link: https://orgmode.org/list/tufdb6$11h2$1@ciao.gmane.io
2023-03-14 13:11:37 +01:00
Ihor Radchenko 5f817f21fc
Merge branch 'bugfix' 2023-03-12 12:25:39 +01:00
Xi Lu a8006ea580
* lisp/ob-latex.el: Fix command injection vulnerability
(org-babel-execute:latex):
Replaced the `(shell-command "mv BAR NEWBAR")' with `rename-file'.

TINYCHANGE
2023-03-12 12:23:46 +01:00
Tim Ruffing f5987b37d4
Don't reset `org-todo-keywords-for-agenda' when org-agenda-multi
* org-agenda.el (org-prepare-agenda): Don't reset
`org-todo-keywords-for-agenda' when org-agenda-multi.

Fixes a bug with TODO keywords that came to light in org-modern,
see https://github.com/minad/org-modern/issues/26.

This is very similar to cd2d138883,
which fixed the same for `org-done-keywords-for-agenda` (to fix
a similar styling issue).

TINYCHANGE
2023-03-11 11:18:52 +01:00
Ihor Radchenko d6e75d0eeb
org-read-date: Do not consider `org-extend-today-until' with default time
* lisp/org.el (org-read-date): When DEFAULT-TIME time provided, prefer
it even when `org-extend-today-until' dictates -1 day shift.  We
should only consider `org-extend-today-until' for actual today times,
not for future dates, where is becomes confusing.

Reported-by: Tim Ruffing <crypto@timruffing.de>
Link: https://orgmode.org/list/3489c1917ad4be0625ea5f0b2c1b0f2b72ea39e9.camel@timruffing.de
2023-03-11 10:30:15 +01:00
Ihor Radchenko 6ab611720d
Merge branch 'bugfix' 2023-03-10 12:10:47 +01:00
Ihor Radchenko dd25e2704f
org-src--construct-edit-buffer-name: Fix docstring
* lisp/org-src.el (org-src--construct-edit-buffer-name): Fix the
docstring to conform to the existing buffer name pattern.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/20230302140224.6169-1-salutis@me.com
2023-03-10 12:08:44 +01:00
Ihor Radchenko 8589de94d8
Merge branch 'bugfix' 2023-03-07 14:09:48 +01:00
Rudolf Adamkovič eb6379a417
Fix LaTeX spelled as Latex
etc/ORG-NEWS (Non-floating minted listings in LaTeX export):
* lisp/ob-latex.el: (org-babel-execute:latex):
* lisp/org-element.el:
* lisp/ox-ascii.el:
* lisp/ox-html.el:
* lisp/ox-latex.el:
* lisp/ox-md.el:
* lisp/ox-odt.el:
* testing/examples/ob-maxima-test.org (LaTeX output):
* testing/lisp/test-org-element.el (test-org-element/cache): Spell LaTeX
correctly.
2023-03-07 14:08:40 +01:00
Rudolf Adamkovič 4f6bf89547
Fix BibTeX spelled as Bibtex
* lisp/ol-bibtex.el: Spell BibTeX correctly
* etc/ORG-NEWS (Org-BibTeX -- major improvements): Spell BibTeX correctly
2023-03-07 14:06:01 +01:00