Commit Graph

26470 Commits

Author SHA1 Message Date
Ihor Radchenko cd10999e7d
Merge branch 'bugfix' 2023-04-11 12:26:15 +02:00
Ihor Radchenko 60ce29dc41
org-odt-plain-text: Fix when text contains leading spaces
* lisp/ox-odt.el (org-odt-plain-text): Do not count leading spaces
twice.

Reported-by: Damien Cassou <damien@cassou.me>
Link: https://orgmode.org/list/87v8i3y135.fsf@cassou.me
2023-04-11 12:25:13 +02:00
Ihor Radchenko 56dd046da8
* doc/org-manual.org: Add a link to Diary section of Emacs manual
(Timestamps): Add a link to Emacs manual when explaining diary style
sexp timestamps.

Reported-by: David Masterson <dsmasterson@gmail.com>
Link: https://orgmode.org/list/SJ0PR03MB5455892B11B07344346194B9A2959@SJ0PR03MB5455.namprd03.prod.outlook.com
2023-04-10 19:22:49 +02:00
Ihor Radchenko 8dd1cc04d0
Merge branch 'bugfix' 2023-04-09 13:16:38 +02:00
Ihor Radchenko 072ddbc975
org-element-cache: Disable extra consistency checks
* lisp/org-element.el (org-element--cache-self-verify): Switch to nil
by default, disabling costly cache self-verification.  This is
relatively safe as no relevant bug reports have been submitted for a
while.  Also, the most critical cache failures are still monitored.
2023-04-09 13:13:25 +02:00
Ihor Radchenko ddd8281e62
lisp/org.el: Allow limiting inline image width
* lisp/org.el (org-image-max-width): New custom variable controlling
max inline image width.
(org--create-inline-image): Use the new variable.
* doc/org-manual.org (Images):
* etc/ORG-NEWS (New customization ~org-image-max-width~ limiting the
displayed inline image width): Document the new variable.
2023-04-09 10:55:50 +02:00
Ihor Radchenko 2ad8a45f00
test-ob-fortran: Enable and fix commented tests
* testing/lisp/test-ob-fortran.el (ob-fortran/wrong-list):
(ob-fortran/compiler-flags): Uncomment the tests, making sure that
error buffer is displayed.
2023-04-08 14:56:08 +02:00
Ihor Radchenko 28d41e69d7
Merge branch 'bugfix' 2023-04-07 12:37:40 +02:00
Aaron L. Zeng 19b0d0e5aa
org-table: Fix incorrect input when used with evil-escape
* org-table.el (org-self-insert-command): Use `last-command-event'
instead of `last-input-event'.  Using `last-input-event' causes
problems in the presence of `evil-escape'.  Consider a buffer that has
`orgtbl-mode' enabled while evil-escape is in use.  Assume the
evil-escape sequence is "fd".  Typing "f RET" will instead insert "RET
RET" into the buffer, since `last-input-event' is "RET", but
`last-command-event' is "f".

TINYCHANGE
2023-04-07 12:35:43 +02:00
Aaron L. Zeng 54a743cd72
org-table: Refactor away unnecessary variable
* org-table.el (orgtbl-self-insert-command): Remove unnecessary
intermediate variable.  `(cdr nil)` is nil.

TINYCHANGE
2023-04-07 12:35:42 +02:00
Nathaniel Nicandro 616e80a9f1
Handle block-type when checking `org-src-fontify-natively`
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Only fontify
  natively for blocks of src type.
2023-04-07 12:12:10 +02:00
Ihor Radchenko 8fab6eeef2
org-agenda: Rename sorting "priority" to "urgency"
* lisp/org-habit.el (org-habit-get-priority): Rename to
`org-habit-get-urgency'.
* lisp/org-compat.el (org-habit-get-priority): Obsolete the old name.
* lisp/org-agenda.el (org-agenda-sorting-strategy):
* lisp/org-agenda.el (org-search-view):
(org-agenda-get-todos):
(org-agenda-get-timestamps):
(org-agenda-get-progress):
(org-agenda-get-deadlines):
(org-agenda-get-scheduled):
(org-agenda-get-blocks):
(org-entries-lessp): Alter priority-up and priority-down sorting
strategies to only sort by actual priority.  Rename the previous
composite sorting rank to urgency, corresponding to the new urgency-up
and urgency-down sorting strategies.  Store the new rank in 'urgency
text property.  Update the docstrings accordingly.  Use `urgency-down'
in place of `priority-down' in the default sorting strategy.
(org-set-sorting-strategy): Use `urgency-down' in place of
`priority-down'.
* etc/ORG-NEWS ("Priority" used to sort items in agenda is renamed to
"urgency"): Document the change.
* doc/org-manual.org (Sorting of agenda items): Update manual using
"urgency" term in place of confusing "priority".

Thanks to Samuel Wales for the idea how to fix the inconsistency.

Reported-by: Jonas Olofsson <jonas.olofsson@apple.com>
Link: https://orgmode.org/list/26396316-1201-4D88-9D81-C87DDDA8885A@apple.com
2023-04-06 11:40:30 +02:00
Feraidoon Mehri 5e9953fa0e
ox.el: Refactor ID prefixes
* lisp/ox-html.el (org-html--id-attr-prefix):
* lisp/ox-odt.el (org-odt--id-attr-prefix): Refactor hardcoded "ID-"
as a new private variable.

* org/ox-html.el (org-html--reference): Add support for the ID
property (previously only supported CUSTOM_ID).

These changes make crossfile ID links work in the exported HTML when
`org-html-prefer-user-labels' is not-nil.
2023-04-05 11:22:32 +02:00
Ihor Radchenko 614b96f910
org-lint: Add checker for numbered list item numbers
* lisp/org-lint.el (org-lint-item-number): New checker to ensure
consistency between item bullet text and the counter Org will use when
exporting.
2023-04-04 12:05:03 +02:00
Jack Kamm e10b4054e6 ox-icalendar: Use consistent CRLF line endings
Fixes issue where the ox-icalendar export uses an inconsistent mix of
dos and unix style line endings.

* lisp/ox-icalendar.el (org-icalendar-fold-string): No longer converts
to CRLF, instead delegating that to `org-icalendar--post-process-file'.
(org-icalendar--post-process-file): New function to handle exported
file post-processing.  Converts EOL to CRLF, and then runs
`org-icalendar-after-save-hook'.
(org-icalendar-export-to-ics, org-icalendar-export-current-agenda,
org-icalendar--combine-files): Call `org-icalendar--post-process-file'
instead of running `org-icalendar-after-save-hook' directly.
* testing/lisp/test-ox-icalendar.el: New file for unit tests of
ox-icalendar.  Add an initial test for CRLF line endings.

See also:

https://list.orgmode.org/87o7oetneo.fsf@localhost/T/#m3e3eb80f9fc51ba75854b33ebfe9ecdefa2ded24

https://list.orgmode.org/orgmode/87ilgljv6i.fsf@localhost/
2023-04-02 13:20:56 -07:00
Ihor Radchenko 9ca271c406
org-export: Display warning when code block results cannot be computed
* lisp/ob-exp.el (org-babel-exp-results): Display warning when babel
does not know how to execute exported code block and :results
demands results to be exported.
2023-04-02 17:04:43 +02:00
Ihor Radchenko c316476ee9
org-export: Be less aggressive with window configuration in export dispatch
* lisp/ob-exp.el (org-babel-exp-process-buffer): Do not use
`save-window-excursion'.
* lisp/ox.el (org-export-dispatch):
(org-export--dispatch-ui): Use `save-window-excursion' only when
displaying the dispatch interface.
2023-04-02 17:00:06 +02:00
Ihor Radchenko c2ffc6b602
org-fontify-meta-lines-and-blocks-1: Fontify src blocks without lang
* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Allow fontifying
src blocks with language specification missing.
* lisp/org-src.el (org-src-block-faces): Clarify in the docstring that
"" language name referes to src blocks with no language.  Remove
redundant :version tag.
* etc/ORG-NEWS (~org-src-block-faces~ now accepts empty string ~""~ as
language name): Announce the change.

Link: https://orgmode.org/list/99388ff3711696091f0312a5c3f0bcbd@kragelund.me
2023-04-02 16:32:00 +02:00
Ihor Radchenko 2289739ed4
Prefer `write-region' to `save-file'
* lisp/ob-haskell.el (org-babel-haskell-export-to-lhs): Use
non-interactive `insert-file-contents' + `write-region' to avoid
triggering various interactive hooks.  Ensure that temp files are
always deleted.
* lisp/org-agenda.el (org-agenda-write):
* lisp/org-table.el: Simplify code using `write-region'.
* lisp/ox-odt.el (org-odt-template): Use `insert-file-contents' +
`write-region' instead of `find-file-noselect' that may trigger
various hooks.  The new approach makes `revert-buffer' not
necessary (and do not trigger `revert-buffer' hooks).  Also, the
problem with backups will no longer exists.

Original idea: https://list.orgmode.org/orgmode/20221002035931.12191-1-dafydd.lukes@gmail.com/
2023-04-02 16:25:44 +02:00
Ihor Radchenko 6f742685d7
org-metaup: Fix edge case when the upper subtree is moved further below
* lisp/org.el (org-metaup): Work around `org-move-subtree-down'
inserting before end marker.

Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/2248cb94-e400-08c7-b76b-bbae2d877ca7@gmail.com
2023-04-02 16:16:06 +02:00
Ihor Radchenko 15e70240e9
org-manual.org: Clarify what SETUPFILE does
* doc/org-manual.org (Summary of In-Buffer Settings): Clarify that
only in-buffer settings are considered in SETUPFILE.  Other contents
is ignored.  Split the explanation into multiple paragraphs.

Reported-by: Bruno BEAUFILS <bruno.beaufils@univ-lille.fr>
Link: https://orgmode.org/list/20230216235224.7g5xdlkcnw2z4k3n@settat
2023-04-02 15:58:04 +02:00
Ihor Radchenko f2949d4d1d
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-04-02 12:15:10 +02:00
Ihor Radchenko 7fa9e9a4b3
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-04-02 12:15:06 +02:00
Ihor Radchenko f9bbc79d62
Update version number for the 9.6.3 release
This release is mostly a bugfix for 9.6.2 release tag, which was not
signed and was not annotated.  See
https://orgmode.org/worg/org-maintenance.html#release-tags
2023-04-02 10:36:55 +02:00
Jack Kamm e46811c5e1 ob-python: Allow working with externally started sessions again
* lisp/ob-python.el (python-shell-buffer-name): Remove unneeded
defvar.
(org-babel-python-initiate-session-by-key): Check if session already
existed before run-python.  Only wait for initialization if it's a
newly started session.  Also simplify the code a bit by combining
multiple setq and let statements into a single let statement.  Also
add a comment about why adding to `python-shell-first-prompt-hook'
after `run-python' should be safe from race conditions.
2023-03-31 09:11:42 -07:00
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