Commit graph

18734 commits

Author SHA1 Message Date
TEC 00abdca361
oc-csl: Recognise ¶/§ entity locators
* lisp/oc-csl.el: Recognise org-entity based paragraph and section
locators "\P" and "\S".
2023-04-13 09:02:58 +02:00
TEC 0f62e9771b
org-entities: Treat ¶ similarly to §
* lisp/org-entities.el: Treat pilcrows / paragraph symbols similarly to
section symbols (§), move them next to each other and add a \P entity.
2023-04-13 09:02:58 +02:00
TEC cd53816c3a
org-entities: § is a section sign, not paragraph
* lisp/org-entities.el: Correct the ASCII version of § to be "section",
not "paragraph".
2023-04-13 09:02:57 +02:00
Ihor Radchenko 00fb0a0b33
Merge branch 'bugfix' 2023-04-13 09:02:47 +02:00
TEC 6a96054f05
ob-tangle: Edit default file mode to match docstr
* lisp/ob-tangle.el (org-babel-tangle-default-file-mode): The docstring
states that it the default value is read-write for the user, read only
for everyone else.  This is not consistent with the default value which
is actually read-*execute* for the user, read only for everyone else.
The default value is updated to be read-write for the user, as stated in
the docstring.

Reported-by: Ruijie Yu <ruijie@netyu.xyz>
Link: https://list.orgmode.org/orgmode/sdv3554xtat.fsf@fw.net.yu
2023-04-13 08:59:47 +02:00
TEC 81fc8c06ce
ob-tangle: Fix interpretation of rw-r--r-- modes
* lisp/ob-tangle.el (org-babel-interpret-file-mode): When specifying a
file mode in the "rw-r--r--" style, this is interpreted by splicing the
user, group, and other compenents into a "u=rw,g=r,o=r" style string and
applying `file-modes-symbolic-to-number`.  For correct interpretation,
we need to ensure the dashes are removed in this process.
2023-04-13 08:59:27 +02:00
Ihor Radchenko 5d32058bf9
Merge branch 'bugfix' 2023-04-12 10:58:44 +02:00
Ihor Radchenko 5ac1ebaa15
org-latex--protect-texttt: Fix "---"
* lisp/ox-latex.el (org-latex--protect-texttt): Fix >2 consecutive
dashes.

Reported-by: Garid Zorigoo <garidzorigoo@gmail.com>
Link: https://orgmode.org/list/CAEDgBW44j4NpYUpppLpOA5Pmmsfi-GbCzDH4rTmRjf-F64mSaA@mail.gmail.com
2023-04-12 10:57:34 +02:00
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 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 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 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 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
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
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
Ihor Radchenko 12883765d2
org-babel-import-elisp-from-file: Fix the docstring
* lisp/ob-core.el (org-babel-import-elisp-from-file): Document all the
arguments.
2023-03-07 14:03:02 +01:00
Ihor Radchenko 077c4adabf
Merge branch 'bugfix' 2023-03-07 13:33:18 +01:00
Xi Lu 8f8ec2ccf3
* lisp/ob-latex.el (org-babel-execute:latex): Fix command injection vulnerability
Link: https://orgmode.org/list/tencent_5C4D5D0DEFDDBBFC66F855703927E60C7706@qq.com

TINYCHANGE
2023-03-07 13:26:13 +01:00
Ihor Radchenko e52c531e17
Merge branch 'bugfix' 2023-03-05 13:22:02 +01:00
Rudolf Adamkovič 3d817c52c9
org-clock: Add a trailing space to the mode line string
* lisp/org-clock.el (org-clock-get-clock-string): End the mode line
element in a space, instead of beginning with space, to make it play
well with other mode line strings, which typically end a space.  For
reference, see the mode line string of the Display Time mode.
2023-03-05 13:20:30 +01:00
Ihor Radchenko 1b1d314ada
* lisp/org.el: Bump Org version on development branch 2023-03-05 12:56:02 +01:00
Ihor Radchenko f93cc661c6
org-element-set-contents: Do alter the anonymous parents
* lisp/org-element.el (org-element-set-contents): Do alter anonymous
elements (el1 el2 ...).  Such elements are used, for example, when
parsing keyword values during export, like :title.
* testing/lisp/test-org-element.el (test-org-element/set-contents):
Add test.

The patch fixed bug during export when exporting a subtree with
option stat:nil.  The :title during subtree export is taken from the
heading title and parsed.  However, the parsed value is stored outside
the parse tree, in :title property of the INFO channel.  The parsed
value does get filtered through `org-export--prune-tree', but before
this commit, `org-element-set-contents' did not actually alter the
out-of-AST-tree parent lists of elements.

Reported-by: Leo Butler <Leo.Butler@umanitoba.ca>
Link: https://orgmode.org/list/87mt4w8epo.fsf@t14.reltub.ca
2023-03-03 16:31:37 +01:00
Ihor Radchenko 973669389b
Merge branch 'bugfix' 2023-03-03 15:57:17 +01:00
Gerard Vermeulen e8010e8a91
org.el: Sync org-babel-load-languages with Babel files in Org
* lisp/org.el (org-babel-load-languages): Sync with Babel files

(org-babel-load-languages): Synchronize the defcustom with the rest of
the code base, group languages by Org Babel file, and spell languages
using camel case (the current fashion).

Link: https://list.orgmode.org/712f2ef5b4edb2d9b565f6467e582030@posteo.net/
2023-03-03 15:55:14 +01:00
Ihor Radchenko aa22497876
Merge branch 'bugfix' 2023-02-26 14:43:54 +03:00
Damien Cassou f9aeba5dd7
org.el: Avoid crash in `org-file-contents' in case of network failure
* lisp/org.el (org-file-contents): Wrap the
`url-retrieve-synchronously' call into a `condition-case' block to
avoid throwing an error when NOERROR is non-nil.

TINYCHANGE
2023-02-26 14:42:13 +03:00
Ihor Radchenko 351279ffae
org-diary-to-ical-string: Make sure that temporary file/buffer is cleaned
* lisp/org.el (org-diary-to-ical-string): Clean temporary file buffer
on error.

Reported-by: Alexei Gilev <gerardomoro37@gmail.com>
Link: https://orgmode.org/list/CAF4Fj9gUBj4Ap4noTLP3aSG4owXJ2nydxaqwT4cF5x9DcdhQmg@mail.gmail.com
2023-02-23 12:41:38 +03:00
Ihor Radchenko 2e883b21a7
org-sbe: Allow quoting string values
* lisp/ob-table.el (org-sbe): Allow quoting string values of variables
with "$".  Update the docstring.
* testing/lisp/test-ob-table.el (test-ob-table/sbe): Add test.  Do not
use `org-test-at-id' in favor of more illustrative
`org-test-with-temp-text'.  The latter does not force users to search
the ID in reference Org file.
* testing/examples/babel.org (calling code blocks from inside table):
Remove unused example.

Reported-by: 赵一宇 <zhyznd@163.com>
Link: https://orgmode.org/list/40651be0.3e3b.1867971e644.Coremail.zhyznd@163.com
2023-02-23 12:29:18 +03:00
Ihor Radchenko 236bd45849
Merge branch 'bugfix' 2023-02-22 13:20:47 +03:00
Ihor Radchenko 7a90f596d9
org-clock-timestamps-change: Fix when on opening timestamp
* lisp/org-clock.el (org-clock-timestamps-change): Do not rely on
global `org-last-changed-timestamp'.
*
testing/lisp/test-org-clock.el (test-org-clok/org-clock-timestamps-change):
Add new test.

Reported-by: sting.startup-0y@icloud.com
Link: https://orgmode.org/list/2380D54F-DE06-4CBE-88AC-5906A6E9253A@gmail.com
2023-02-22 13:19:06 +03:00
Ihor Radchenko d94f4066e0
oc-natbib: Provide a fallback bibliography style
* lisp/oc-natbib.el (org-cite-natbib-bibliography-style): New custom
option for default bibliography style.
(org-cite-natbib-export-bibliography): Use the new custom option.
* etc/ORG-NEWS (New ~org-cite-natbib-export-bibliography~ option
defining fallback bibliography style): Document the new option.

If we do not specify a bibliography style, LaTeX export will fail.
After the patch, the following simple-minded Org document will export
without errors:

 #+title: Testing org-cite \LaTeX export
 #+latex_header: \usepackage{natbib}
 #+bibliography: bibliography.bib
 #+options: toc:nil
 #+cite_export: natbib

 Hello World! This is a citation: [cite:@citationkey2023]

 #+print_bibliography:
2023-02-20 16:48:48 +03:00
Ihor Radchenko 747e60629f
org-cycle: Allow intuitively used values of of `org-startup-folded'
* lisp/org-cycle.el (org-cycle-set-startup-visibility): Recognize
`org-startup-folded' set to symbols `fold', `nofold', and `showall'.
They are used as #+STARTUP: option and often tried blindly by users.
2023-02-18 15:31:14 +03:00
Ihor Radchenko fe92a3cedb
Provide a uniform way to inform users about missing third-party packages
* lisp/org-macs.el (org-require-package): New macro trying to load a
library and displaying custom error message or warning on failure.
The actual package (not library) name can be provided as optional
argument.

* lisp/ob-R.el (org-babel-R-initiate-session):
* lisp/ob-clojure.el (ob-clojure-eval-with-inf-clojure):
(ob-clojure-eval-with-cider):
(ob-clojure-eval-with-slime):
* lisp/ob-forth.el (org-babel-forth-session-execute):
* lisp/ob-gnuplot.el (org-babel-execute:gnuplot):
(org-babel-gnuplot-initiate-session):
* lisp/ob-haskell.el (org-babel-interpret-haskell):
(org-babel-haskell-initiate-session):
* lisp/ob-js.el (org-babel-execute:js):
(org-babel-js-initiate-session):
* lisp/ob-julia.el (org-babel-julia-initiate-session):
* lisp/ob-lisp.el (org-babel-execute:lisp):
* lisp/ob-ocaml.el (org-babel-prep-session:ocaml):
* lisp/ob-octave.el (org-babel-octave-initiate-session):
* lisp/ob-processing.el (org-babel-processing-view-sketch):
* lisp/ob-ruby.el (org-babel-execute:ruby):
(org-babel-ruby-initiate-session):
* lisp/ol-bbdb.el (org-bbdb-open):
(org-bbdb-complete-link):
(org-bbdb-anniv-export-ical):
* lisp/org-agenda.el:
* lisp/org-plot.el (org-plot/gnuplot):
* lisp/org.el:
* lisp/ox-ascii.el (org-ascii-table):
* lisp/ox-html.el (org-html-htmlize-generate-css):
* lisp/ox-org.el: Use the new macro.

* lisp/oc-csl.el: Add FIXME. oc-csl uses a custom function doing
similar job.

* lisp/ob-js.el (org-babel-js-initiate-session): Add FIXME noting that
the third-party package is outdated.
2023-02-17 17:09:23 +03:00
Ihor Radchenko 18a146a9d5
org-fold-core-previous-visibility-change: Fix edge case
* lisp/org-fold-core.el (org-fold-core-next-visibility-change): Take
into account that `previous-single-char-property-change' move the
point to the first position where the property is still unchanged.
* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Ignore invisibility when skipping subtree.

Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/96becf12-9a5a-2fc2-0105-a41528be1f66@gmail.com
2023-02-17 14:58:32 +03:00
Ihor Radchenko fff9239dc1
Merge branch 'bugfix' 2023-02-17 13:41:18 +03:00
Ihor Radchenko eea8da0315
Fix some compiler warnings
* lisp/ob-octave.el (org-babel-octave-evaluate-session):
* lisp/org-agenda.el (org-agenda-format-item):
* lisp/org-element.el (org-element-cache-map): Do not use `eq' when
matching for equality by contents.
2023-02-17 13:38:54 +03:00
Rudolf Adamkovič 99c8ed09f8
ox-texinfo: Fix invalid syntax in Texinfo version detection code
* lisp/ox-texinfo.el (org-texinfo-supports-math-p): Fix the incorrect
syntax @displaymath{1 + 1 = 2} used to detect whether Texinfo supports
TeX "math mode".  Instead, use the correct syntax @math{1 + 1 = 2}.
2023-02-17 13:30:16 +03:00
Ihor Radchenko 74eb0f8bc9
Merge branch 'bugfix' 2023-02-15 18:31:04 +03:00
Ihor Radchenko be9280f68b
org-cycle-set-visibility-according-to-property: Fix folded newline before
* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Make sure that folded newline before heading is revealed.

Reported-by: Daniel Hubmann <hubisan@gmail.com>
Link: https://orgmode.org/list/CAOX7s=3NTjpvnFDfwBdozLbLCWANLbCCyCbQNOnNsnMqqFEF3g@mail.gmail.com
2023-02-15 18:28:33 +03:00
Ihor Radchenko 6b0c2775f0
org-persist-associated-files:file: Fix when container has been deleted
* lisp/org-persist.el (org-persist-associated-files:file): Do not err
when `org-persist-read' returns nil (failed to read).
2023-02-14 23:08:58 +03:00
Jack Kamm e6353d5b9c ob-python: Remove debugging print statement
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Remove
old print statement that was added for debugging.
2023-02-11 13:18:09 -08:00
Ihor Radchenko 1f332d6c5c
* lisp/org-clock.el: Remove completed FIXME 2023-02-11 14:55:28 +03:00
Kevin Brubeck Unhammer d2952e14d9
org-clock-clocktable-language-setup: Add a Norwegian translation
* lisp/org-clock.el (org-clock-clocktable-language-setup): Add
Norwegian Nynorsk translation.

Link: https://orgmode.org/list/87k00z1090.fsf@fsfe.org
2023-02-11 14:55:05 +03:00
Kevin Brubeck Unhammer bd34cb3f95
org-export-dictionary: Add Norwegian translations
* lisp/ox.el (org-export-dictionary): Add some translations.

Link: https://orgmode.org/list/87ilgj2jza.fsf@fsfe.org
2023-02-11 14:50:18 +03:00
TEC 02ae908b03
oc: Add org-cite-processor function
* lisp/oc.el (org-cite-processor): As a counterpart to the other cite
information accessor functions, add `org-cite-processor`.
2023-02-11 01:38:41 +08:00
TEC 663e200f54
ox: Document the setting of :parse-tree
* lisp/ox.el (org-export--annotate-info,
org-export--collect-tree-properties): Mention in comments the setting of
:parse-tree.
2023-02-11 01:38:41 +08:00
TEC 4fbd302df6
ox: Split up the org-export-as function
* lisp/ox.el (org-export--annotate-info, org-export-as): Separate out
the info-collection phase of `org-export-as' into a new function,
`org-export--annotate-info'.
2023-02-11 01:32:33 +08:00
Ihor Radchenko 9e9669a271
Merge branch 'bugfix' 2023-02-10 14:43:41 +03:00
Ihor Radchenko af1bb1b06a
org-compat: Work around Emacs bug#60467
* lisp/org-compat.el (version<): Use stub version of
`combine-change-calls' when it does not exist yet in Emacs or when it
is known to have a critical bug.  Use `org-combine-change-calls'
instead of overwriting the macro system-wide.
* lisp/org-footnote.el (org-footnote-sort):
* lisp/org.el:
(org-demote-subtree):
(org-paste-subtree): Use the new macro name.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/87ilhq74j8.fsf@localhost
2023-02-10 14:37:09 +03:00
Alan Schmitt 666a61bcc8
lisp/ox-beamer.el: add labels to latex export
* ox-beamer.el (org-beamer-environments-default): add label escape to
some environments
(org-beamer--format-block): generate label string for label escape
(org-beamer-environments-extra): document label escape

A new escape %l is available to be used in `org-beamer-environments-*'
to insert the label of the current block, obtained using
`org-babel--get-label'
2023-02-10 13:55:18 +03:00
Aaron L. Zeng 739ccf6cbf
org--batch-store-agenda-views: Fix treatment of lambda functions
* org-agenda.el (org--batch-store-agenda-views): Fix treatment of
lambda functions used as custom agenda commands.
`org-agenda-custom-commands' entries may specify a custom function
instead of a symbol like `tags-todo'.  `org--batch-store-agenda-views'
behaved differently from `org-agenda' when that custom function was
defined as a lambda rather than a symbol, incorrectly treating the
lambda form as a list of agenda commands.  Instead, use the same test
as `org-agenda' does to determine whether the command is a series.

TINYCHANGE
2023-02-09 12:59:24 +03:00
Ihor Radchenko 6cbbf4cdbf
org-link-abbrev-alist: Fix :safe predicate
* lisp/ol.el (org-link-abbrev-alist): Check every element in the
alist when considering :safe values.

Reported-by: Qiantan Hong <qthong@stanford.edu>
Link: https://orgmode.org/list/950326F5-F72D-4F51-A946-F37E96971B08@stanford.edu
2023-02-08 16:44:34 +03:00
Ihor Radchenko c8a5fef910
Preserve active region after structure edits
* lisp/org-list.el (org-list-indent-item-generic):
* lisp/org.el (org-do-promote):
(org-do-demote): Do not deactivate mark after edits.
(org-metadown):
(org-metaup): Do not deactivate mark and do not exchange point and
mark in region.
* etc/ORG-NEWS (Datetree structure headlines can now be complex):
Announce the change.
2023-02-04 16:49:54 +03:00
Ihor Radchenko b665f8de31
org-metaup, org-metadown: Move subtrees in active region
* lisp/org.el (org-metaup):
(org-metadown): When active region contains headings, move the
containing subtrees according to the selection.  Do not deactive
region.
* testing/lisp/test-org.el (test-org/move-subtree): Add test.
* etc/ORG-NEWS (~org-metaup~ and ~org-metadown~ now act on headings in
region): Announce the new features.
2023-02-04 16:49:30 +03:00
Ihor Radchenko 581df107b0
org-clock-sum: Fix Emacs 26 compatibility after 2e901ed23
* lisp/org-clock.el (org-clock-sum): Use backwards-compatible
`org-encode-time'.
2023-02-04 13:46:23 +03:00
Ihor Radchenko ec5d76bce1
Merge branch 'bugfix' 2023-02-03 18:01:47 +03:00
Ihor Radchenko 657cb58f10
org-set-modules: Fix when called before org-element is loaded
* lisp/org.el (org-set-modules): Add `require' needed to ensure that
`org-element-cache-reset' is available.
2023-02-03 17:57:38 +03:00
Ihor Radchenko 2e901ed236
org-clock-sum: Optimize performance
* lisp/org-clock.el (org-clock-sum): Do not re-parse the timestamps,
reusing already-parser element.
2023-02-03 15:10:45 +03:00
Ihor Radchenko 0522c1850b
org-read-property-value: Fix DEFAULT arg when values are not restricted
* lisp/org.el (org-read-property-value): Honor DEFAULT argument when
property can have arbitrary value.

Reported-by: Janek F <xerusx@pm.me>
Link: https://orgmode.org/list/hh0ohv2LgPq86aW2Kp4AFV1VZ3yLuZafFLFqWN_NCciQcy86rxDkcZryr7gyPXrNzjFdP8lhdC0GS4c_XQtVXjOKDD-lqkJjlswSGX7OWvo=@pm.me
2023-02-03 14:42:35 +03:00
Ihor Radchenko 562cba7aab
Merge branch 'bugfix' 2023-02-03 14:29:32 +03:00
Liu Hui 3e23b8976e
org-agenda: Fix `org-agenda-filter-by-category'
* lisp/org-agenda.el (org-agenda-filter-by-category): Use
`org-agenda-get-category' to get the category at current line.

Link: https://orgmode.org/list/CAOQTW-MHsnEak_Oj_iyKBsnm6_j4WzOgThM_58a__uu10KenbQ@mail.gmail.com
2023-02-03 14:28:22 +03:00
Ihor Radchenko e455df4a07
org-persist: Improve commentary
* lisp/org-persist.el: Update top comment.
(org-persist--index-hash):
(org-persist--report-time): Update docstrings.
2023-02-02 23:32:00 +03:00
Pedro Andres Aranda Gutierrez 8ae8a8462f
org-clock-clocktable-language-setup: Fix Spanish translation
* lisp/org-clock.el (org-clock-clocktable-language-setup): Translate
leftover English string and use more accurate translation for clocked
time.
2023-02-02 14:01:53 +03:00
Ihor Radchenko b4a1133a18
org-babel-eval: Clarify the purpose of 4a751709b in code
* lisp/ob-eval.el (org-babel-eval): Add comment.
2023-02-01 15:03:50 +03:00
Matthew Trzcinski 81c03fb850
lisp/ob-eval.el: Append newline to source block query
* lisp/ob-eval.el (org-babel-eval): Newline facilitates working with
Windows cmdproxy.exe.

Reported-by: "Osher Jacob" <osherz5@gmail.com>
Link: https://list.orgmode.org/orgmode/CAGsxwFZ88cybALCVGgma=5gENMhUa0Rk6xNkBNS_HdsmBgYe6w@mail.gmail.com/
2023-02-01 14:58:30 +03:00
Andreas Gerler 2cf8430350
lisp/ob-sql.el: allow string in sql-connection-alist
* ob-sql.el (org-babel-find-db-connection-param): read
sql-connection-alist like sql.el/sql-connect and allow strings.

Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
2023-02-01 14:58:03 +03:00
Ihor Radchenko b363ec04a2
Merge branch 'bugfix' 2023-02-01 00:21:06 +03:00
Ihor Radchenko 32b64607ad
org-element-cache-map: Fix when inside indirect buffer
* lisp/org-element.el: Query cache variables from the base buffer.
They are only kept up-to-date there.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Reported-by: Hanno Perrey <hanno@hoowl.se>
Link: https://orgmode.org/list/87pmau4fi3.fsf@hoowl.se
2023-02-01 00:18:56 +03:00
Marco Wahl 0d01a198bc org-attach: Show Org Attach UI starting from top
* org-attach.el (org-attach): Move cursor to the top of the
UI-description buffer.

This matters when the buffer does not fit completely in the window for
display.  Without the change the user would see the bottom part.
2023-01-30 23:01:17 +01:00
Matthew Trzcinski 4a751709b5 lisp/ob-eval.el: Append newline to source block query
* lisp/ob-eval.el (org-babel-eval): Newline facilitates working with
Windows cmdproxy.exe.

Reported-by: "Osher Jacob" <osherz5@gmail.com>
Link: https://list.orgmode.org/orgmode/CAGsxwFZ88cybALCVGgma=5gENMhUa0Rk6xNkBNS_HdsmBgYe6w@mail.gmail.com/
2023-01-30 12:05:22 -05:00
Andreas Gerler 1f86003a5d
lisp/ob-sql.el: allow string in sql-connection-alist
* ob-sql.el (org-babel-find-db-connection-param): read
sql-connection-alist like sql.el/sql-connect and allow strings.

Signed-off-by: Andreas Gerler <baron@bundesbrandschatzamt.de>
2023-01-30 17:57:04 +01:00
Ihor Radchenko 0509a84786
Merge branch 'bugfix' 2023-01-30 12:06:49 +03:00
Ihor Radchenko c340e799f8
org-element-cache-map: Always continue after point set by FUNC
* lisp/org-element.el (org-element-cache-map): Never map over element
starting before the point manually moved (or set via
`org-element-cache-map-continue-from') by FUNC.
* testing/lisp/test-org.el (test-org/map-entries): Add tests.

Reported-by: Matthieu Caneill <matt@brokenwa.re>
Link: https://orgmode.org/list/Y9MKUzWWbErLFhmq@brokenwa.re
2023-01-30 12:05:29 +03:00
Jack Kamm aa48c80fe1 ob-python: Remove python-mode.el support
* lisp/ob-python.el (org-babel-python-mode): Moved to ob-compat.el,
and changed to a constant.
(org-babel-python-initiate-session-by-key): Remove code to support
python-mode.el.
(org-babel-python-send-string): Renamed from
`org-babel-python--send-string', turning it into a public function to
accommodate ob-python-mode-mode which advises this function. Also,
remove some code for python-mode.el.
(org-babel-python-evaluate-session): Update calls to renamed function
`org-babel-python-send-string'.
* lisp/ob-compat.el (org-babel-python-mode): Moved from ob-python.el,
and changed to a constant.
2023-01-27 11:30:51 -08:00
Ihor Radchenko 265e4a5747
Merge branch 'bugfix' 2023-01-27 13:35:28 +03:00
Ihor Radchenko c45a058928
org-follow-timestamp-link: Fix when org-agenda is not yet loaded
* lisp/org.el (org-follow-timestamp-link): Explicitly require
org-agenda.

Reported-by: Michael Maurer <maurer.michael@gmail.com>
Link: https://orgmode.org/list/CAH-0+bBaYEWLkQ3XVuuO+qiXDwQC+9JB0D2y9nti-a5uvNzEeA@mail.gmail.com
2023-01-27 13:34:22 +03:00
Ihor Radchenko 0c00590606
lisp/ob-scheme: Silence compiler
* lisp/ob-scheme.el (geiser-eval--error-msg): Declare external
function.
2023-01-27 13:19:12 +03:00
Ihor Radchenko 1810c625df
org-clock-x11idle-program-name: Prefer "xprintidle", when available
* lisp/org-clock.el (org-clock-x11idle-program-name): Change the
default value to "xprintidle" when its executable is available.
Fallback to previous default otherwise.  Update :package-version and
remove :version tags.
* etc/ORG-NEWS (New and changed options):
(~org-clock-x11idle-program-name~ now defaults to =xprintidle=, when available):
Document the change.

Link: https://orgmode.org/list/874jvkn1po.fsf@localhost
2023-01-27 13:16:14 +03:00
Ihor Radchenko 6001313b8f
Merge branch 'bugfix' 2023-01-26 12:21:17 +03:00
Arash Esbati 65ca7bc6a7
lisp/ox.el: Pacify compiler warning
* lisp/ox.el (org-export-to-buffer): Escape single quote in the
example given in docstring.
Add missing '.' after the abbreviation.
2023-01-26 12:18:49 +03:00
TEC 3e23682d37
ox: Fix non-renamed variable (f to file)
* lisp/ox.el (org-export-expand-include-keyword): In 2fecd96200 "f"
was renamed to "file", but one usage was missed, which is corrected
here.
2023-01-25 21:30:11 +08:00
Marc Nieper-Wißkirchen f35fb8ac2a
lisp/ob-scheme.el: Do not hide Scheme evaluation errors
* lisp/ob-eval.el (org-babel-eval-error-notify): Handle an exit code of nil.

* lisp/ob-scheme.el (org-babel-expand-body:scheme)
(org-babel-scheme-get-repl, org-babel-scheme-make-session-name)
(org-babel-scheme-execute-with-geiser)
(org-babel-scheme--table-or-string, org-babel-execute:scheme):
Display Scheme evaluation errors in an error buffer using
`org-babel-eval-error-notify'.

TINYCHANGE
2023-01-25 16:04:06 +03:00
Ihor Radchenko 1bcab6c04f
org-assert-version: Clarify that Org loading is aborted
* lisp/org-macs.el (org-assert-version): Explicitly state that Org
loading is aborted.  Some users otherwise assume that the warning can
be ignored.  Also, remove sentence about `load-path' as it is
explained later in the warning text.
2023-01-24 23:12:32 +03:00
Ihor Radchenko a6c882949e
Merge branch 'bugfix' 2023-01-24 21:20:30 +03:00
Ihor Radchenko 20ee7b85eb
fixup! org-fix-agenda-info: Fix Emacs <28 compatibility 2023-01-24 21:08:49 +03:00
Ihor Radchenko 7ad7796546
org-update-dblock: Add comment
* lisp/org.el (org-update-dblock): Clarify that `org-update-dblock' is
called for side effects.

Reported-by: Marcin Borkowski <mbork@mbork.pl>
Link: https://orgmode.org/list/87sfg1nfii.fsf@mbork.pl
2023-01-24 12:49:02 +03:00
Ihor Radchenko 1f9249eb6e
Merge branch 'bugfix' 2023-01-24 12:21:05 +03:00
Ihor Radchenko 5bbb97f3df
org-fix-agenda-info: Fix Emacs <28 compatibility
* lisp/org-agenda.el (org-fix-agenda-info): Do not use `string-pad'
that is only available since Emacs 28.  Instead, use the expression
used as default value of `calendar-iso-date-display-form'.

Reported-by: Aaron L. Zeng <me@bcc32.com>
Link: https://orgmode.org/list/20230124025259.1301063-1-me@bcc32.com
2023-01-24 12:16:19 +03:00
TEC 6b15897a56
ox: Remove unused let binding
* lisp/ox.el (org-export-parse-include-value): The current indentation
is used for expansion in `org-export--blindly-expand-include' (and
handled there).  It is not used during #+include keyword parsing.
2023-01-23 23:11:30 +08:00
TEC 2fecd96200
ox: Regain Emacs <28 compatibility with #+include
* lisp/ox.el (org-export-expand-include-keyword): Replace the (pred (not
FUN)) `pcase' form introduced in Emacs 28 with a simple `cond' statement.
2023-01-23 23:11:30 +08:00
Ihor Radchenko 77a1cfb9a4
org-html-src-block: Treat code blocks without LANG equally
* lisp/ox-html.el (org-html-src-block): Do not treat src blocks
without LANG as example blocks.  Instead, export them using "nil"
language.  This way, such src blocks will get captions, unlike example
blocks.

The new behavior is consistent with ox-latex and ox-ascii.

Reported-by: Johan Bolmsjö <org-mode@johan.bitmaster.se>
Link: https://orgmode.org/list/87zgb90win.fsf@localhost
2023-01-23 16:29:13 +03:00
Kyle Meyer e84077ded3 Merge branch 'bugfix' 2023-01-22 21:46:52 -05:00
Kyle Meyer e37e9b692e org-persist: Silence recent byte-compiler warning
* lisp/org-persist.el: Bind pp-use-max-width to silence byte-compiler
warning about unused lexical variable.

Note that loading pp.el upfront rather than relying on the pp function
being autoloaded would also eliminate the warning, but that would only
work on Emacs 29 or later because earlier versions do not have the
pp-use-max-width option.
2023-01-22 21:45:57 -05:00
Kyle Meyer 6ae5430962 Merge branch 'km/from-emacs-29' into bugfix 2023-01-22 21:33:37 -05:00
Dmitry Gutov ebaf1c9c04 Backport commit 347933377 from Emacs
* lisp/ob-ruby.el: Fix outdated comments.

lisp/org/ob-ruby.el: Fix outdated comments.
34793337783489297313c67d4a56682514877597
Dmitry Gutov
Fri Jan 20 23:32:21 2023 +0200
2023-01-22 21:33:13 -05:00
Stefan Kangas 0ab9bc138f Backport commit 920a7d38e from Emacs
; Fix typos
920a7d38e96134289393b7bfcc3a7b88be73925b
Stefan Kangas
Sun Jan 15 02:14:19 2023 +0100

[km] These were likely not typos but intended as an abbreviation for
     "if and only if".  However, using "if" works fine in these spots,
     so let's just go along with the change.  (These may end up being
     reverted on Emacs's side; see emacs-devel
     <83a62k72lx.fsf@gnu.org>, 01-15.)
2023-01-22 21:33:13 -05:00
TEC a9ee43a124
ox: Fix parsing of example #+includes
* lisp/ox.el (org-export-parse-include-value): Since the example
environment regexp does not contain a capture group, we can not assume
we can call `replace-match' on the first capture group.  Before doing
so, check that the capture group indeed exists.
2023-01-22 20:14:23 +03:00
TEC f0dfbf0c39
ox-latex: Erase compile buffer at the start
* lisp/ox-latex.el (org-latex-compile): Before running the compile
command, erase the log buffer to ensure that stale/old logging is
cleared.
2023-01-22 18:18:43 +03:00
TEC b84018633e
ox-latex: Split org-latex-compile into two funs
* lisp/ox-latex.el (org-latex-compile): Split off the postprocessing in
`org-latex-compile' into a new function,
`org-latex-compile--postprocess'.
2023-01-22 18:18:43 +03:00
TEC 18d2f871c2
org: Split org-format-latex into two functions
* lisp/org.el (org-place-formula-image, org-format-latex): Extract the
overlay placement component of `org-format-latex' into a new function
`org-place-formula-image`.
2023-01-22 18:18:42 +03:00
TEC d0c87c762a
ox-latex: Do not hardcode fallback compiler
* lisp/ox-latex.el (org-latex-compile): Instead of hardcoding "pdflatex"
as the fallback compiler, use `org-latex-compiler'.
2023-01-22 18:18:41 +03:00
TEC b29f772416
org-macs: Split org-compile-file into two funs
* lisp/org-macs.el (org-compile-file, org-compile-file-commands):
Pull out the logic transforming process descriptions to commands to be
executed into a new function, `org-compile-file-commands'.
`org-compile-file' is now solely concerned with running the commands and
reporting the result.
2023-01-22 18:18:40 +03:00
TEC c8f88589cb
org-persist: Set utf-8 coding when reading/writing
* lisp/org-persist.el (org-persist--write-elisp-file,
org-persist--read-elisp-file): Instead of letting `find-auto-coding' be
invoked to determine the coding for org-persist cache files (which can
be surprisingly expensive), we simply set utf-8 coding when
reading/writing.
2023-01-22 18:18:40 +03:00
TEC e9c0696f79
org-persist: Inhibit fsync when writing cachefiles
* lisp/org-persist.el (org-persist--write-elisp-file): For the reasons
mentioned in the large code comment, it simply does not make much sense
to use fsync when writing cache files.

The value of fsync in general on modern hardware seems questionable,
particularly with CoW filesystems which take care of the problem better
than it seems fsync ever could.
2023-01-22 18:18:39 +03:00
TEC 506989bed5
ox: Improve #+include parsing docstring
* lisp/ox.el (org-export-parse-include-value): Actually describe the
parsing behaviour of the function in the docstring.
2023-01-22 18:18:38 +03:00
TEC 7e649050c7
ox: Pass through unparsed #+include content
* lisp/ox.el (org-export-parse-include-value): Adjust the block matches
not to match keywords (i.e. ":\S-+"), and both block and env to consume
their matches in value.  Now value only contains the unmatched content,
which is given in as the results plist as :unmatched.
2023-01-22 18:18:37 +03:00
TEC 5cde90e3c8
ox: Refactor org-export-expand-include-keyword
* lisp/ox.el (org-export-expand-include-keyword): Split the parsing and
inclusion logic of the ~150 line `org-export-expand-include-keyword'
into two new functions: `org-export-parse-include-value' and
`org-export--blindly-expand-include'.
2023-01-22 18:18:36 +03:00
Ihor Radchenko 4b546e04af
org-element--cache-submit-request: Ensure correct cache synchronization
* lisp/org-element.el (org-element--cache-sync): Add new optional
argument FORCE to force cache synchronization even when
`org-element--cache-active-p' returns non-nil.  Update commentary
explaining why `org-element--cache-active-p' needs to be checked.
(org-element--cache-submit-request): Force cache synchronization.  We
are safe to force it as all the callers of
`org-element--cache-submit-request' do check that cache is active.

This fixes an edge case when Org buffer has transient indirect buffers
with `after-change-functions' not being setup.  If a change happens in
the main Org buffer, `org-element--cache-after-change' gets called and
cache request is processed even though (org-element--cache-active-p),
but not (org-element--cache-active-p t), returns nil (due to the
indirect buffer).

Before this commit, `org-element--cache-submit-request' called by
`org-element--cache-after-change' missed cache synchronization, as
`org-element--cache-sync' did nothing.  As a result, if the indirect
buffer would get deleted, we would end up with incorrect cache state.

Reported-by: Gregor Zattler <telegraph@gmx.net>
2023-01-22 15:13:50 +03:00
Ihor Radchenko ddca762329
org-element--cache-verify-element: Format all the elements in warning
* lisp/org-element.el (org-element--cache-verify-element): Use
`org-element--format-element' to print all the elements.
2023-01-22 15:13:49 +03:00
Ihor Radchenko b34bdc8719
org-capture-finalize: Do not save new file with :no-save aborted capture
* lisp/org-capture.el (org-capture-finalize): Do not save the newly
created file buffer when the capture is aborted and org-capture is not
asked to save upon capture.
* testing/lisp/test-org-capture.el (test-org-capture/abort): Add test.
2023-01-22 13:49:07 +03:00
Ilya Chernyshov 005c9ae747
lisp/org-datetree.el: Allow datetrees with TODO, priority, tags
* org-datetree.el (org-datetree--find-create): Add optional argument
MATCH-TITLE that controls whether to match REGEX-TEMPLATE against
heading title inside complex heading or to match REGEX-TEMPLATE
against the whole heading line.

* org-datetree.el (org-datetree--find-create-group,
org-datetree-find-iso-week-create): Allow finding a datetree with TODO
state, priority, tags, statistics cookies, or COMMENT keyword.

* testing/lisp/test-org-datetree.el
(test-org-datetree/find-date-create,
test-org-datetree/find-iso-week-create): Add tests for a datetree with
tags, TODO or priority keywords.

* etc/ORG-NEWS (Datetree structure headlines can now be complex):
Document the change.

* doc/org-manual.org: Update datetree definition.
2023-01-21 12:29:32 +03:00
Ihor Radchenko f2320a2cc1
Revert "org-agenda.el: Fix `org-agenda-get-blocks'"
This reverts commit cb19f5c94e.

The original commit broke timestamp ranges with same starting and
ending hours.

Link: https://orgmode.org/list/87edrpa15m.fsf@gnu.org
2023-01-21 11:27:39 +03:00
Gautier Ponsinet 84ead47d3c
Define the face `org-agenda-calendar-daterange'
* etc/ORG-NEWS: Announce the introduction of the new face
  `org-agenda-calendar-daterange'.
* lisp/org-faces.el: Define the face `org-agenda-calendar-daterange'.
* lisp/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-daterange' to entries with a date range.
2023-01-21 11:27:38 +03:00
Gautier Ponsinet 22dea8557f
org-agenda: Apply the face `org-agenda-calendar-event'
* list/org-agenda.el (org-agenda-get-blocks): Apply the face
  `org-agenda-calendar-event' to entries with a time range within a
  single day.
2023-01-21 11:27:38 +03:00
Marco Wahl 9d58e1c781 org: Make documentation of org-reverse-note-order true
* lisp/org.el (org-notes-order-reversed-p): Return value is
org-reverse-note-order if it is neither nil or a list.

E.g. before nil has been returned when org-reverse-note-order was a
symbol.  And this did not meet the documentation of
org-reverse-note-order.
2023-01-20 13:56:00 +01:00
Ihor Radchenko c92769a505
org-paste-subtree: Do not leave empty line in place of level indicator
* lisp/org.el (org-paste-subtree): Remove the whole line when level
indicator is provided.  Improve check for level indicator.
* testing/lisp/test-org.el (test-org/paste-subtree): Add test.

Reported-by: Philipp Kiefer <phil.kiefer@gmail.com>
Link: https://orgmode.org/list/a2cc49d3-7f65-5f6a-8f05-21e5056335b3@gmail.com
2023-01-20 13:05:08 +03:00
Ihor Radchenko cf1ccc7154
Merge branch 'bugfix' 2023-01-20 12:10:40 +03:00
Ihor Radchenko 15c519b84c
Do not assume that `org-string-width' preserves match data
* lisp/org-table.el (org-table-blank-field):
(org-table-clean-line): Avoid `org-string-width' modifying match data.

As long as `org-string-width' creates a new window buffer, third-party
modes and Emacs distributions might modify the match data in buffer
hooks.  Hence, we cannot assume that match data is not modified even
though `org-string-width' code itself does not alter the match data.

Note: Adding `save-match-data' around function calls is generally a
good practice when the surrounding code relies on the match data being
intact.  Elisp conventions don't prohibit functions to modify match
data without notice in their docstring.

Reported-by: Thomas Schneider <qsx@chaotikum.eu>
Link: https://orgmode.org/list/wwufsc7edzu.fsf@chaotikum.eu
2023-01-20 12:01:24 +03:00
Ihor Radchenko e553e19ca9
Merge branch 'bugfix' 2023-01-20 11:46:55 +03:00
Ihor Radchenko ecdb442044
org-persist: Work around Emacs bug#58687
* lisp/org-persist.el (org-persist--write-elisp-file): Bind
`pp-use-max-width' to nil when using `pp'.  Otherwise, printing
quickly becomes slow.

Reported-by: Michael Eliachevitch <m.eliachevitch@posteo.de>
Link: https://orgmode.org/list/87wn8tb3zp.fsf@posteo.de
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58687
2023-01-20 11:44:57 +03:00
Ihor Radchenko 52f29d4da3
Merge branch 'bugfix' 2023-01-18 12:19:34 +03:00
Ihor Radchenko cbb288eaa5
ob-core: Do not use `temporary-file-directory' function
* lisp/ob-core.el (org-babel-temporary-stable-directory): Use
`temporary-file-directory' variable instead of function.  The function
returns value depending on the `default-directory' at Org startup time
thus creating unpredictable temporary babel locations that may
sometimes litter current directory.

Reported-by: bhrgunatha <bhrgunatha@gmail.com>
Link: https://orgmode.org/list/93b040e1-6dc6-487f-de89-a4cea9a560ff@gmail.com
2023-01-18 12:16:19 +03:00
Ihor Radchenko f8a601f800
Merge branch 'bugfix' 2023-01-18 11:53:21 +03:00
Ihor Radchenko 5d9c9c27c6
* lisp/org-agenda.el: require 'org-element
Load org-element for agenda instead of relying on org-element being
loaded when agenda is ran.

Reported-by: zimoun <zimon.toutoune@gmail.com>
Link: https://orgmode.org/list/86r0vszn3w.fsf@gmail.com
2023-01-18 11:52:08 +03:00
Ihor Radchenko 0e5de0ff64
org-export-expand-include-keyword: Fix relative links in recursive includes
* lisp/ox.el (org-export-expand-include-keyword): Add new optional
argument INCLUDER-FILE to explicitly pass the includer file path when
expanding inside a temporary buffer.  Pass the INCLUDER-FILE later
during recursive expansion.

Reported-by: Gabriel Petrini da Silveira <gpetrinidasilveira@gmail.com>
Link: https://orgmode.org/list/CAHCA-UvaqnegPYfpPcJCqiY8+dDoj0pfX0vDckUui-MCj3wq5A@mail.gmail.com
2023-01-18 11:41:03 +03:00
Ihor Radchenko 104311c7f8
org-cite-basic--get-field: Throw an error on non-nil field values
* lisp/oc-basic.el (org-cite-basic--get-field): Throw an error when
the field value is not a string.  Document the new behavior.

Link: https://orgmode.org/list/87edsnsocj.fsf@localhost
2023-01-17 15:25:00 +03:00
Ihor Radchenko 15bbb930d5
Merge branch 'bugfix' 2023-01-17 15:05:36 +03:00
Ihor Radchenko c7b976a052
org: Bump the minimal required Emacs version
* lisp/org.el: Bump required Emacs version to 26.1.

See https://orgmode.org/worg/org-maintenance.html#emacs-compatibility
2023-01-17 15:05:11 +03:00
Ihor Radchenko 30dfafac34
Merge branch 'bugfix' 2023-01-16 13:41:26 +03:00
Ihor Radchenko 12bcd322d0
Improve documentation for agenda starting day
* doc/org-manual.org (Weekly/daily agenda):
* lisp/org-agenda.el (org-agenda-start-on-weekday):
(org-agenda-start-day): Document that `org-agenda-start-on-weekday'
takes precedence over `org-agenda-start-day' when agenda span is 7 or
14 days.

Reported-by: Eppo Math <eppolito.math@gmail.com>
Link: https://orgmode.org/list/878ri67plt.fsf@localhost
2023-01-16 13:35:11 +03:00
Ihor Radchenko 889b8cc2fd
Merge branch 'bugfix' 2023-01-16 12:30:03 +03:00
Ihor Radchenko df4a5d86d8
org-fold: Fix isearch when `org-fold-core-style' is 'overlays
* lisp/org-fold-core.el (org-fold-core--isearch-show): Make sure that
the actual isearch match is revealed.  This relies on undocumented
behavior of isearch that point is at the match when
'isearch-open-invisible is called.
(org-fold-core-region): Disable 'isearch-open-invisible-temporary
features when `org-fold-core-style' is 'overlays.  This is to work
around the undocumented requirement of isearch to _not_ delete the
overlay passed to 'isearch-open-invisible-temporary function.  Since
`org-fold-show-set-visibility' may destroy overlays arbitrarily, we
cannot currently support isearch `org-fold-show-context-detail' in
full.

Reported-by: Matt Lundin <mdl@imapmail.org>
Link: https://orgmode.org/list/87zgb6tk6h.fsf@localhost
2023-01-16 12:21:57 +03:00
Ihor Radchenko 25dd206a0e
Merge branch 'bugfix' 2023-01-14 16:30:26 +03:00
Ihor Radchenko 2e22a8b827
org-export-dictionary: Fix typo
* lisp/ox.el (org-export-dictionary): Fix encoding keyword.

Reported-by: Rafael Bento <rafael.bentoe.silva@gmail.com>
Link: https://orgmode.org/list/adda99a7-b21f-a33b-571d-b7bfd6d743e2@gmail.com
2023-01-14 16:28:49 +03:00
Ihor Radchenko d71bb04f78
Merge branch 'bugfix' 2023-01-13 12:08:49 +03:00
Ihor Radchenko 76f9a3c2cb
org-timestamp-change: Add FIXME
* lisp/org.el (org-timestamp-change): Add FIXME comment to
re-implement the logic in future to avoid `save-excursion' markers
being moved to the end of timestamp.
2023-01-13 12:06:16 +03:00
Ihor Radchenko 97a235cf1c
org-clock-timestamps-change: Preserve point position
* lisp/org-clock.el (org-clock-timestamps-change): Try harder to
preserve point position.  `save-excursion' is not sufficient here,
when the timestamp gets deleted in the process.

Reported-by: Johannes Dahl <muusik@gmail.com>
Link: https://orgmode.org/list/CAHuokSbJxM4kqjdT94aHmjnKqzOvpJpq3tJqOEqdswaBC=JnfA@mail.gmail.com
2023-01-13 11:57:19 +03:00
Ihor Radchenko dc29c7d81f
Merge branch 'bugfix' 2023-01-13 11:18:36 +03:00
Ihor Radchenko cd967ce006
org-odt-plain-text: Fix `fill-column' value
* lisp/ox-odt.el (org-odt-plain-text): Use `most-positive-fixnum' to
unfill plain text elements.  `point-max' is not a safe large value
because, for example, Han script symbols often occupy two columns.

Reported-by: Cantoraz Chou <cantoraz@gmail.com>
Link: https://orgmode.org/list/CAJg5Zf00e+A_kuBmRh+h68u+3g_Cb_bLqRhR4rpFH=nenXvTdw@mail.gmail.com
2023-01-13 11:10:54 +03:00
Stefan Monnier ecb62e2e31
org-babel-shell-initialize: Refactor
* lisp/ob-shell.el (org-babel-shell-initialize): Refactor avoiding
`eval' runtime calls and assigning 'definition-name function symbol
property to assist Emacs help system with finding the definition.

Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60568#71

> One of the discussed features was displaying function source code right
> in *Help* buffers. This feature usefulness have been objected at that
> time, on the grounds that showing function code may be too long and
> cause large *Help* buffers.

FWIW, I find myself regularly jumping to `M-x ielm` to look at the
`symbol-function`, so I would actually appreciate a button in the *Help*
buffer to display the actual value in the `symbol-function` slot.
This would also bring `describe-function` a bit closer to
`describe-variable`, which I think is good.

> 1. emacs -Q
> 2. M-: (require 'ob-shell)
> 3. <F1> f org-babel-execute:sh <RET>
> 4. Click on the source code link in *Help* buffer
> 5. Observe point jumping to (point-min) with no obvious way to find the
>    function definition.

We have `definition-name` for that.
I.e. `org-babel-shell-initialize` should arguably do

    (put 'org-babel-execute:sh 'definition-name 'org-babel-shell-initialize)

so that step 4 above jumps to `org-babel-shell-initialize`.

The patch below does that, along with saving some kittens.

        Stefan
2023-01-12 13:35:09 +03:00
Ihor Radchenko 0d5951a9b0
org-refile: Fix edge case when we refile on top of the same subtree
* lisp/org-refile.el (org-refile): Use dedicated marker (move after
insertion) to store position of the heading being refiled.  Otherwise,
if refiled heading is inserted at the same point, `save-excursion'
would restore point before the inserted heading instead of keeping it
at the original heading.
* testing/lisp/test-org.el (test-org/refile): At test.

Reported-by: /u/madclassix
2023-01-12 13:19:02 +03:00
Ihor Radchenko d0758eabfe
Merge branch 'bugfix' 2023-01-12 12:23:41 +03:00
Ihor Radchenko a52d0f0918
org-export-as: Fix subtree export when metadata ends right before heading
* lisp/ox.el (org-export-as): Only include first newline after heading
line when the metadata is non-empty.
* testing/lisp/test-ox.el (test-org-export/export-scope): Add test.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
Link: https://orgmode.org/list/CAFyQvY1d=UEJ-6ZPG1X+st=fCfBAnTfgbVNhxyxH_xKcLGG4cQ@mail.gmail.com
2023-01-12 12:23:19 +03:00
Ihor Radchenko 89d13998bd
org-element-fixed-width-parser: Fix when :value is empty
* lisp/org-element.el (org-element-fixed-width-interpreter): Interpret
fixed-width element with :value "" as ":\n", not as empty string.
* testing/lisp/test-org-element.el (test-org-element/fixed-width-interpreter):
Fixed the test.

The previous test, albeit intentionally asserting "" result, breaks
reversibility of parse-interpret sequence.
2023-01-12 12:23:19 +03:00
Bastien 07c63df9c7 Merge branch 'bugfix' 2023-01-11 16:01:03 +01:00
Bastien 630f86dfc4 Update version number for the 9.6.1 release 2023-01-11 16:00:12 +01:00
Ihor Radchenko dfcf500df5
org-cdlatex-mode: Fix regression from f01390cf05
* lisp/org.el (org--math-always-on): Rename to `org--math-p' and only
override `texmathp' when current command is `cdlatex-math-symbol' or
when we are inside Org LaTeX math fragment.  Only these two scenarios
are the places where `texmathp' may not work properly in Org files.
We must not return t outside latex fragments as initially suggested by
the docstring because it would break, for example, `cdlatex-dollar'
command.
(org-cdlatex-mode): Use the new function name for advice.
* lisp/org-compat.el (org--math-always-on): Declare obsolete.

Reported-by: Daniel Fleischer <danflscr@gmail.com>
Link: https://orgmode.org/list/m2cz7sj5zt.fsf@gmail.com
2023-01-11 13:55:56 +03:00
Ihor Radchenko 2f7052619b
Merge branch 'bugfix' 2023-01-07 15:15:18 +03:00
Ihor Radchenko a6523f1aa0
org-export-output-file-name: Remove redundant `cond' clause
* lisp/ox.el: Remove `cond' clause equivalent to t.
2023-01-07 15:13:52 +03:00
Ihor Radchenko 5a8a1d4ff9
org-compile-file: Expand "~" in SOURCE
* lisp/org-macs.el (org-compile-file): Expand "~" in the source before
passing it as quoted shell argument.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25528.42190.53674.62381@gargle.gargle.HOWL
2023-01-07 15:12:41 +03:00
Ihor Radchenko a3815a169a
org-cycle-level: Do nothing at inlinetasks
* lisp/org.el (org-cycle-level): Do not change task level at
inlinetasks.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25524.11082.597138.21839@gargle.gargle.HOWL
2023-01-05 12:08:01 +03:00
Ihor Radchenko 80d1bc63ff
Merge branch 'bugfix' 2023-01-05 11:29:12 +03:00
Ihor Radchenko 93339de71b
org-babel-shell-initialize: Fix `org-babel-prompt-command'
* lisp/ob-shell.el (org-babel-shell-initialize): Do not search shell
name string by `eq' in `org-babel-shell-set-prompt-commands' alist.
Use `assoc' that is comparing by `equal' instead.

Reported-by: Matt <matt@excalamus.com>
Link: https://orgmode.org/list/87h6x8kluc.fsf@localhost
2023-01-05 11:26:40 +03:00
Bastien 001e114936 Revert "lisp/ob-scheme.el: Add Rudolf Adamkovič as the maintainer"
This reverts commit e5a3a07cac.

See https://list.orgmode.org/orgmode/m2pmbvqjtf.fsf@me.com/
2023-01-04 00:36:38 +01:00
Ihor Radchenko 30314c6038
Merge branch 'bugfix' 2023-01-03 10:58:59 +03:00
Ihor Radchenko 58aeb1af15
org-persist-unregister: Fix when ASSOCIATED is 'all
* lisp/org-persist.el (org-persist-unregister): Do not try to
normalize 'all ASSOCIATED.  It is not a valid association that should
be handled specially.  Previously, an error was thrown.
2023-01-03 10:58:02 +03:00
Ihor Radchenko 9e5c25ba75
org-persist-unregister: Allow removing related containers
* lisp/org-persist.el (org-persist-unregister): Add new optional key
:remove-related to remove all the containers stored alongside with
CONTAINER in addition to CONTAINER itself.  Update to docstring.
2023-01-03 10:56:49 +03:00
Ihor Radchenko 82cc6f0fe8
Merge branch 'bugfix' 2023-01-02 12:08:23 +03:00
Ihor Radchenko ce6f1799cc
org-options-keywords: Add missing keyword
* lisp/org.el: Add missing "EXPORT_FILE_NAME" that is mentioned in
13.2 Export Settings section of the manual.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25521.58663.963178.927459@gargle.gargle.HOWL
2023-01-02 12:07:17 +03:00
Ihor Radchenko e002168d64
Merge branch 'bugfix' 2023-01-02 10:53:14 +03:00
Ihor Radchenko 3454021483
Revert "org-babel-read: Obey `org-confirm-babel-evaluate'"
This reverts commit 10e857d428.

* lisp/ob-core.el:
(org-babel-merge-params):
(org-babel-process-params):
(org-babel-read):
* lisp/org-table.el: Add FIXME comments to places where arbitrary code
execution may happen.

The extra query is reverted until we develop a better code execution
safety system for Org.  The commit introduced too many user queries,
making the whole idea of asking users to execute code from Org files
not useful.

Link: https://orgmode.org/list/878rinadlq.fsf@localhost
2023-01-02 10:49:45 +03:00
Ihor Radchenko 4b647e70e6
Merge branch 'bugfix' 2023-01-02 10:27:44 +03:00
Ihor Radchenko 1cd39c9e30
org-mode: Fix element cache updates when aligning tables during startup
* lisp/org.el (org-mode): Do not suppress modification hooks when
aligning tables.  Otherwise, cache state may become invalid.

Reported-by: Stefan <org@stefan.failing.systems>
Link: https://orgmode.org/list/87tu1wse45.fsf@localhost
2023-01-02 10:26:52 +03:00
Kyle Meyer 563a4396b6 org-assert-version: Deleting trailing whitespace
Otherwise this fails Emacs's pre-commit check.
2023-01-01 22:23:43 -05:00
Kyle Meyer 96a402780c Merge branch 'bugfix' 2023-01-01 13:15:12 -05:00
Kyle Meyer 58e93869b7 Touch up copyright lines from cae528457
A few files had a copyright date of "2020-2020", and cae528457 (ported
by e0815d754) updated these to "2020, 2023-2020".  Correct these
spots.
2023-01-01 13:12:52 -05:00
Kyle Meyer 2f15b3c528 Merge branch 'km/from-emacs-29' into bugfix 2023-01-01 12:45:33 -05:00
Eli Zaretskii e0815d7545 Backport commit cae528457 from Emacs
; Add 2023 to copyright years.
cae528457cb862dc886a34240c9d4c73035b6659
Eli Zaretskii
Sun Jan 1 05:31:12 2023 -0500
2023-01-01 12:44:47 -05:00
Ihor Radchenko d5b8180e72
Merge branch 'bugfix' 2023-01-01 15:58:56 +03:00
Ihor Radchenko 9cee879b36
org-assert-version: Small refactoring
* lisp/org-macs.el (org-assert-version): Make quoting "'" in the
message more readable.

Thanks to Stefan Monnier <monnier@iro.umontreal.ca> for the
suggestion.
2023-01-01 15:58:19 +03:00
Kyle Meyer e316377767 Merge branch 'km/from-emacs-29' into bugfix 2022-12-31 18:13:31 -05:00
Stefan Kangas 92a40cf7a1 Backport commit 9292f595a from Emacs
; Fix typos
9292f595a71870eec1ffdfd187b859cc990c2f0b
Stefan Kangas
Sat Dec 31 12:43:32 2022 +0100
2022-12-31 18:11:46 -05:00
Ihor Radchenko 24740a9e84
Merge branch 'bugfix' 2022-12-31 16:13:46 +03:00
Ihor Radchenko 62dc49509c
org-assert-version: Do not display "'" as "’" in the code sample
* lisp/org-macs.el (org-assert-version): Dislpay (straight-use-package
'org) literally in the warning.

Reported-by: Stephen Eglen <sje30@cam.ac.uk>
Link: https://orgmode.org/list/m2edsgq1t8.fsf@cam.ac.uk
2022-12-31 16:10:11 +03:00
Ihor Radchenko 5804176149
Merge branch 'bugfix'
* lisp/org-persist.el (org-persist--storage-version): Bump further to
distinguish cache layouts on bugfix vs. main.
2022-12-31 12:40:19 +03:00
Ihor Radchenko 18577a495b
org-persist-register: Fix MISC argument handling
* lisp/org-persist.el (org-persist-register): Document that MISC must
be a plist.
(org-persist--get-collection): Throw an error when MISC is not a
plist.  Fix arglist - MISC is now passed explicitly as a single
object.
(org-persist--storage-version): Bump version to avoid obsolete
malformed containers with improperly included MISC.
2022-12-31 12:39:25 +03:00
Bastien e8ceb4a2cb lisp/ob-shell.el: Add Matt <matt@excalamus.com> as maintainer 2022-12-30 09:02:53 +01:00
András Simonyi 29103fc602 oc-csl: Improve LaTeX bibliography formatting
* lisp/oc-csl.el (org-cite-csl--output-format): Use the dedicated
'org-latex' citeproc formatter to export references in LaTeX.
(org-cite-csl-latex-preamble, org-cite-csl--generate-latex-preamble,
org-cite-csl-finalizer): Insert a preamble fragment compatible with
the 'org-latex' citeproc formatter.
(org-cite-csl-latex-label-separator,
org-cite-csl-latex-label-width-per-char): Introduce additional
variables to control bibliography formatting.

* etc/ORG-NEWS: Describe the introduced new options.
2022-12-29 22:36:36 +01:00
Bastien e5a3a07cac lisp/ob-scheme.el: Add Rudolf Adamkovič as the maintainer 2022-12-29 16:33:03 +01:00
Ihor Radchenko 5bc5add326
lisp/org-keys.el: Provide terminal binding for `org-insert-structure-template'
* lisp/org-keys.el (or): Add alternative terminal binding for
`org-insert-structure-template'.  The default binding may not be
available in some terminals.

* doc/org-manual.org (Using Org on a TTY): List the new binding in the
manual.

Reported-by: Anthony Carrico <acarrico@memebeam.org>
Link: https://orgmode.org/list/d9222967-5747-bf54-8041-4a8453fe81fc@memebeam.org
2022-12-29 17:27:37 +03:00
Ihor Radchenko fbd08a0d9b
oc-basic: Display ?? in place of missing citations on export
* lisp/oc-basic.el (org-cite-basic--format-author-year):
(org-cite-basic-export-citation): Display "????" for missing year and
"??"  for missing other fields.

Reported-by: Ihor Radchenko <yantar92@posteo.net>
Link: https://orgmode.org/list/871qr6kiuv.fsf@localhost
2022-12-29 17:24:21 +03:00
Ihor Radchenko 21741a4696
* lisp/ob-python.el: Mark python-mode support for removal
Add FIXME record to remove python-mode.el support in the next release.
See the annoucement in https://orgmode.org/Changes.html (Org 9.6)

Link: https://orgmode.org/list/87r0xq8dk9.fsf@gnu.org
2022-12-29 16:37:00 +03:00
Ihor Radchenko a9c0d4cde2
org-occur-in-agenda-files: Respect agenda restriction
* lisp/org.el (org-occur-in-agenda-files): Respect agenda restriction
when searching.

Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25514.61148.396137.347019@gargle.gargle.HOWL
2022-12-29 12:55:13 +03:00
Ihor Radchenko dedf1cc21f
org-persist: Add more normalizations and new `elisp-data' container
* lisp/org-persist.el (org-persist--normalize-container): Recognize
new `elisp-data' container.  Treat raw strings, keywords, and quoted
expressions as `elisp-data' container options.
(org-persist-read:elisp-data):
(org-persist-load:elisp-data):
(org-persist-write:elisp-data):
(org-persist-gc:elisp-data):
(org-persist-associated-files:elisp-data): New functions.
(org-persist-read): Simplify docstring example using `elisp-data'
container.

Also, update examples in top comment.
2022-12-29 12:27:50 +03:00
Ihor Radchenko 13e78df46a
* lisp/org-persist.el: Update commentary
Add more examples and document recent additions.
2022-12-28 15:57:24 +03:00
Ihor Radchenko 14bfe2841c
org-persist: Use `list-data-mode' for stored data
* lisp/org-persist.el (org-persist-version): Bump version.
(org-persist-index-file): Use .eld extension by default.
(org-persist--index): Set mode in buffer-local variable line.
2022-12-28 15:56:07 +03:00
Ihor Radchenko a97b378ee5
org-persist-read: Do not return related containers by default
* lisp/org-persist.el (org-persist-read): Only return the requested
containers.  Add new optional keyword argument :read-related to read
the containers stored together with requested.  Update the docstring
accordingly.
(org-persist-load): Update definition according to `org-persist-read'.
* lisp/org.el (org-mode): Explicitly load all the associated
cache variables.
2022-12-28 15:53:14 +03:00
Ihor Radchenko ffec2db731
org-persist-write:elisp: Allow buffer-local/global elisp container scope
* lisp/org-persist.el (org-persist-read:index): Allow setting where
the elisp container value is taken from: locally, from buffer, or from
a global variable.
2022-12-28 15:51:49 +03:00