Commit graph

18066 commits

Author SHA1 Message Date
Max Nikulin 892df429f4
ox-latex: Use \empty instead of \relax after \\
* lisp/ox-latex.el (org-latex-line-break-safe, org-latex-table-row):
* testing/lisp/test-org-table.el (test-org-table/to-latex): Use \empty
instead of \relax to prevent interpreting following "*" and "[" as
optional parts of \\*[LENGTH] command.

Fix regression introduced by 3f60acff77. \\\relax\hline caused
misaligned \noalign error. Org markup:

    | a |
    |---|

\hline is allowed only immediately after \cr while \relax has some side
effects. Hope, \empty just expands to nothing.

Those who used \\ optional argument to adjust amount of space between
lines may add the following tricks:

    First,\\
    @@latex:{\vskip1em}@@second.

    | First                               |
    | @@latex:\noalign{\vskip1em}@@second |

Reported in
gerard.vermeulen, Wed, 12 Oct 2022 03:15:49 +0000.
https://list.orgmode.org/784cf8be450b7d676ddd60214cc847db@posteo.net
2022-10-14 10:27:14 +08:00
Ihor Radchenko d331f52cac
org-crypt-key-for-heading: Handle CRYPTKEY nil value
* lisp/org-crypt.el (org-crypt-key-for-heading): Do not fallback to
`org-crypt-key' when heading explicitly sets CRYPTKEY property.

Reported-by: Ignacio Casso <ignaciocasso@hotmail.com>
Link: https://orgmode.org/list/PAXPR06MB7760DA356C7C27045BEB64F6C6449@PAXPR06MB7760.eurprd06.prod.outlook.com
2022-10-14 10:16:47 +08:00
Ihor Radchenko 3790bf8ea1
org-clock-sum: Do not err when have malformed clock lines
* lisp/org-clock.el: Only consider proper clock elements when
calculating clock sum.  Do not rely on crude regexp.

Reported-by: Gregor Zattler <grfz@gmx.de>
Link: https://orgmode.org/list/87y1yecmgb.fsf@localhost
2022-10-13 14:12:36 +08:00
Ihor Radchenko 0e4874f17c
org-up-element: Fix jumping up from inlinetask
* lisp/org.el (org-up-element): Do not assume that
`org-back-to-heading' skips inlinetasks.  Avoid that `if' branch by
skipping over section parents.

Reported-by: Michael Dauer <mick.dauer@gmail.com>
Link: https://orgmode.org/list/CAP7OBxKKeuK_uH46SyEqQbsuBsE=XPkB=ks1TkCZTwyPZ40KaA@mail.gmail.com
2022-10-13 11:06:36 +08:00
stardiviner 601ce688d5
lisp/ob-clojure.el: Fix :backend override not work with `org-babel-clojure-backend'
* lisp/ob-clojure.el (org-babel-expand-body:clojure): When The source
block specified header argument :backend, the global option
`org-babel-clojure-backend' value is default 'cider, the
`cider-buffer-ns` is not void error.
2022-10-13 10:51:19 +08:00
Ihor Radchenko 4c0641837c
org-babel-script-escape: Turn empty lists into nil
* lisp/ob-core.el: Translate (), {}, and [] to nil.
* testing/lisp/test-ob.el (test-ob/script-escape): Add tests.

Reported-by: Jonas Bernoulli <jonas@bernoul.li>
Link: https://list.orgmode.org/87v8opfhk1.fsf@bernoul.li/T/#u
2022-10-12 19:46:14 +08:00
Ihor Radchenko 416c839c59
lisp/org-agenda.el: Remove unused `org-agenda-last-dispatch-buffer'
* lisp/org-agenda.el (org-agenda-last-dispatch-buffer):
(org-agenda): Remove unused variable.

Reported-by: Liu Hui <liuhui1610@gmail.com>
Link: https://orgmode.org/list/87edvdinaj.fsf@gmail.com
2022-10-12 15:39:54 +08:00
Liu Hui c57b030323
org-agenda: Make sure file restriction can be removed
* lisp/org-agenda.el: (org-agenda-restrict):
(org-agenda-restrict-begin):
(org-agenda-restrict-end):
(org-agenda-overriding-restriction): add docstrings.
(org-agenda):
(org-agenda-set-restriction-lock): Set `org-agenda-restrict' non-nil
during both temporary and extended file restriction.
(org-agenda-remove-restriction-lock): Revert commit df0e96ba4.
* testing/lisp/test-org-agenda.el (test-org-agenda/file-restriction):
Add a test.
2022-10-12 15:35:12 +08:00
Ihor Radchenko eb15341b3c
org-cycle-set-visibility-according-to-property: Do not change ancestor visibility
* lisp/org-cycle.el (org-cycle-set-visibility-according-to-property):
Do not unconditionally run `org-fold-reveal' for headlines with
"VISIBILITY" property.  `org-fold-reveal' can break the global
visibility and ancestor headline visibility settings.
*
testing/lisp/test-org-fold.el (test-org-fold/set-visibility-according-to-property):
Add test.

Reported-by: Eduardo Suarez <esuarez@itccanarias.org>
Link: https://orgmode.org/list/20220409202736.GA28127@itccanarias.org
2022-10-12 13:47:41 +08:00
Ihor Radchenko 88c85d620b
org-map-entries: Do not demand file buffer when SCOPE is nil
* lisp/org.el (org-map-entries): Avoid calling
`org-agenda-prepare-buffers' for non-file buffers.
`org-agenda-prepare-buffers' expects a file buffer and gives
unexpected dialogue otherwise.  Since `org-agenda-prepare-buffer' only
contains optional cache calculations and things only useful for agenda
generation, not calling it should be reasonably safe.

Reported-by: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Link: https://orgmode.org/list/871r54m6xm.fsf@gmail.com
2022-10-11 16:23:05 +08:00
Ihor Radchenko dd2212395b
org-ctrl-c-ctrl-c: Update timestamp at point inside clock lines
* lisp/org.el (org-ctrl-c-ctrl-c): Update the timestamp at point, if
any; not just the clock sum.

Reported-by: "Bruce E. Robertson" <brucer42@gmail.com>
Link: https://orgmode.org/list/87mtjo2twj.fsf@gmail.com
2022-10-11 15:54:23 +08:00
Ihor Radchenko 3f60acff77
ox-latex: Protect [...] after \\ to be interpreted as LaTeX argument
* lisp/ox-latex.el (org-latex-linebreak-safe): New constant holding
safe version of LaTeX line break.
(org-latex-table-matrix-macros):
(org-latex-clock):
(org-latex-line-break):
(org-latex-plain-text):
(org-latex-planning):
(org-latex--org-table):
(org-latex--math-table):
(org-latex-table-row):
(org-latex-verse-block): Use the new constant.

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

Reported-by: Stewart Thomas <sjt015@bucknell.edu>
Link: https://orgmode.org/list/ce760fc3-5aae-144d-2d02-7dea215f73fc@gmail.com
2022-10-11 11:32:52 +08:00
Chris Clark 4d07df718b
ob-clojure.el: Add a :backend header arg to clojure code blocks
* ob-clojure.el (org-babel-header-args:clojure,
org-babel-execute:clojure): Add a :backend header arg that can
override the configured `org-babel-clojure-backend'.

TINYCHANGE
2022-10-11 10:49:56 +08:00
Kyle Meyer e2d41c84e1 Merge branch 'km/from-emacs-master' 2022-10-10 15:41:07 -04:00
Stefan Monnier 616fc20445 Backport commit f3769bc32 from Emacs
* lisp/org.el (org-unfontify-region): Use `with-silent-modifications`.
(org-display-inline-remove-overlay): Remove ineffective binding of
`inhibit-modification-hooks` around code which doesn't modify the
buffer anyway.

org.el: Improve bindings of `inhibit-*` vars
f3769bc32a3d32377a83b33d416205f80814e422
Stefan Monnier
Fri Oct 7 12:29:56 2022 -0400
2022-10-10 15:40:05 -04:00
Ihor Radchenko 192742c9c5
org-export-with-buffer-copy: Allow safe reusable buffer copy
* lisp/ox.el (org-export--generate-copy-script):
(org-export-copy-buffer):  Accept cl-style key arguments.
* lisp/ox.el (org-export-with-buffer-copy): Allow optional cl-style
key arguments for fine-grained control on what to copy from the target
buffer and which buffer to use as a target.  Do not kill the target
buffer upon finished, when the target is provided.  Make sure that
remaining buffer copy does not preserve `buffer-file-name' from the
original buffer and that it never overwrites the file associated with
the original buffer.
* lisp/ox-html.el (org-html-format-latex): Use the new version of
`org-export-with-buffer-copy' instead of managing edge cases by
itself.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://orgmode.org/list/87zge8j5iu.fsf@localhost
2022-10-10 17:36:10 +08:00
Rudolf Adamkovič e7feeb2225
org-export: Propertize keybindings in Org Export dispatch UI
* lisp/ox.el (org-export--dispatch-ui): Propertize the navigational
keybindings.
2022-10-09 15:46:14 +08:00
Ihor Radchenko f4149681ee
org-babel: Fix usage of `org-babel-temporary-directory'
* lisp/ob-core.el (org-babel-temp-directory): New macro, returning
suitable temporary directory.  The macro considers remote
`default-directory' and nil values of
`org-babel-temporary-directory'.
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars):
* lisp/ob-java.el (org-babel-execute:java):
* lisp/ob-processing.el (org-babel-processing-view-sketch): Use the
new macro.

Reported-by: Christian Köstlin <christian.koestlin@gmail.com>
2022-10-09 12:30:00 +08:00
Ihor Radchenko 41a409f79d
org-src-font-lock-fontify-block: Do not fold links inside src blocks
* lisp/org-src.el (org-src-font-lock-fontify-block): Overwrite link
fontification after regexp-based `org-activate-links' fontifies links
disregarding Org parser.  Hidden parts of link-looking text are
explicitly unfolded now.  This commit relies on specific fontification
order in `org-font-lock-keywords'.
(org-fold-region): Declare function.

Reported-by: Tim Loderhose <tim@loderhose.com>
Link: https://orgmode.org/list/XdWFnN3XCJ67x3SvoiVo_itGGYfboKmuWp7OxQxRZ_SGA5vgb72oWBoqTmOUUtiqUR890-kIXjI7uhlse-HFYqNVJTyVlc15zAzbP8qHVdo=@loderhose.com
2022-10-09 11:45:44 +08:00
Roméo La Spina de553d1dc7
lisp/org-clock.el: Fix bug in prompt for resolving clocks
* lisp/org-clock.el (org-clock-resolve):
Avoid unwanted disappearing of the prompt when clicking somewhere, by
using `read-char-exclusive' instead of `read-char'.

Link: https://orgmode.org/list/87o82yaeie.fsf@gmail.com

TINYCHANGE
2022-10-09 11:19:48 +08:00
Kyle Meyer 04d9d4b3db compat: Load subr-x for Emacs < 28 compatibility
* lisp/org-compat.el: Require subr-x at compile time to define
string-trim for older Emacs versions.

Before Emacs 28.1, string-trim was defined in subr-x, leading to 'make
single' complaining about an undefined string-trim in the recently
added org-string-clean-whitespace.

Reported-by: Ihor Radchenko <yantar92@gmail.com>
Link: https://list.orgmode.org/8735c01aho.fsf@localhost
2022-10-08 01:40:07 -04:00
Ihor Radchenko 233ad88651
org-export: Do not use `always' not available in Emacs <28
* lisp/ox.el (org-export--generate-copy-script): Use explicit `lambda'
instead of `always', which is not yet available in all the supported
Emacs versions.

Reported-by: Kyle Meyer <kyle@kyleam.com>
2022-10-08 13:30:36 +08:00
Ihor Radchenko ae028d0a25
org-toggle-heading: Document checkbox conversion to TODO keywords
* lisp/org.el (org-toggle-heading): Update the docstring.
2022-10-08 12:45:59 +08:00
Ihor Radchenko fcd3817450
org-toggle-heading: Use buffer-local keyword settings when possible
* lisp/org.el (org-toggle-heading): Prefer `car' of
`org-done-keywords' and `org-not-done-keywords' when converting
checkboxes to TODO-keywords.

Reported-by: autofrettage <autofrettage@protonmail.ch>
Link: https://orgmode.org/list/87v91vle4u.fsf@gmail.com
2022-10-08 12:39:31 +08:00
Ihor Radchenko b68c1666c2
org-ts-regexp0: Fix matching timestamps with no day name
* lisp/org.el (org-ts-regexp1): Update regexp to match strings like
"2022-04-29 02:00" with no day name.

Reported-by: Russell Adams <RLAdams@adamsinfoserv.com>
Link: https://orgmode.org/list/87zgk8tc17.fsf@localhost
2022-10-08 12:01:14 +08:00
Ihor Radchenko eeae6ed4bf
org-agenda-lisp: Add FIXME about let-binding `inhibit-redisplay'
* lisp/org-agenda.el (org-agenda-list): The purpose of binding
`inhibit-redisplay' is unclear and apparently not in git logs.
2022-10-07 19:45:38 +08:00
Ihor Radchenko 86b6d843f6
org-html-format-latex: Prevent side effects of copying `buffer-file-name'
* lisp/ox-html.el (org-html-format-latex): Unset `buffer-file-name'
after we are done with transcoding LaTeX.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2k05c579o.fsf@me.com/T/#m949ed054f0f219e2742697c4c4f49fbe07909f5a
2022-10-07 18:06:19 +08:00
Ihor Radchenko 17708ab3fa
org-export-copy-buffer: Document the caveats
* lisp/ox.el (org-export-copy-buffer): Mention that `buffer-file-name'
is copied around and explain the consequences.  Document why
`buffer-file-name' is copied.
2022-10-07 18:06:12 +08:00
Ihor Radchenko 3de74bbeff
fixup! org-export-copy-buffer: Prevent saving to disk
* lisp/ox.el (org-export--generate-copy-script): Set
`write-contents-functions' after running `major-mode'.
* testing/lisp/test-ox.el (test-org-export/org-export-copy-buffer):
Add test.
2022-10-07 17:46:15 +08:00
Ihor Radchenko 1a62cd94cf
org-pcomplete: Fix completion inside bracketed link
* lisp/org-pcomplete.el (pcomplete/org-mode/searchhead): Drop closing
brackets when completing inside bracketed link [[*head<point>]].

Reported-by: Carlos Pita <carlosjosepita2@gmail.com>
Link: https://orgmode.org/list/87r1cfvvd0.fsf@localhost
2022-10-07 15:49:46 +08:00
Jonas Bernoulli fc8e375b9b
Begin messages about executing code blocks with a capital letter
lisp/ob-awk.el (org-babel-expand-body:awk):
lisp/ob-core.el (org-babel-execute-src-block):
lisp/ob-groovy.el (org-babel-execute:groovy):
lisp/ob-maxima.el (org-babel-execute:maxima):
lisp/ob-sed.el (org-babel-execute:sed):
Begin message with capital letter.

By Emacs' convention all messages should begin with a capital letter.
2022-10-07 13:51:35 +08:00
Jonas Bernoulli 2f4de60980
ob-emacs-lisp: Don't print arguments of post-process arguments to stdout
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): Do not
print post-processing argument.

It is unclear whether the arguments were printed on purpose.  It might
be useful to do so at times for debugging purposes, but generally they
drown out other messages when a lot of post-processing is being done;
making it harder to spot messages of interest that would otherwise
allow noticing regressions.  This is particularly troublesome when
running `org-babel-execute-buffer' from a Makefile or script.
2022-10-07 13:50:21 +08:00
Nicholas Vollmer 7f3a6cf6e7
org-capture: Add template hook properties
* lisp/org-capture.el (org-capture-templates): Document template hook properties.
(org-capture-finalize): Execute :prepare/:before/:after-finalize functions.
(org-capture-place-template): Execute :hook functions.

* doc/org-manual.org: Document template hook properties.

* etc/ORG-NEWS: Add news entry for template hook properties.

* testing/lisp/test-org-capture.el: Add tests for template hook properties.
2022-10-07 13:38:52 +08:00
Ihor Radchenko 0be36ac13e
org-html-format-latex: Prevent save prompt for temporary buffer
* lisp/ox-html.el (org-html-format-latex): Mark the temporary Org
buffer as unchanged to prevent buffer saving prompt before exiting
Emacs.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:18 +08:00
Ihor Radchenko dcdf98a564
org-export-copy-buffer: Update declarations
* lisp/ob-exp.el (org-export-copy-buffer): Update declaration with the
new function arguments.
2022-10-07 13:15:17 +08:00
Ihor Radchenko 514e3a9cd2
org-export: Suppress cache persistence in buffer copies during export
* lisp/org-element.el (org-element-cache-reset): Add new optional
argument that suppresses all persistence-related calculations.
* lisp/org-table.el (org-element-cache-reset):
* lisp/org.el (org-element-cache-reset): Update function signature.
* lisp/ox.el (org-export--generate-copy-script): Do not try to use
cache persistence in throwaway buffer copies.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:17 +08:00
Ihor Radchenko 09fd5f886a
org-html-format-latex: Avoid unnecessary string allocation
* lisp/ox.el (org-export--generate-copy-script): Add new optional
arguments to limit what is being copied.
(org-export-copy-buffer): Allow copying into provided buffer and copy
selectively passing the new optional arguments to
`org-export--generate-copy-script'.  Do not try to check if all the
local variable values are `read'able - it is only needed during async
export.
* lisp/ox-html.el (org-html-format-latex): Re-use the same hidden
buffer during export.  Only copy local variables into that buffer.

This commit avoids excessive calls to `org-mode' and copying the
exported buffer contents for every single latex fragment.  The result
is lower impact on GC and better overall performance.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:16 +08:00
Ihor Radchenko b45911d41e
org-export-copy-buffer: Prevent saving to disk
* lisp/ox.el (org-export--generate-copy-script): Prevent Emacs from
ever saving copied buffer contents to disk despite `buffer-file-name'
being set to the original value.
2022-10-07 13:15:15 +08:00
Ihor Radchenko 0551eba40c
org-export-get-ordinal: Cache results
* lisp/ox.el (org-export-get-ordinal): Cache results while counting to
avoid quadratic scaling.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:14 +08:00
Ihor Radchenko 4cb1b8ebd0
org-export-ignored-local-variables: Do not copy cache
* lisp/ox.el (org-export-ignored-local-variables): Do not copy buffer
cache.  It is large by size (and, thus, slow to `read') and may be
changed destructively by reference, interfering with the original
buffer when calling `org-export-copy-buffer'.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:14 +08:00
Ihor Radchenko aa90e5b59c
org-export-with-buffer-copy: Avoid all the hooks, not just `org-mode-hook'
* lisp/ox.el (org-export--generate-copy-script): Use
`delay-mode-hooks' to disable all the hooks to be executed instead of
only `org-mode-hook'.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:13 +08:00
Ihor Radchenko 5a167f6ef2
org-element-cache-reset: Never use cache persistence in non-file buffers
* lisp/org-element.el (org-element-cache-reset): Disable cache
persistence in non-file buffers.  In particular, do not try to restore
cache for temporary buffers based on their contents hash.

Reported-by: Rudolf Adamkovič <salutis@me.com>
Link: https://list.orgmode.org/m2zgef774u.fsf@me.com/T/#t
2022-10-07 13:15:12 +08:00
Ihor Radchenko 279bee087d
org-element-clock-line-re: Fix Emacs 26 compatibility after e305755b1
* lisp/org-element.el (org-element-clock-line-re): Use Emacs
26-compatible `rx' notation.
2022-10-07 13:09:32 +08:00
Rudolf Adamkovič a220492064
ob-sed: Fix typo
* lisp/ob-sed.el: Fix a typo in a comment
2022-10-07 12:10:21 +08:00
Jonas Bernoulli 9b690462a3
Allow returning empty list from post-processing block
* lisp/ob-ref.el (org-babel-ref-resolve): When the result an empty
list, then treat it as a list, not as the symbol nil.
* testing/lisp/test-ob.el (test-ob/post-header-arguments): Add new
test.
* etc/ORG-NEWS (Post-processing code blocks can return an empty list):
Document change in behavior.
2022-10-07 12:06:30 +08:00
Stefan Kangas 0b67b9f64f
Improve documentation of org-kill-line
* lisp/org.el (org-special-ctrl-k): Doc fix; clarify what is being
killed and improve wording.  Add command substitutions.
(org-kill-line): Doc fix; mention user options that this command
relies on.
2022-10-07 11:47:45 +08:00
Stefan Kangas e28e3aaabb
Improve documentation of org-agenda-skip-*
* doc/org-manual.org (Special Agenda Views): Improve indexing.
* lisp/org-agenda.el (org-agenda-skip-function)
(org-agenda-skip-entry-if, org-agenda-skip-subtree-if): Expand
docstrings.
(org-agenda-skip-if): Doc fix; clarify wording.
2022-10-07 11:47:44 +08:00
Stefan Kangas 101280aa66
Add crossreference to org-stuck-projects docstring
* lisp/org-agenda.el (org-stuck-projects): Add Info manual reference
to docstring.
2022-10-07 11:47:43 +08:00
Liu Hui edf5afc1d8
Fix filter preset problem for sticky agenda
* lisp/org-agenda.el (org-agenda-local-vars):
(org-agenda-filters-preset): Add a new variable
`org-agenda-filters-preset' for storing per-buffer filter presets.
(org-agenda):
(org-agenda-filter-any):
(org-agenda-prepare):
(org-agenda-finalize):
(org-agenda-redo):
(org-agenda-filter-by-tag):
(org-agenda-filter-make-matcher):
(org-agenda-set-mode-name):
(org-agenda-reapply-filters): Use `org-agenda-filters-preset' for
getting and setting per-buffer filter presets, rather than modifying
the global symbol property.  Change `org-lprops' from symbol property
to per-buffer text property.  Delete unused `last-args' symbol
property.
* testing/lisp/test-org-agenda.el (test-org-agenda/sticky-agenda-filter-preset):
(test-org-agenda/redo-setting): Add tests.
2022-10-07 11:43:32 +08:00
Ihor Radchenko f0b7dfb3a0
org-table: Repair table before inserting rows/columns
* lisp/org-table.el (org-table-insert-column):
(org-table-insert-row): Repair the table as needed before inserting.
The internal insertion logic assumes that the table is valid.  The
rapair checks are copied from `org-table-insert-hline'.

Reported-by: Mauro Aranda <maurooaranda@gmail.com>
Link: https://orgmode.org/list/87o8csah5t.fsf@localhost
2022-10-06 16:22:57 +08:00
Ihor Radchenko 224708323e
org-clock: Do not assume that clock is always inside capture buffer
* lisp/org-capture.el (org-capture): Store the clock marker in `org-capture-clock-was-started'.
(org-capture-clock-was-started): Document that the variable holds
clock marker.
(org-capture-finalize): Check the stored value of the clock marker
when deciding if the currently running clock has been started by
capture.

Reported-by: Bernt Hansen <bernt@norang.ca>
Link: https://orgmode.org/list/878rza7c0w.fsf@localhost
2022-10-06 16:00:59 +08:00
Ihor Radchenko 2c8bd0cc9b
org-fill-element: Respect region selection when filling src-block
* lisp/org.el (org-fill-element): When region is not active, run
`fill-paragraph' at point inside src block.  When region is active and
within src block boundaries, run `fill-paragraph' preserving the
region.  When region is active and crosses src block boundaries, fill
the whole src block.

Reported-by: Fabio Natali <me@fabionatali.com>
Fixes: https://orgmode.org/list/201b44de-1f97-1b23-1767-970ee00f259c@posteo.eu
2022-10-05 13:20:58 +08:00
Ihor Radchenko ceb99b8600
org-table-fix-formulas: Ensure shifting columns after removing invalid
* lisp/org-table.el (org-table-fix-formulas): Search from the
beginning of table formula when shifting moved column numbers.

Reported-by: Uwe Brauer <oub@mat.ucm.es>
Link: https://orgmode.org/list/87r1gaw0av.fsf@mat.ucm.es
2022-10-05 13:13:36 +08:00
Ihor Radchenko e305755b1a
org-element: Parse malformed clock lines as paragraphs
* lisp/org-element.el (org-element-clock-line-re): Update the regexp
matching the actual required clock line structure.
(org-element--set-regexps): Use `org-element-clock-line-re'.

Link: https://orgmode.org/list/87h7571bpb.fsf@localhost
2022-10-05 12:51:46 +08:00
Kyle Meyer 1f8cc85542 org-agenda: Replace 29.1 version keywords with package-version
* lisp/org-agenda.el (org-agenda-block-separator):
(org-agenda-time-grid):
(org-agenda-current-time-string): Replace version keyword with
package-version keyword.

Prefer package-version so that the help buffer shows

  This variable was introduced, or its default value was changed, in
  version 9.6 of the Org package that is part of Emacs 29.1.

rather than

  This variable was introduced, or its default value was changed, in
  version 29.1 of Emacs.
2022-10-04 21:07:19 -04:00
Kyle Meyer 95a4c59bfe compat: Add compatibility wrapper for format-prompt
* lisp/org-compat.el (org-format-prompt): New compatibility
function.
* lisp/org-capture.el (org-capture-fill-template):
* lisp/org-refile.el (org-refile-get-location): Use org-format-prompt.

Prefer a wrapper to inlining compatibility kludges.

This is a follow-up to the port of Emacs's 664094222.
2022-10-04 18:38:25 -04:00
Kyle Meyer 07b6a0e044 compat: Use org- wrapper for string-equal-ignore-case compatibility
* lisp/org-compat.el (org-string-equal-ignore-case): New compatibility
function.
(org-mode-flyspell-verify):
* lisp/ob-core.el (org-babel-results-keyword):
(org-babel-insert-result):
* lisp/org-lint.el (org-lint-duplicate-custom-id):
* lisp/ox.el (org-export-resolve-radio-link):
Use org-string-equal-ignore-case.

Prefer an explicit org- wrapper to isolate the kludge and avoid any
confusion about where it is defined.

This is a follow-up to the port of Emacs's 70341cab3.
2022-10-04 18:38:25 -04:00
Kyle Meyer 75d63533d3 compat: Move string-equal-ignore-case to correct section
Emacs's 70341cab3 put this in the "Emacs < 24.4 compatibility" section
(which no longer exists in main), but string-equal-ignore-case is new
to Emacs 29.
2022-10-04 18:38:25 -04:00
Kyle Meyer 98e168b489 compat: Add compatibility wrapper for string-clean-whitespace
* lisp/org-compat.el (org-string-clean-whitespace): New compatibility
function.
* lisp/ox.el (org-export-resolve-radio-link): Use
org-string-clean-whitespace.

This is a follow-up to the port of Emacs's 70341cab3.
2022-10-04 18:38:25 -04:00
Kyle Meyer 0e0fe76ae4 ox-icalendar: Fix time zone construct from recently ported commit
* lisp/ox-icalendar.el (org-icalendar--combine-files): Correct typo in
format-time-string specifier.

This is a follow-up to the port of Emacs's e0ca8f791.
2022-10-04 18:38:25 -04:00
Kyle Meyer 6dd736ab35 ol-eshell: Make recently ported change compatible with Emacs < 29
* lisp/ol-eshell.el (org-eshell-open): Inline action if
display-comint-buffer-action isn't bound.

This is a follow-up to the port of Emacs's 18b680cfd.
2022-10-04 18:38:25 -04:00
Kyle Meyer abc34b458f org-mouse: Make recently ported change compatible with Emacs < 29
* lisp/org-mouse.el (org-mouse-show-context-menu): Conditionally
restore old code path, falling back to double-click-time if
mouse-double-click-time isn't available.

This is a follow-up to the port of Emacs's 2fba71cf1.
2022-10-04 18:38:25 -04:00
Kyle Meyer 42c418693f Merge branch 'km/from-emacs-master' 2022-10-04 18:37:42 -04:00
Kyle Meyer aeb934b598 Merge branch 'km/from-emacs-28' 2022-10-04 18:36:31 -04:00
Kyle Meyer 631d4eb6af org-macs: Move org-current-text-indentation to silence byte-compiler
Move org-current-text-indentation upstream of first use to avoid 'make
single' (and the Emacs repo) reporting

  org-macs.el:1106:11: Warning: macro ‘org-current-text-indentation’ defined too
      late
2022-10-04 18:36:19 -04:00
Lars Ingebrigtsen 9b62bcc9c6 Backport commit 8dacd8cd9 from Emacs
* lisp/org/org-macro.el (vc-exec-after): Update declaration.

Add a new command vc-pull-and-push
8dacd8cd914fdbe0f6f17ca57915611d48e9124d
Lars Ingebrigtsen
Sat Sep 24 15:19:03 2022 +0200
2022-10-04 17:18:04 -04:00
Stefan Kangas c2c8e66e5d Backport commit b7e867b84 from Emacs
Make point-at-eol and point-at-bol obsolete
b7e867b841f47dcff3aeaef9b5608a237386ce70
Stefan Kangas
Tue Aug 23 04:54:57 2022 +0200

[ km: This was independently covered on the main branch with
  e73c5b7d0.  I'm applying it here too for bookkeeping/traceability
  purposes. ]
2022-10-04 17:18:04 -04:00
Lars Ingebrigtsen 9c2bc2877f Backport commit 06d716147 from Emacs
Fix some no-X build warnings
06d7161476255c77defa119fffa842b7abaa0dcb
Lars Ingebrigtsen
Mon Aug 22 19:22:33 2022 +0200
2022-10-04 17:18:04 -04:00
Lars Ingebrigtsen add8552b1d Backport commit 48aacbf29 from Emacs
* lisp/oc-basic.el (org-cite-basic--set-keymap): Adjust
buffer-substring generalized variable usage.

Make many seldom-used generalized variables obsolete
48aacbf292fbe8d4be7761f83bf87de93497df27
Lars Ingebrigtsen
Sun Aug 21 22:12:43 2022 +0200

[ km: This was independently covered on the main branch with
  a526ea6a3.  I'm applying it here too for bookkeeping/traceability
  purposes. ]
2022-10-04 17:18:04 -04:00
Stefan Kangas e58217ff1f Backport commit 57259773b from Emacs
; * lisp/org/org.el: Delete unnecessary declarations.
57259773b4f0b992e38843859a8b93d82317ded3
Stefan Kangas
Sun Aug 14 23:46:33 2022 +0200
2022-10-04 17:18:04 -04:00
Stefan Kangas 25e638f726 Backport commit 1137219c9 from Emacs
Make compat alias image-refresh obsolete
1137219c97dda512a309ce4bfad5abde0d2be206
Stefan Kangas
Tue Aug 9 14:04:39 2022 +0200

[ km: This was independently covered on the main branch with
  e73c5b7d0.  I'm applying it here too for bookkeeping/traceability
  purposes. ]
2022-10-04 17:18:04 -04:00
Peder O. Klingenberg 2ac8c44f04 Backport commit b335e1a04 from Emacs
* lisp/org.el (eq): Fix load of compiled or compressed
org-loaddefs (bug#56982).

* lisp/org/org.el: Fix load of compiled or compressed org-loaddefs
b335e1a0469105bb55b9741ae3106dc0a6023ce2
Peder O. Klingenberg
Thu Aug 4 20:27:56 2022 +0200
2022-10-04 17:18:04 -04:00
Stefan Kangas 883f87c3e7 Backport commit 4d64c39fa from Emacs
; * lisp/org/ob-lilypond.el: Add FIXME.
4d64c39fad481f2dc125aa4d207ab191bf697529
Stefan Kangas
Thu Aug 4 14:48:44 2022 +0200
2022-10-04 17:18:04 -04:00
Lars Ingebrigtsen 1bbd86310a Backport commit 4c1bc8315 from Emacs
* lisp/ob-core.el (org-src-sha): Avoid triggering the
`register-definition-prefixes' in doc strings (bug#56968).

Fix up some prefix registration problems in doc strings
4c1bc8315d8e677e4eeb2760d7a5ab7b7553359b
Lars Ingebrigtsen
Thu Aug 4 11:03:10 2022 +0200
2022-10-04 17:18:04 -04:00
Lars Ingebrigtsen e9df837d8a Backport commit 0a6e2b3bf from Emacs
* lisp/ox.el (org-export-to-file): Fix quoting of #' in doc strings.

Fix quoting of #' in some doc strings
0a6e2b3bfce8b5ae9e713e0668cb3cf5609073e2
Lars Ingebrigtsen
Wed Aug 3 13:14:32 2022 +0200
2022-10-04 17:18:04 -04:00
Lars Ingebrigtsen 19c3969e75 Backport commit 2682ea1b3 from Emacs
* lisp/org.el (org-dynamic-block-define): Autoload because
it's referred to in org-loaddefs.el.

Fix org.el byte-compile warning in org-loaddefs.el
2682ea1b3a9524eb54efac41b3221b514374c232
Lars Ingebrigtsen
Sun Jul 31 11:43:48 2022 +0200
2022-10-04 17:18:04 -04:00
Stefan Kangas e7059f7dbe Backport commit 22a5f0223 from Emacs
* lisp/org.el (org-file-apps):
Doc fixes; don't mention XEmacs specific library EFS.

Doc fixes: don't mention EFS
22a5f022344af8c0c0a9eddc2ac5ad36392d0cef
Stefan Kangas
Thu Jul 28 10:48:38 2022 +0200
2022-10-04 17:18:04 -04:00
Sam Steingold e614a763ca Backport commit 70341cab3 from Emacs
* lisp/ob-core.el (org-babel-results-keyword):
  Use `string-equal-ignore-case' instead of explicit `compare-strings'.
(org-babel-insert-result): Likewise.
* lisp/org-compat.el (string-equal-ignore-case):
  Define unless defined already.
(org-mode-flyspell-verify): Use `string-equal-ignore-case'.
* lisp/org-lint.el (org-lint-duplicate-custom-id): Likewise.
* lisp/ox.el (org-export-resolve-radio-link): Use
  `string-equal-ignore-case' and `string-clean-whitespace'.

string-equal-ignore-case: new function
70341cab3eb26e2f49bbc13d6bca247ab9403abc
Sam Steingold
Tue Jul 26 13:49:28 2022 -0400

[ km: Note that string-clean-whitespace also requires a compatibility
  kludge and the string-equal-ignore-case kludge was added to the
  wrong org-compat section.  These will be addressed in a follow-up
  commit. ]
2022-10-04 17:17:22 -04:00
Mattias Engdegård 1adbaca75a Backport commit 563bf2fae from Emacs
; * lisp/org/ol.el (org-link--decode-compound): `lsh` -> `ash`
563bf2fae5ec238172f1f16c81e51b9aadd77017
Mattias Engdegård
Wed Jul 20 13:51:55 2022 +0200
2022-10-04 17:10:50 -04:00
Stefan Kangas 07ca33e603 Backport commit 2a05479c2 from Emacs
; Fix typos: prefer American spelling
2a05479c221d4a13b15ed731e4eb1c0de99e97ed
Stefan Kangas
Thu Jul 14 12:13:31 2022 +0200
2022-10-04 17:10:50 -04:00
Stefan Kangas 69ba7a20be Backport commit 2a8d08360 from Emacs
The w3 package was removed from GNU ELPA in 2020 as it doesn't run on
a recent Emacs, and development had stopped over a decade before that.
If anyone wants to revive the w3 package, they should look this all
over, but it doesn't make sense for us to maintain this support code.
Ref: https://debbugs.gnu.org/25395

* lisp/ol.el (org-store-link): Remove w3 support code and related
documentation and comments.  (Bug#56435)
* doc/org-manual.org (Handling Links): Don't mention W3.

Drop support for the dead third-party w3 package
2a8d083607e7e0fe9358f1f6526dbd8aa928af61
Stefan Kangas
Sat Jul 9 17:27:49 2022 +0200
2022-10-04 17:10:50 -04:00
Stefan Kangas 675ec6771f Backport commit 9230953f2 from Emacs
; Fix typos.
9230953f23c432699347bb3eeadebd82e4cbbfaa
Stefan Kangas
Sat Jul 2 10:20:23 2022 +0200
2022-10-04 17:10:50 -04:00
Ihor Radchenko c77692e8fb Backport commit f94e93a6e from Emacs
* lisp/oc.el (org-cite-list-citations): Avoid quadratic complexity.
Pre-calculate list of all footnote definitions and cache the footnote
label search hits.  Do not make `org-element-map' accumulate unused
result.

org-cite-list-citations: Cache footnote-definition searches
f94e93a6eec92d834a6b545d8d4b68280b0993b0
Ihor Radchenko
Thu Jun 16 10:55:05 2022 +0300

[ km: This ported commit comes from main's b061e7b61.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 0da6c49f75 Backport commit 4f37a3b29 from Emacs
* lisp/org-element.el (org-element-map): Do not call `(plist-get info
:ignore-list)' on every iteration.

org-element-map: Avoid repetitive `plist-get' call
4f37a3b299bcec71a0e9bdd84b7b226494006fe4
Ihor Radchenko
Thu Jun 16 10:54:14 2022 +0300

[ km: This ported commit comes from main's 37a447ae0.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 8ac9203d5c Backport commit 979308b4c from Emacs
* lisp/ox.el (org-export-data): Use temporary buffer to collect export
data instead of `mapconcat'.  Using buffer puts less load on garbage
collector.

org-export-data: Concatenate strings in temporary buffer for performance
979308b4cad2b573606ed71a1689a47a9e7a9e98
Ihor Radchenko
Thu Jun 16 10:53:51 2022 +0300

[ km: This ported commit comes from main's a158b263a and was reverted
  in 811deae32.  I'm applying it here too for bookkeeping/traceability
  purposes, but these changes will be discarded when merged with
  main. ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 4ae72c6174 Backport commit 0f7ceb480 from Emacs
* lisp/ox.el (org-export-as): Use `buffer-chars-modified-tick' and
avoid extra invocations of `org-set-regexps-and-options' and
`org-update-radio-target-regexp' when the buffer is not changed.
Also, disable folding checks.  Folding is irrelevant inside export
buffer.

org-export-as: Do not update buffer settings when not modified
0f7ceb4803cabcb3c406fa7c27ccb7625096058e
Ihor Radchenko
Thu Jun 16 10:53:16 2022 +0300

[ km: This ported commit comes from main's 076dd92ac.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 4f8ea50604 Backport commit d21412df0 from Emacs
* lisp/ox.el (org-export-resolve-id-link): Pre-cache all the ids in
the parse tree for faster lookup.

org-export-resolve-id-link: Pre-cache all the ids in the parse tree
d21412df06b99b551e67d39c097d95e8a284de73
Ihor Radchenko
Thu Jun 16 10:52:54 2022 +0300

[ km: This ported commit comes from main's 84c89ea7c.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 07c5d066aa Backport commit 3236dedc2 from Emacs
* lisp/ox.el (org-export-resolve-fuzzy-link): Before matching LINK,
pre-process and cache all the non-nil search cells in the parse tree.
When matching, use the pre-processed info.  Fix the :test function for
the cache hash table.

org-export-resolve-fuzyy-link: Pre-cache all possible search cells
3236dedc2de5975afde877f7460bd012da89a98d
Ihor Radchenko
Thu Jun 16 10:52:36 2022 +0300

[ km: This ported commit comes from main's 792cd4b0a.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Ihor Radchenko 303c89350e Backport commit 5b3d4e7bf from Emacs
* lisp/ox.el (org-export-get-footnote-definition): Pre-process parse
tree once to filter out all non-footnote elements.  This speeds up
subsequent footnote definition searches.

org-export-get-footnote-definition: Pre-cache references in parse tree
5b3d4e7bf0b6a1eb576e1c6e6592028e3589f792
Ihor Radchenko
Thu Jun 16 10:52:17 2022 +0300

[ km: This ported commit comes from main's f51c28671.  I'm applying it
  here too for bookkeeping/traceability purposes.  ]
2022-10-04 17:10:50 -04:00
Stefan Kangas 5a81ec0018 Backport commit 253374f81 from Emacs
* lisp/org-clock.el (org-clock-select-task): Remove XEmacs
compat code.

Remove some XEmacs compat code from org-mode
253374f81a13109b73afc8e319ca1fea72f68c72
Stefan Kangas
Sat May 14 15:55:20 2022 +0200
2022-10-04 17:10:50 -04:00
Stefan Kangas e74ea551bf Backport commit cc8b6101f from Emacs
* lisp/ol-eww.el (org-eww-copy-for-org-mode):
* lisp/ol-w3m.el (org-w3m-copy-for-org-mode):
* lisp/org-refile.el (org-refile):
* lisp/org.el (org-change-tag-in-region): Remove XEmacs compat
code.

Remove some XEmacs compat code from org-mode
cc8b6101f4479a80a6af7f9d80c6f9d774a85f40
Stefan Kangas
Fri May 13 23:17:16 2022 +0200
2022-10-04 17:10:50 -04:00
Stefan Kangas c06dc10f39 Backport commit 2fba71cf1 from Emacs
* lisp/org-mouse.el (org-mouse-show-context-menu): Use
'mouse-double-click-time' instead of 'double-click-time'.

Fix handling double-click-time nil or t
2fba71cf1fadc9d681e6be250d152cc156bf6a00
Stefan Kangas
Mon May 2 12:03:08 2022 +0200

[ km: Note that mouse-double-click-time isn't available until Emacs
  29; a follow-up commit will add a compatibility kludge. ]
2022-10-04 17:10:04 -04:00
Paul Eggert 37bb3547c7 Backport commit fa1a7ac61 from Emacs
Byte-compiler problem reported by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2022-04/msg01256.html
* lisp/org-compat.el (org-at-table.el-p):
Now declared in org-table, not org.
(org-string-collate-lessp): Define the ersatz
org-string-collate-lessp with the same API as the primary form, to
pacify check-declare-file when run on org-macs.
* lisp/org-macs.el (org-time-convert-to-integer): Declare.

Pacify byte compiler etc. on org-compat, org-macs
fa1a7ac617619ef015e02e72950eef219ec62336
Paul Eggert
Thu Apr 28 13:41:35 2022 -0700
2022-10-04 16:59:33 -04:00
Paul Eggert 56ba22b9df Backport commit 3abb3681b from Emacs
* lisp/org-macs.el (org-file-newer-than-p):
Don’t assume list-format timestamps, by using
org-time-convert-to-integer instead of doing it by hand.

Use org-time-convert-to-integer instead of by hand
3abb3681b57d7c8ca7fa808addb0a10b6b109cab
Paul Eggert
Wed Apr 27 00:30:25 2022 -0700
2022-10-04 16:59:33 -04:00
Paul Eggert 723af4afae Backport commit 8ef37913d from Emacs
* lisp/ol.el (org-store-link):
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-2ft, org-matcher-time):
* lisp/org-table.el (org-table-eval-formula):
* lisp/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Don’t assume Emacs 27 encode-time, since standalone Org still
works with Emacs 25 and it’s easier if we minimize differences
from standalone Org.  Problem reported by Max Nikulin (Bug#54731).
This reverts much of 2021-12-16T17:40:21Z!eggert@cs.ucla.edu.

Port Org encode-time usage back to Emacs 25
8ef37913d3be5ff518018acb6b0144d6e559b5ba
Paul Eggert
Tue Apr 5 17:52:34 2022 -0700

[ km: See main's 8908a1bda (org-macs.el: Introduce a helper for
  `encode-time', 2022-07-17). ]
2022-10-04 16:59:15 -04:00
Sam Steingold 5d5a7832ec Backport commit 18b680cfd from Emacs
* lisp/ol-eshell.el (org-eshell-open): Pass
'display-comint-buffer-action' to 'pop-to-buffer' instead of using
'pop-to-buffer-same-window'.

Fix bug#52467 by adding a new custom variable 'display-comint-buffer-action'
18b680cfd177e877991be2bd70ead628bbdc0aa0
Sam Steingold
Tue Dec 28 17:28:49 2021 -0500

[ km: Note that display-comint-buffer-action isn't available until
  Emacs 29.  A compatibility kludge will be added in a follow-up
  commit. ]
2022-10-04 16:57:09 -04:00
Stefan Kangas 1a3dd6ec85 Backport commit 5f57b41aa from Emacs
; Minor license statement fixes
5f57b41aa612e5f190f5a3c1ea013be114493a03
Stefan Kangas
Mon Dec 20 22:31:31 2021 +0100
2022-10-04 16:57:09 -04:00
Paul Eggert 659646f135 Backport commit e0ca8f791 from Emacs
* lisp/ox-icalendar.el (org-icalendar-template)
(org-icalendar-export-current-agenda)
(org-icalendar--combine-files):
Prefer (format-time-string "%Z") to (cadr (current-time-zone)).

Prefer format-time-string to current-time-zone
e0ca8f791c2e4396f1e40d86c136ae547b40185d
Paul Eggert
Thu Dec 16 11:17:26 2021 -0800

[ km: The org-icalendar--combine-files change has a typo that will be
  fixed in a follow-up commit. ]
2022-10-04 16:57:09 -04:00
Paul Eggert 772c44779c Backport commit dd0727e1e from Emacs
* lisp/ol.el (org-store-link):
* lisp/org-clock.el (org-clock-sum)
(org-clock-update-time-maybe):
* lisp/org-colview.el (org-colview-construct-allowed-dates):
* lisp/org-macro.el (org-macro--vc-modified-time):
* lisp/org-macs.el (org-2ft, org-matcher-time):
* lisp/org-table.el (org-table-eval-formula):
* lisp/org.el (org-read-date, org-display-custom-time)
(org-time-string-to-time, org-timestamp-change):
Prefer (encode-time L) to (apply #'encode-time L) where either will do.
* lisp/org-clock.el (org-clocktable-steps):
Prefer (encode-time S M ...) to (apply #'encode-time (list S M ...)).

encode-time simplifications
dd0727e1ec1f535b9b06be88173b4d3ccd55abcb
Paul Eggert
Thu Dec 16 11:17:25 2021 -0800

[ km: Note that these changes will be reverted by the port of Emacs's
  8ef37913d. ]
2022-10-04 16:55:56 -04:00
Paul Eggert 1a2d2fd5e4 Backport commit c1145c31a from Emacs
* lisp/org-compat.el (file-attribute-modification-time):
Update doc string to match that of builtin Emacs.

Update org-compat doc string
c1145c31adf143460911dd87b408d35ea88a1a92
Paul Eggert
Sun Dec 5 23:24:10 2021 -0800
2022-10-04 16:27:45 -04:00