Commit graph

17573 commits

Author SHA1 Message Date
Samim Pezeshki 847e332301
lisp/org-agenda.el: Fix bug in `org-agenda-highlight-todo'
* lisp/org-agenda.el (org-agenda-highlight-todo): Skip formatting
the to-do keyword when `org-agenda-todo-keyword-format' is the
empty string.

TINYCHANGE
2022-03-21 15:25:13 +08:00
Ihor Radchenko 7e78f664b2
Merge branch 'bugfix' 2022-03-19 16:07:58 +08:00
Ihor Radchenko af6f1298b6
org-mouse: Fix keyword selection menu
* lisp/org-mouse.el (org-mouse-keyword-menu): Fix void-variable error
when selecting todo keyword.

Reported in https://list.orgmode.org/CAFChFyjzuBtr8BeGTb195AVoGbUKFtXf35vvv-r0mzOy0wvZ2Q@mail.gmail.com/T/#u
2022-03-19 16:07:01 +08:00
Kyle Meyer 91681fc033 Merge branch 'bugfix' 2022-03-02 23:04:59 -05:00
Stefan Monnier 668205f769 Backport commit d52c929e3 from Emacs
* lisp/org-refile.el (org-refile):
* lisp/org-capture.el (org-capture-store-last-position):
Pass `format` arg to `with-demoted-errors`.

(with-demoted-errors): Warn on missing `format` arg
d52c929e31f60ff0462371bfe27ebd479e3e82bd
Stefan Monnier
Fri Feb 4 19:39:53 2022 -0500

[km] with-demoted-errors has had a format argument since Emacs 24.4.
     Passing it avoids an error when compiling with Emacs's current
     master (bug#54225).  Once that bug is resolved, it will prevent a
     warning.
2022-03-02 23:02:50 -05:00
Nicolas Goaziou ef66660cf4 Merge branch 'bugfix' 2022-02-28 15:46:06 +01:00
Nicolas Goaziou bafeaf161c element: Fix parsing of inline footnotes
* lisp/org-element.el (org-element--pair-round-table):
(org-element--pair-square-table):
(org-element--pair-curly-table): De-activate all but one pair of
parenthesis.
* testing/lisp/test-org-element.el (test-org-element/footnote-reference-parser):
Add test.

Reported-by: Greg Minshall <minshall@umich.edu>
<http://lists.gnu.org/r/emacs-orgmode/2022-02/msg00369.html>
2022-02-28 15:45:25 +01:00
Kyle Meyer e822291aca Merge branch 'bugfix' 2022-02-27 23:45:32 -05:00
Kyle Meyer 33543d2aa8 org-link-descriptive: Fix docstring typo
* lisp/ol.el (org-link-descriptive): Drop extra word from docstring.
2022-02-27 23:43:59 -05:00
Kyle Meyer 57362f7414 org-copy-visible: Respect buffer-invisibility-spec
* lisp/org.el (org-copy-visible): Decide whether text is invisible by
calling invisible-p rather than checking whether the invisible
property at point is non-nil.

Text may have a non-nil invisible property but _not_ be hidden from
the user (and thus should be copied by org-copy-visible).  For
example, the link itself is shown when org-link-descriptive is nil,
but it still has an invisible property of `org-link'.
2022-02-27 23:43:59 -05:00
Kyle Meyer f2833ff255 org-copy-visible: Fix handling of adjacent invisible text
* lisp/org.el (org-copy-visible): Don't copy invisible text that
follows invisible text with a different property value.

If org-copy-visible sees that the left bound position has a non-nil
invisible property, it uses next-single-char-property-change to find
the new bound.  However, next-single-char-property-change may just
find a bound that still has a _different_ non-nil invisible property.

Reported-by: "Максим Бабушкин" <maxbabushkin@gmail.com>
Link: https://debbugs.gnu.org/49967
2022-02-27 23:43:59 -05:00
Nicolas Goaziou bb6830409d Merge branch 'bugfix' 2022-02-26 10:25:06 +01:00
David Lukes 83c6eccaee oc-basic: Better handling of CSL-JSON dates
* lisp/oc-basic.el (org-cite-basic--parse-json): Make date-parsing and
year extraction more resilient.  Provide more informative errors when it
fails.

A string-based date is not only indicated by the key 'raw, but also
possibly by the key 'literal.

String-based dates come in various formats, not necessarily yyyy-mm-dd.
So extracting the first sequence of 4 digits is arguably a better
heuristic for getting the publication year than splitting the string on
- and getting the car of that.

On error, include `value' in the message, which contains the original
value with actionable information, whereas the previously included
`date' is always nil in that case.

TINYCHANGE
2022-02-26 10:24:36 +01:00
Juan Manuel Macias 1291e89d2d ox-latex: Add a t' value for :float' in tables and figures
* org-latex--inline-image: default `figure' environment
* org-latex--decorate-table: default table environment
* doc/org-manual.org (Tables in LaTeX export): add `t' and arbitrary
`:float' values
* doc/org-manual.org (Images in LaTeX export): add `t' and arbitrary
`:float' values
2022-02-22 20:10:58 +01:00
Kyle Meyer 6e080e5786 Merge branch 'bugfix' 2022-02-20 14:14:24 -05:00
Kyle Meyer ea6b7451b8 ox: Escape a docstring apostrophe
* lisp/ox.el (org-export-with-smart-quotes): Escape an apostrophe to
prevent it from being displayed as a curved quote in the help buffer.
2022-02-20 13:53:28 -05:00
Ihor Radchenko c5a0113367
org-element-org-data-parser: Fix when invoked from indirect buffer
* lisp/org-element.el (org-element-org-data-parser): Consider base
buffer file name when calculating Org buffer category.
2022-02-20 15:26:11 +08:00
Nicolas Goaziou 37d8bc801e oc-basic: Fix `org-cite-basic--get-author'.
* lisp/oc-basic.el (org-cite-basic--get-author): Allow optional RAW argument.
(org-cite-basic--get-year):
(org-cite-basic--key-completion-table): Make use of new argument.
2022-02-16 13:55:08 +01:00
Ihor Radchenko bc8c3e7795
org-export-link--remote-local-copy: Update docstring
* lisp/ox.el (org-export-link-localise): Make sure that docstring is
narrower than 80 chars.  Clarify the return value when LINK is not a
remote link.
2022-02-14 12:42:57 +08:00
Ihor Radchenko 0cb0760206
org-persist-write:elisp: Do not use `buffer-local-boundp'
* lisp/org-persist.el (org-persist-write:elisp): Use manual
implementation of `buffer-local-boundp' to make things work in Emacs
<28.

Reported in https://list.orgmode.org/87k0dyqy3d.fsf@kyleam.com/T/#u
2022-02-14 12:41:37 +08:00
Nicolas Goaziou fe4a60dffa oc-basic: Fallback to editor when author is not available
* lisp/oc-basic.el (org-cite-basic--get-author): New function.
(org-cite-basic--get-year):
(org-cite-basic--print-entry):
(org-cite-basic--format-author-year):
(org-cite-basic-export-citation):
(org-cite-basic--key-completion-table): Use new function.

Suggested-by: psychosis <psychosis@disroot.org>
<http://lists.gnu.org/r/emacs-orgmode/2022-02/msg00006.html>
2022-02-13 22:27:47 +01:00
Nicolas Goaziou 6ac5e0adc8 Merge branch 'bugfix' 2022-02-13 22:14:55 +01:00
Nicolas Goaziou 17e4fe9093 lint: Fix false positive with inline footnote definitions
* lisp/org-lint.el (org-lint-invalid-macro-argument-and-template):
Take into consideration inline definitions.
* testing/lisp/test-org-lint.el (test-org-lint/undefined-footnote-reference):
Add test.

Reported-by: Timothy <tecosaur@gmail.com>
2022-02-13 22:13:41 +01:00
Ihor Radchenko 27215ac5b5
org-persist: Handle undefined variables in elisp containers
* lisp/org-persist.el (org-persist-write:elisp): Do not try to write
elisp variable data when the variable is not defined.
(org-persist-load-all):
(org-persist-write-all): Cleanup containers that cannot be
read/written.
2022-02-13 16:53:59 +08:00
Jonas Bernoulli 98588ebfe1 ox-texinfo: Allow enabling compact syntax for @itemx per file
* doc/org-manual.org (Plain lists in Texinfo export): Document the
:texinfo-compact-itemx export option and variable
org-texinfo-compact-itemx.
(Texinfo specific properties): Mention new export option and variable.
* lisp/ox-texinfo.el: Add org-texinfo-compact-itemx to the
:options-alist of the texinfo backend.
* lisp/ox-texinfo.el (org-texinfo-compact-itemx): New option.
* lisp/ox-texinfo.el (org-texinfo--massage-key-item): Add INFO
argument and use the :texinfo-compact-itemx export option.
* lisp/ox-texinfo.el (org-texinfo-item): Use the
:texinfo-compact-itemx export option.
2022-02-09 00:38:23 +01:00
Jonas Bernoulli 1312e1a938 ox-texinfo: Define definition commands using description lists
* doc/org-manual.org (Plain lists in Texinfo export): Document use
of definition command prefixes in description lists.
* lisp/ox-texinfo.el: Add org-texinfo--separate-definitions to the
list of :filter-parse-tree functions of the texinfo backend.
* lisp/ox-texinfo.el (org-texinfo--definition-command-alist)
(org-texinfo--definition-command-regexp): New variables.
* lisp/ox-texinfo.el (org-texinfo--separate-definitions)
(org-texinfo--match-definition, org-texinfo--split-definition)
(org-texinfo--split-plain-list, org-texinfo--massage-key-item):
New functions.
2022-02-09 00:35:59 +01:00
Jonas Bernoulli e52743fb30 ox-texinfo: Optionally use @itemx for certain description list items
* doc/org-manual.org (Plain lists in Texinfo export): Reorder and
document new functionality.
* lisp/ox-texinfo.el (org-texinfo-item): In a description list when
its :compact attribute is non-nil, then transcode consecutive items
using one @item and one or more @itemx commands, if all of them
except for the last one lack content.
2022-02-08 22:45:36 +01:00
Jonas Bernoulli 3d0f592de7 ox-texinfo: Add function for use by kbd macro
* doc/doc-setup.org: Use org-texinfo-kbd-macro for kbd macro.
* doc/org-manual.org: Add new node "Key bindings in Texinfo export".
* lisp/ox-texinfo.el (org-texinfo--quoted-keys-regexp): New variable.
* lisp/ox-texinfo.el (org-texinfo-kbd-macro): New function.
2022-02-08 22:45:27 +01:00
Ihor Radchenko a694cf5224
Merge branch 'bugfix' 2022-02-07 21:08:54 +08:00
Sacha Chua c5ceb6a2c3
org-list-send-item: allow dest to be a buffer position
* lisp/org-list.el (org-list-send-item): Check if dest is a string
before matching it, to allow dest to be a buffer position.
* testing/lisp/test-org-list.el (test-org-list/send-item): Add tests.
2022-02-07 21:07:52 +08:00
Marco Wahl 28da0649e6 org-attach: Extend range for org-attach-commands
* lisp/org-attach.el (org-attach): Get rid of the use of the second
arg of `commandp`, by making `org-attach-commands` accept any
commands (including keyboard macros).

Patch from Stefan Monnier.
https://list.orgmode.org/jwvwni7y70r.fsf-monnier+emacs@gnu.org/
2022-02-06 23:57:14 +01:00
Marco Wahl 4fdfe9c584 org-attach: Clean up some magic numbers
* lisp/org-attach.el (org-attach): Clean up some magic numbers.

Patch from Stefan Monnier.
https://list.orgmode.org/jwvwni7y70r.fsf-monnier+emacs@gnu.org/
2022-02-06 23:48:32 +01:00
Ihor Radchenko 1344376d69
Merge branch 'bugfix' 2022-02-05 19:19:49 +08:00
Ihor Radchenko bb8aa14923
org-element-cache: Add more self-consistency checks
* lisp/org-element.el (org-element--parse-to):
(org-element--cache-verify-element): Add check asserting that all the
parsed elements are assigned with non-nil parent (except org-data).
2022-02-05 19:18:00 +08:00
Ihor Radchenko 5da9d6810b
org-element--cache-before-change: Fix handling sensitive edits at bol
* lisp/org-element.el (org-element--cache-before-change): Fix
optimisation when edits are involving element :end position.  Checking
that END is at BOL fails when we insert at the beginning of a
headline.
2022-02-05 19:17:59 +08:00
Ihor Radchenko e29fea256d
org-element--parse-to: Simplify code 2022-02-05 19:17:59 +08:00
Ihor Radchenko 7543da991f
org-bibtex-read: Fix regression from f7d6db1bf
* lisp/ol-bibtex.el (org-bibtex-read): Make sure that the return value
is the updated `org-bibtex-entries'.  Document the return value
requirement.  The assumption about the return value is used by
`org-bibtex-yank'.

Fixes https://list.orgmode.org/86zgn689m5.fsf@krailli2.fritz.box/T/#u
2022-02-05 19:17:58 +08:00
Marco Wahl 1f78ca45f8 org: Small simplification 2022-02-04 11:49:15 +01:00
TEC e7ea951ac9
ol: Fix formatting in org-link--open-shell
* lisp/ol.el (org-link--open-shell): The %S token in the format string
causes the propertization to be printed as a structure, instead of
styling the path string.  This is clearly not the intended behaviour.

Reported by Max Nikulin <manikulin@gmail.com>
in https://list.orgmode.org/2c23e039-7215-3d6e-13a2-cb244563f347@gmail.com
2022-02-01 19:56:37 +08:00
TEC 6ee45518f3
ox: Add link localisation feature using persist
* lisp/ox.el (org-export-link-remote-p): A new function to determine
whether a link refers to a remote resource.
(org-export-link--remote-local-copy): Download and return the local
location of a remote resource link.
(org-export-link-localise): Transform remote links to refer to a local
copy of the resource.

* lisp/ox-latex.el (org-latex-link, org-latex-inline-image-rules): Make
use of the new functions for remote resources in ox.el to support
embedding https and tramp -linked files.
2022-01-31 19:37:39 +08:00
TEC b3ceafd0b9
ol: Fix formatting in org-link--open-elisp
* lisp/ol.el (org-link--open-elisp): The %S token in the format string
causes the propertization to be printed as a structure, instead of
styling the path string.  This is clearly not the intended behaviour.

Reported by Omar Antolín Camarena <omar@matem.unam.mx>
in https://list.orgmode.org/87sft58b6r.fsf@matem.unam.mx
2022-01-31 19:37:39 +08:00
Ihor Radchenko 7f6b6e4891
Merge branch 'bugfix' 2022-01-30 16:52:15 +08:00
Ihor Radchenko dd6486a070
Make sure that declarative defvars do not set variable value
* lisp/ob-tangle.el (org-id-link-to-org-use-id):
* lisp/org-agenda.el (org-agenda-overriding-header): Do not try set
value of a variable defined elsewhere.  This may interfere with custom
interface.  See
https://list.orgmode.org/orgmode/871r19ryxb.fsf@localhost/

(org-agenda-restrict):
* lisp/ol-bibtex.el (org-bibtex-description): Remove incorrect
comments.
2022-01-30 16:46:12 +08:00
Ihor Radchenko 589cc0732e
Merge branch 'bugfix' 2022-01-30 15:41:49 +08:00
Ihor Radchenko 2b49d6fd9c
org-id-update-id-locations: Disable cache in throwaway buffers
* lisp/org-macs.el (org-element-with-disabled-cache): Move from
org-element.el to org-macs.el
2022-01-30 15:40:14 +08:00
TEC 1b675f0ca8
org-agenda: Make timestamp ordering match docs
* lisp/org-agenda.el: When `org-agenda-sort-notime-is-late' is non-nil,
an absent timestamp is now (correctly) treated as maximal.

Bug reported by: Charles Tam <me@charlest.net> in
https://list.orgmode.org/CAKu+9YVNPSHG4HVtPFa2L2tP6yBdjJ38Teyr8OSDmCg0ZEOe9Q@mail.gmail.com
2022-01-30 15:40:13 +08:00
Ihor Radchenko ac5742f296
Merge branch 'feature/org-persist-new-tidy' 2022-01-29 17:16:35 +08:00
Ihor Radchenko 7014675226
org-mode: Fix cache loading order 2022-01-29 17:11:07 +08:00
Ihor Radchenko 19a383d9f4
org-persist-write-all: Speed up writing
* lisp/org-persist.el (org-persist-write): New optional argument
bypassing extra `org-persist-read' invocation.
(org-persist-write-all): Call faster version of `org-persist-write'.
2022-01-29 17:08:57 +08:00
Ihor Radchenko f0e0716f54
org-element: Use new cache container format 2022-01-29 17:08:47 +08:00
Ihor Radchenko 6b175fb227
org-persist-register: Make return value meaningful with :write-immidiately
* lisp/org-persist.el (org-persist-register): Return the return value
of `org-persist-write' when `:write-immediately' is non-nil.
2022-01-29 17:08:40 +08:00
Ihor Radchenko caccec2c54
org-persist: Use symbols as container names
* lisp/org-persist.el: Update commentary.
(org-persist--storage-version): Bump index version.
(org-persist--normalize-container):
(org-persist-read:index):
(org-persist--load-index):
(org-persist--save-index): Use symbol for container names.
2022-01-29 17:08:33 +08:00
Ihor Radchenko 6a5874bb26
org-persist-write: Overwrite existing copy if write is requested 2022-01-29 17:08:23 +08:00
Ihor Radchenko 0e18c617cf
org-persist-write:index: Return index path on write 2022-01-29 17:08:17 +08:00
Ihor Radchenko eca678195b
org-persist-write: Return the written value on success 2022-01-29 17:08:10 +08:00
Ihor Radchenko 0526acd16f
org-persist-register: New optional keyword to force immidiate write
* lisp/org-persist.el: Update commentary.
(org-persist-register): Add new keyword `write-immediately' to write
the newrly registerd container to disk immediately.
2022-01-29 17:08:02 +08:00
Ihor Radchenko 1bc8389871
org-persist-read: Check expiry 2022-01-29 17:07:56 +08:00
Ihor Radchenko f3bd1dcb77
org-persist: Fix compiler warnings 2022-01-29 17:07:48 +08:00
Ihor Radchenko ec787fb218
org-persist: Implement "file" and "url" containers linked to other file
* lisp/org-persist.el: Update commentary.
(org-persist--storage-version): Bump storage version.
(org-persist-write:file):
(org-persist-write:url): Support optional container setting.
2022-01-29 17:07:32 +08:00
Ihor Radchenko fca80139ee
org-persist: Fix compatibility with Emacs 27
* lisp/org-persist.el (org-persist--normalize-associated): Do not
expect that we can bind new vars in pacse forms.
(org-persist-read:elisp):
(org-persist-read:version):
(org-persist-read:file):
(org-persist-read:url): Avoid multiple `_' placeholders.
2022-01-29 17:06:40 +08:00
Ihor Radchenko dc52c0fe99
Fix native-comp warnings 2022-01-29 17:06:32 +08:00
Ihor Radchenko 4ec57a9453
org-persist: Update commentary 2022-01-29 17:06:23 +08:00
Ihor Radchenko d5fc159bf7
Fix compiler warnings 2022-01-29 17:06:14 +08:00
Ihor Radchenko f963d617a4
Fix checkdoc warnings 2022-01-29 17:06:08 +08:00
Ihor Radchenko 9b650938e7
org-persist: Provide human readable access time and make sure it exist
* lisp/org-persist.el (org-persist--storage-version): Bump version.
(org-persist-read:generic):
(org-persist-load:generic):
(org-persist-write:generic): Save access time in human-readable form.
2022-01-29 17:05:33 +08:00
Ihor Radchenko aca62116da
org-persist-write: Update buffer hash on save 2022-01-29 17:05:26 +08:00
Ihor Radchenko 203420504e
org-persist-load:elisp: fix loading 2022-01-29 17:05:13 +08:00
Ihor Radchenko 1869a37a2c
Fix org-persist--remove-from-index 2022-01-29 17:05:05 +08:00
Ihor Radchenko 8821ff5811
org-persist-read: Do not try to read non-existing containers 2022-01-29 17:04:52 +08:00
Ihor Radchenko 1084566322
Fix org-persist-unregister 2022-01-29 17:04:41 +08:00
Ihor Radchenko 703df9310a
org-persist: Cleanup on removal and version mismatch
* lisp/org-persist.el (org-persist--remove-from-index):
(org-persist-load:index): Garbage collect caches.
2022-01-29 17:04:18 +08:00
Ihor Radchenko dafa32da49
org-persist: Update index version 2022-01-29 17:04:11 +08:00
Ihor Radchenko 38a681fdae
org-element-cache-reset: Do not persist caches for non-file buffers 2022-01-29 17:03:54 +08:00
Ihor Radchenko 1c79af13df
org-persist-gc: Fix when expiry is days and data is freshly created 2022-01-29 17:03:46 +08:00
Ihor Radchenko 7c2d93560c
org-persist-default-expiry: Introduce and change default
* lisp/org-persist.el: New customisation controlling default persist
data expiry.  Defaults to 30 days from last access.
(org-persist-register): Change default value of `:expiry' key to
`org-persist-default-expiry'.
2022-01-29 17:03:09 +08:00
Ihor Radchenko 2a4e5a8e58
org-persist--normalize-associated: Use cache to calculate buffer hash 2022-01-29 16:56:14 +08:00
Ihor Radchenko edd7f2962f
org-persist: Reimplement using more generic approach 2022-01-29 16:55:57 +08:00
Samim Pezeshki 22e6ed6b89 agenda: Add header to agenda clock report table
* lisp/org-agenda.el (org-agenda-list): Add header to agenda clock
report table.

TINYCHANGE
2022-01-26 21:07:49 +01:00
Ihor Radchenko 2ae8d6c1cf
org-babel-tangle-collect-blocks: Use cache
* lisp/ob-tangle.el (org-babel-tangle-collect-blocks): Use element
cache to find the containing headline instead of regexp search.
Direct regexp search sometimes causes quadratic scaling.

See https://lists.gnu.org/r/emacs-orgmode/2022-01/msg00484.html
2022-01-26 19:27:03 +08:00
Ihor Radchenko 70970dff8d
org-before-first-heading-p: Use cache and clarify docstring 2022-01-25 22:53:08 +08:00
Ihor Radchenko e604187779
Merge branch 'bugfix' 2022-01-23 17:41:12 +08:00
Ihor Radchenko 5b404a2225
org-dblock-write:clocktable: Fix typo in error string
Reported in https://list.orgmode.org/874k5uu85j.fsf@yandex.com/T/#u
2022-01-23 17:40:25 +08:00
Ihor Radchenko 1587e445be
org-element-cache: Suggest to share warning text as well in the warnings
Multiple users reported that they saw the warning, but did not
actually report the warning text.  It's better to ask about sharing
explicitly.
2022-01-23 12:06:56 +08:00
Nicolas Goaziou 3154c22559 Merge branch 'bugfix' 2022-01-22 15:51:43 +01:00
Nicolas Goaziou 23daada78d compat: Prevent spell-checking citation
* lisp/org-compat.el (org--flyspell-object-check-p): Do not
spell-check citation and citation-reference objects.

Reported-by: Rudolf Adamkovič <salutis@me.com>
<http://lists.gnu.org/r/emacs-orgmode/2022-01/msg00434.html>
2022-01-22 15:48:26 +01:00
Ihor Radchenko 5ac2b2291b
Make sure that 'inherited text property in tags does not propagate to cache
* lisp/org.el (org--get-local-tags, org-get-tags): Explicitly copy
cached tag strings to make sure that modifications are not propagated
to cached tag values.

Fixes
https://list.orgmode.org/CAFyQvY2HkE5p00wQ1QycQCdtwy3drRB_naK8wenrKwVT-cbH7g@mail.gmail.com/T/#t
2022-01-21 19:47:18 +08:00
Ihor Radchenko 5d05f5911a
org-element-cache: Allow detecting changes from indirect non-Org buffers
* lisp/org-element.el (org-element--cache-before-change):
(org-element--cache-after-change): Do not prevent trigerring if the
current indirect buffer is not in Org mode, but its base buffer is in
Org mode.
2022-01-19 17:37:34 +08:00
Ihor Radchenko 37edef8bbd
org-mode: Initialise cache before initialising file-local regexps
* lisp/org.el (org-mode): Initialise cache earlier, allowing the
file-local settings to be taken from persistent cache when
possible.  Also, bind `org-mode-loading' while org-mode is loading.
* lisp/ol.el (org-update-radio-target-regexp): Do not try to refresh
cache when we are loading file for the first time.
2022-01-19 11:58:17 +08:00
Marco Wahl 0725237eed org: Small simplification
* lisp/org.el (org-metaup, org-metadown): Remove unnecessary min/max computation.
2022-01-18 09:47:53 +01:00
Ihor Radchenko 9b58ead467
org-element-context: Use element cache
* lisp/org-element.el (org-element-context): Use
`org-element-at-point', which makes use of cache.
* testing/lisp/test-org-element.el (test-org-element/lineage): Expect
full lineage up to org-data from `org-element-context'.
2022-01-17 20:20:57 +08:00
Ihor Radchenko f41ba23689
org-colview: Do not remap faces repeatedly
* lisp/org-colview.el (org-columns--display-here):
(org-columns-remove-overlays): Do not call `face-remap-add-relative'
after it is already called.  For large files,
`face-remap-add-relative' can take more than 90% CPU time.  Set
`org-columns-header-line-remap' to nil when we remove the temporary
remapping.
2022-01-17 20:20:44 +08:00
Ihor Radchenko 7ba24c673b
ob-gnuplot: Fix wrong table conversion when first column has ?-
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Revert to
using ascii exporter.
* lisp/ox-ascii.el (org-ascii-table-cell): Do not throw error when
CONTENTS is wider than initial cell value.
2022-01-14 22:03:38 +08:00
Ihor Radchenko 9623da4408
ob-gnuplot: Fix wrong table conversion when first column has ?-
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Revert to
using ascii exporter.
* lisp/ox-ascii.el (org-ascii-table-cell): Do not throw error when
CONTENTS is wider than initial cell value.
2022-01-14 21:56:09 +08:00
Ihor Radchenko 6631b3f7bb
org-element--parse-to: Fix limit when pasting top-comment and no cache
* lisp/org-element.el (org-element--parse-to): Manually parse org-data
and set appropriate parser mode when POS is before first headline and
cache is disabled.
(org-element-org-data-parser--recurse): New variable flagging if
`org-element-data-parser' is called recursively.
(org-element-org-data-parser): Handle recursive calls from inside `org-element-at-point-no-context'.

This also fixes false-positives in `org-element--cache-verify-element'.
2022-01-14 14:29:16 +08:00
Mark A. Hershberger 1537bb4029
Fix signature for org-element-at-point 2022-01-12 22:26:10 +08:00
Ihor Radchenko a9b2e262cd
Merge branch 'bugfix' 2022-01-12 21:11:33 +08:00
Ihor Radchenko e8d6db540b
org-agenda-get-timestamps: Ignore non-timestamps matching re
* lisp/org-agenda.el (org-agenda-get-timestamps): Explicitly confirm
that object at point is a timestamp.

Fixes https://list.orgmode.org/20220102210433.GC29829@itccanarias.org/T/#m39b80d45d7d6cfc6b713284365c283579ac94cb1
2022-01-12 21:08:49 +08:00
Ihor Radchenko 34b0d95327
org-in-src-block-p: Do not rely on fontification
* lisp/org.el (org-in-src-block-p): New optional argument ELEMENT.
The code now relies on org-element API to check if we are inside
src-block.

Partially fixes https://list.orgmode.org/20220101200103.GB29829@itccanarias.org/T/#t
2022-01-12 21:08:41 +08:00
Ihor Radchenko 1f48d2d751
org-element-cache-map: Do not byte-compile FUNC
Byte compilation can unpredictably break agenda searches in some Emacs
builds.

See https://list.orgmode.org/PAXPR08MB6640260AFA03FCDFABE245A3A34F9@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#t
2022-01-10 22:32:38 +08:00
TEC 071c5e4bf1
org-entities: Fix LaTeX macron accent
* lisp/org-entities.el: The macron accent should be produced with the
text accent \=, not \bar which is a maths accent.
2022-01-10 00:38:32 +08:00
Ihor Radchenko dc4b2772e3
org-element-cache-map: Fix an edge case with org-element-cache-continue-from
* lisp/org-element.el (org-element-cache-map): Make sure that START is
never set to -1.  It may cause infinite loops in some scenarios.
* testing/lisp/test-org.el (test-org/map-entries): Add a test catching
the reported situation.

Reported in https://list.orgmode.org/CADywB5JHAyPX99Vr02SvAqiMTD+7ss4VWVipOhKfm=iGirDPhA@mail.gmail.com/T/#t
2022-01-07 22:10:22 +08:00
Ihor Radchenko 515ce56d4e
org-element-cache: Fix transforming keywords to affiliated
* lisp/org-element.el (org-element--cache-for-removal): Consider
preceding keywords to be updated unconditionally.
(org-element-cache-map): Fix infinite loop revealed by the new test.

* testing/lisp/test-org-element.el (test-org-element/cache-affiliated):
New test.
2022-01-07 21:24:43 +08:00
Ihor Radchenko a98ae424d2
org-element-cache: Give user more control over silent modificatoin checks
* lisp/org-element.el (org-element--cache-silent-modification-check):
New variable allowing the user to suppress modification checks completely.
* lisp/org-element.el (org-element--cache-sync): Support
`org-element--cache-silent-modification-check'.

The existing heuristics for built-in non-modifying commands that
change `buffer-chars-modified-tick' is not sufficient.  At least
`capitalize-word' changes the tick regardless whether the buffer was
actually modified or not.  Yet, `capitalize-word' does not call
`after-change-functions' if the buffer is not really modified.

Reported in https://list.orgmode.org/2022-01-06T12-13-17@devnull.Karl-Voit.at/T/#mb3771758f81b31721ba2f420878a4d16081dc483
2022-01-06 20:16:00 +08:00
Kyle Meyer fe70c4d259 ox-koma-letter: Collapse space in copyright line
Match the space change made in Emacs's 19dcb237b5b (; Add 2022 to
copyright years, 2022-01-01) to avoid noise when syncing to the Emacs
repo.
2022-01-01 17:47:00 -05:00
Kyle Meyer b8656a2cef Update main-only copyright years 2022-01-01 15:25:06 -05:00
Kyle Meyer aae2ac3a68 Merge branch 'bugfix' 2022-01-01 15:21:37 -05:00
Kyle Meyer 5a229cbc44 Update copyright year to 2022 2022-01-01 15:17:08 -05:00
Ihor Radchenko 06f58e4759
org-element-cache-map: Fix when FUNC deletes current element
* lisp/org-element.el (org-element-cache-map-continue-from): New
variable forcing `org-element-cache-map' to continue from a custom
point in buffer.
(org-element-cache-map): Add support for
`org-element-cache-map-continue-from'.  Update docstring accordingly.
Also, make sure that mapping terminates correctly when FUNC deletes
all elements in buffer.
* testing/lisp/test-org.el (test-org/map-entries): Add test.

Fixes https://orgmode.org/list/CADywB5KOJ1p0NpvA=iX-ybHsO=huGA8qL3xMpUTETmS2qp7_ng@mail.gmail.com
2022-01-01 14:13:26 +08:00
Ihor Radchenko eb9f34222a
ob-gnuplot: Fix regression from 23d8d59df when ox-org is not loaded
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Require
ox-org, making sure that org export backend is available.
2021-12-27 00:46:00 +08:00
Ihor Radchenko c614234688
ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
backend when exporting table data to plain text table.  ascii backend
incorrectly handles quote transcoders that change the column width and
sometimes throws an error.  (ascii backend simply ignores transcoded
table cells and calculates width based on the initial cell text).
2021-12-27 00:45:39 +08:00
Ihor Radchenko d012350dad
org-persist: Report read/write duration
* lisp/org-persist.el (org-persist--report-time): New variable
controlling time reporting.  The default value is to report if
read/write opeartion takes over 0.5 sec.
(org-persist-write):
(org-persist-read): Display message about read/write duration for each
variable according to `org-persist--report-time'.
2021-12-25 23:36:26 +08:00
Ihor Radchenko ecce81dace
Merge branch 'bugfix' 2021-12-25 22:26:48 +08:00
Ihor Radchenko 377d6247af
org-clock-timestamps-down: Fix typo in docstring
Reported in https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-12/msg01841.html
2021-12-25 22:25:24 +08:00
Bastien fbff082f73 Update to version 9.5.2
* lisp/org.el: Update to version 9.5.2.
2021-12-24 21:01:49 +01:00
Ihor Radchenko 8f50ea2d69
org-element--parse-to: Get rid of unnecessary cache lookup
* lisp/org-element.el (org-element--parse-to): Disable cache in
`org-element--current-element'.  When calling it here, we know for
sure that element at point is not yet in cache.
2021-12-24 12:30:09 +08:00
Ihor Radchenko 410afd6f37
Revert "org-do-emphasis-faces: Never treat closing marker as next opening marker"
This reverts commit fa315986a1.

The commit broke fontification of nested emphasis like
/italic *bold* more italic/.
2021-12-22 23:51:51 +08:00
Ihor Radchenko e0b1a05460
org-persist-unregister: Fix when BUFFER is not 'all
* lisp/org-persist.el (org-persist-unregister): Use `string=' instead
of `eq' to compare strings.  `eq' always returns nil here.
2021-12-22 10:22:04 +08:00
Ihor Radchenko 0b670aa8e8
org-persist: Support old Emacs without file-attribute-inode-number
* lisp/org-persist.el (org-persist--get-index): Check is
`file-attribute-inode-number' function exists.  It was not there in
Emacs 25.

Fixes https://list.orgmode.org/CAJcAo8s21R1dRrxpaHV=h68RtWctLd6giFskw1vpt9fQh81dDw@mail.gmail.com/T/#u
2021-12-20 23:00:01 +08:00
Ihor Radchenko 344b99070f
org-persist.el: Make org-persist-directory a custom variable
* lisp/org-persist.el (org-persist): Create org-persist customisation
group.
(org-persist-directory): Convert into defcustom.
2021-12-20 23:00:00 +08:00
Kyle Meyer e26b825e6e Merge branch 'bugfix' 2021-12-18 13:21:14 -05:00
Kyle Meyer a18849b786 org-babel-tangle-file: Revert recent change in return value
* lisp/ob-tangle.el (org-babel-tangle-file): Restore the recently
removed prog1 so that the return value matches the documented one.
2021-12-18 13:20:45 -05:00
Kyle Meyer f4e72ffcd4 org-babel-tangle-file: Fix void variable error from last commit
* lisp/ob-tangle.el (org-babel-tangle-file): Switch let to let* to fix
void variable error.
2021-12-18 13:16:26 -05:00
Nicolas Goaziou 2b7ea20346 Merge branch 'bugfix' 2021-12-18 15:41:13 +01:00
Nicolas Goaziou aabcf9edf2 ob-tangle: Ignore narrowing when tangling a file
* lisp/ob-tangle.el (org-babel-tangle-file): Ignore narrowing in
a buffer visiting the file being tangled.
2021-12-18 15:40:25 +01:00
Ihor Radchenko d45bd627ce
Merge branch 'bugfix' 2021-12-18 21:17:43 +08:00
Ihor Radchenko 1778eb94c5
org-habit: Preserve invisibility when inserting consistency graph
* lisp/org-habit.el (org-habit-insert-consistency-graphs): Inherit
'invisible text property of the habit line when the habit is hidden in
agenda.

Fixes https://orgmode.org/list/PAXPR06MB776069E9085C1CD606156493C6709@PAXPR06MB7760.eurprd06.prod.outlook.com
2021-12-18 21:12:22 +08:00
Ihor Radchenko ed392bc1c9
Merge branch 'bugfix' 2021-12-18 16:12:59 +08:00
Ihor Radchenko 85aaa19908
org-agenda: Make sure that time grid is aligned when hour <10
* lisp/org-agenda.el (org-agenda-format-item): Make sure that hour
part of begin time in time grid always occupy 5 chars

Fixes https://list.orgmode.org/orgmode/3afe1bba.2f48.17c350d0a41.Coremail.tumashu@163.com/
2021-12-18 16:07:58 +08:00
Ihor Radchenko 4426d8009f
org-element-cache: Fix Phase 1 when new parent overlaps future edits
* lisp/org-element.el (org-element--cache-process-request): New OFFSET
argument used to correct newly added parents during Phase 1.  The
`org-element--parse-to' call inside Phase 1 may add new elements to
cache that intersect with future edits.  Boundaries of these elements
may be shifted twice, so we have to offset the future shift.

(org-element--cache-sync): New OFFSET argument providing future change
info to `org-element--cache-process-request'.

(org-element--cache-submit-request): Provide offset value in
`org-elemnt--cache-sync' call.

(org-element--cache-submit-request):
(org-element--cache-process-request):
(org-element--cache-sync): Never use %d format for region boundaries.
It may be a marker and cause error.  Use %S instead.

(org-element--cache-process-request): Use unique symbols for
catch-throw.

Fixes https://list.orgmode.org/CAFyQvY3Qv5xn-ET83L6Rzg-V1zOVu4y1gt+-_CpfaWNAdt87xA@mail.gmail.com/T/#t
2021-12-17 22:48:20 +08:00
Ihor Radchenko e2a8e95576
org-element-cache: Fix when edit extends previous element
* lisp/org-element.el (org-element--cache-after-change): Always extend
changed region to bol.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking the new fix.  Amend some tests around making sure that cache
is active during testing.
2021-12-17 20:23:50 +08:00
Ihor Radchenko d6e6a9a3bc
org-element.el: Silence compiler 2021-12-17 20:23:11 +08:00
Ihor Radchenko 895e0baadf
ob-gnuplot: Fix regression from 23d8d59df when ox-org is not loaded
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Require
ox-org, making sure that org export backend is available.
2021-12-17 10:17:40 +08:00
Ihor Radchenko 092e921423
org-element-cache-map: Fix when start is nil after buffer modification 2021-12-16 23:17:05 +08:00
Ihor Radchenko 3338f37061
org-element--cache-process-request: Fix format specifier allowing marker
Fixes https://list.orgmode.org/CAFyQvY2=M6-JO7k=dF74injM7kHCcGUgdCCZXM6TZPWDTGbR4A@mail.gmail.com/T/#t
2021-12-16 23:16:31 +08:00
Ihor Radchenko de022ed654
Merge branch 'bugfix' 2021-12-16 21:43:56 +08:00
Ihor Radchenko 325b06bde4
org-element-cache: Do not carry over warning after sync
* lisp/org-element.el (org-element--cache-sync): Set
`org-element--cache-warning' to nil at the end of synchronisation.
We do not need to consider that next request might be merged with
existing request in such scenario.
(org-element--cache-before-change): Add comment explaining the use of `org-element--cache-warning'.
2021-12-16 21:39:26 +08:00
Ihor Radchenko d267486002
org-element-cache: Fix some edits right after indent at :begin
* lisp/org-element.el (org-element--cache-after-change): Extend
changed region to bol when we are editing near beginning of an element
within or right after indentation.  Such edits potentially change
:post-blank value of the previous element.
* testing/lisp/test-org-element.el (test-org-element/cache): Add test
checking one of such cases.
2021-12-16 21:39:25 +08:00
Ihor Radchenko 7ec9e37117
org-tree-to-indirect-buffer: Fix when last headline is empty at point-max
* lisp/org.el (org-tree-to-indirect-buffer): Consider scenario when
`org-end-of-subtree' with 't second arg moves to `point-max' at the
end of an empty headline.  We do not need to move back the point then.

Fixes https://orgmode.org/list/CA+AFVDUF3RzA-mnoAp8yFv-bppoYJfJo=Wa8qmNQhV-tfHHB+w@mail.gmail.com
2021-12-16 21:39:24 +08:00
Ihor Radchenko 5840e4d61a
org-element-cache Do not make headline non-robust after changes at :end
* lisp/org-element.el (org-element--cache-for-removal): When changes
involve :end of a headline, allow it to be re-parsed synchronously.
2021-12-16 11:39:23 +08:00
Ihor Radchenko 69985367cd
org-element-cache: Consider non-PROPERTIES drawers robust
* lisp/org-element.el (org-element--cache-for-removal): Drawers are
generally robust elements (they cannot be changed if a non-sensitive
change is made inside their contents).  The only exception is
PROPERTIES drawer that may switch back and forth between ordinary
drawer and properties drawer depending on its contents.  The old code
treated all possible drawer as non-robust for this reason, degrading
performance on large LOGBOOK drawers that are now processed much
faster since they do not need to be removed and re-parsed on every
single change.
2021-12-16 11:26:54 +08:00
Ihor Radchenko 6339c622f8
org-element-cache: Do not consider BEGIN lines of elements sensitive
* lisp/org-element.el (org-element--cache-sensitive-re): Remove
 #+begin_ and \begin{ lines from sensitive regexp.  Such changes can
 be handled without a need to re-parse from earlier position.  If a
 change introduces a new element, the new element will be recognised
 and the unupdated elements not intersecting with the new element will
 be handled during Phase 1.
2021-12-16 11:23:33 +08:00
Ihor Radchenko fd93ad698a
org-element-cache: Do not treat inserting newline at :begin sensitive
* lisp/org-element.el (org-element--cache-before-change): Do not match
`org-element--cache-sensitive-re' against an element starting at END
when END is at bol.  Such changes never break an element structure (as
opposed to inserting non-newline right at :begin of an element).
2021-12-16 11:20:32 +08:00
Ihor Radchenko cfe4b17d96
org-element-cache: Optimise changed property drawer detection
* lisp/org-element.el (org-element--cache-for-removal): Only force
re-parsing headlines when the changed region falls within the headline
before property drawer end position.
2021-12-16 11:18:00 +08:00
Ihor Radchenko 23d8d59df8
ob-gnuplot: Use org backend when assigning table to variable
* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Switch to 'org
backend when exporting table data to plain text table.  ascii backend
incorrectly handles quote transcoders that change the column width and
sometimes throws an error.  (ascii backend simply ignores transcoded
table cells and calculates width based on the initial cell text).
2021-12-16 11:14:59 +08:00
Nicolas Goaziou 8908fba113 compat: Silence byte-compiler 2021-12-12 16:21:04 +01:00
Nicolas Goaziou f8cd8a6645 oc-biblatex: Generate cite styles dynamically
* lisp/oc-biblatex.el (org-cite-biblatex-list-styles): New function.
Use it when registering `biblatex' citation processor.
2021-12-12 16:17:56 +01:00
Nicolas Goaziou cfffdf5e1a oc-biblatex: Add missing shortcut
* lisp/oc-biblatex.el (org-cite-biblatex-style-shortcuts): Add missing shortcut.
2021-12-12 16:09:24 +01:00
Nicolas Goaziou e995e069ca oc-biblatex: Allow style customization
* lisp/oc-biblatex.el (org-cite-biblatex-styles):
(org-cite-biblatex-style-shortcuts): New defcustoms.
(org-cite-biblatex--expand-shortcuts): New function.
(org-cite-biblatex-export-citation): Extract adequate style from
defcustoms above instead of hard-coding all styles.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou 82bb04be22 oc-biblatex: Spell out multicite commands instead of guessing them
* lisp/oc-biblatex.el (org-cite-biblatex-export-citation): Provide
full multicite command name.
(org-cite-biblatex--command): Use name instead of guessing it from
base name.
2021-12-12 15:42:29 +01:00
Nicolas Goaziou 7e2d9091d0 oc: Allow declaring cite styles as a function
* lisp/oc.el (org-cite-register-processor): Allow a function
as :cite-styles value.
(org-cite-supported-styles): Propagate change above.
* testing/lisp/test-oc.el (test-org-cite/supported-styles): Add test.
2021-12-12 15:42:29 +01:00