1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-26 07:33:39 +00:00
Commit Graph

24698 Commits

Author SHA1 Message Date
Nicolas Goaziou
74b1eefa5e Merge branch 'bugfix' 2021-11-03 16:54:04 +01:00
Nicolas Goaziou
d0201d5801 oc-csl: Fix global affixes
* lisp/oc-csl.el (org-cite-csl--create-structure): Properly
concatenate global affixes to the first or last cite, as intended.
2021-11-03 16:50:07 +01:00
Nicolas Goaziou
e0bbfe63a4 oc-bibtex: Use `org-cite-main-affixes'
* lisp/oc-bibtex.el (org-cite-bibtex-export-citation): Call
`org-cite-main-affixes'.
2021-11-03 16:30:09 +01:00
Nicolas Goaziou
498a76857b Merge branch 'bugfix' 2021-11-03 16:29:59 +01:00
Nicolas Goaziou
ad40282860 oc: Refactor affixes extraction
* lisp/oc.el (org-cite-main-affixes): New function.
* lisp/oc-natbib.el (org-cite-natbib--build-optional-arguments): Use
new function.
* testing/lisp/test-oc.el (test-org-cite/main-affixes): New test.
2021-11-03 16:27:53 +01:00
Nicolas Goaziou
073d9c6b6b Merge branch 'bugfix' 2021-11-03 16:14:27 +01:00
Nicolas Goaziou
37c99e0874 oc-basic: Also extract year from "date" field
* lisp/oc-basic.el (org-cite-basic--get-year): Try extracting year
from "date" field when "year" field is empty.  Add optional argument
to prevent disambiguation mechanism.
(org-cite-basic--print-entry):
(org-cite-basic--key-completion-table): Use `org-cite-basic--get-year'
instead of `org-cite-basic--get-field'.
2021-11-03 16:12:42 +01:00
Ihor Radchenko
dc0c60f123
org-element-parse-buffer: Avoid interference with element cache
* lisp/org-element.el (org-element-copy): Make sure that element
properties containing secondary objects are also copied.
(org-element--parse-elements): Avoid modifying cached elements.

Fixes https://list.orgmode.org/CAHyO48yS2EAJnhiYoK7syjb1_Fbfxcv2A0fk4t5RFzTLj1hSGA@mail.gmail.com/
In the backtrace provided in the email, org-roam calls to
`org-element-parse-buffer' add uncached `org-data' element as cached
element `:parent' property.  Uncached elements in `:parent' property
break the cache code.
2021-11-03 19:36:41 +08:00
Nicolas Goaziou
2e99997830 Merge branch 'bugfix' 2021-11-02 18:40:04 +01:00
Nicolas Goaziou
95ad5a954b oc-csl: Small refactoring
* lisp/oc.el (org-cite-wrap-citation): Mention return value.
* lisp/oc-csl.el (org-cite-csl--create-structure): Use return value
from `org-cite-wrap-citation' instead of using `org-element-lineage'.
2021-11-02 18:39:09 +01:00
Nicolas Goaziou
7d769615fd Merge branch 'bugfix' 2021-11-02 18:34:43 +01:00
András Simonyi
16dcfdfa80 oc-csl: Fix footnote status reporting for wrapped citations
* lisp/oc-csl.el (org-cite-csl--create-structure): Update footnote information
when citation is wrapped in a footnote.
2021-11-02 18:34:28 +01:00
Nicolas Goaziou
266a151d08 Merge branch 'bugfix' 2021-11-02 15:08:37 +01:00
Vinicius
f135889ca1 macro: Fix keyword macro with multiple keywords
* lisp/org-macro.el (org-macro-initialize-templates): Properly collect
multiple keywords' values with "keyword" macro.
2021-11-02 15:07:53 +01:00
Kyle Meyer
0a21425c84 Merge branch 'bugfix' 2021-11-01 20:52:23 -04:00
Hanno Perrey
e7085eaa57 Backport commit f1c928637 from Emacs
* doc/org-manual.org (Templates in contexts): Add missing parenthesis to
code example for org-capture template contexts as documented in
docstring.

; * doc/misc/org.org: fix capture context example
f1c9286376d570e898d349200412021fd67e13d2
Hanno Perrey
Sun Oct 31 16:23:41 2021 +0100
2021-11-01 20:46:17 -04:00
Ihor Radchenko
7a6f48ab4a
org-persist-read: Do not raise warning on known read error 2021-11-01 20:47:11 +08:00
Ihor Radchenko
6621ee32e4
org-persist.el: Do not try to follow XDG on Windows
* lisp/org-persist.el (org-persist-directory): `xdg-cache-home'
apparently returns "~/.cache" even on Windows.  Fallback to
`user-emacs-directory' when the directory returned by `xdg-cache-home'
does not exist.

Reported in https://list.orgmode.org/CAPY3P0RWTkUv_5q0aJjgmpaDGzxYYrs0z4vyEF2Sxpua7BtztA@mail.gmail.com/T/#u
2021-11-01 19:28:16 +08:00
Ihor Radchenko
d4e1925147
org-element--cache-warn: Provide command backtrace 2021-10-31 10:39:40 +08:00
Ihor Radchenko
49e2f6c1ab
org-element-cache-map: Check if `native-comp-available-p' is defined
Fixes https://list.orgmode.org/87tugzinxz.fsf@gmail.com/T/#u
2021-10-30 10:05:17 +08:00
Ihor Radchenko
9f87b1cc33
org-element.el: Handle cache requests inside `combine-change-calls'
* lisp/org-element.el (org-element--cache-active-p): Prevent cache
queries when `org-element--cache-after-change' is not in
`after-change-functions'.  `after-change-functions' can be temporalily
set to nil by i.e. `combine-change-calls'.  We should not try to get
information from cache in such scenarios because cache may not yet be
up-to-date.  The modifications will only be registered upon exiting
the `combine-change-calls' macro.

Fixes https://list.orgmode.org/875ytggcuk.fsf@yandex.com/T/#t
2021-10-29 22:23:18 +08:00
Ihor Radchenko
1b2d06880f
org-persist.el: Do not write global variables on buffer kill
* lisp/org-persist.el (org-persist-write-all): Prevent writing global
variables when BUFFER arg is provided.
(org-persist-gc): Handle case when :persist-file is set to nil in the
index.

Fixes https://list.orgmode.org/DB9PR08MB66336CDF0F43DE3DB1D08649A3869@DB9PR08MB6633.eurprd08.prod.outlook.com/T/#m40fcc5ea8ba0ef52518a58713cf9ad3d1fffa33d
2021-10-28 22:32:50 +08:00
Ihor Radchenko
5abd149cf1
org-persist-write: Do not try to write cache when killing indirect buffer 2021-10-28 09:11:14 +08:00
Ihor Radchenko
91523479fb
org-scan-tags: Fix `org-agenda-change-all-lines' when prefix has effort
* lisp/org.el (org-scan-tags): Add `effort' and `effort-minutes' to
full agenda line, not just its heading string part.
`org-agenda-change-all-lines' expects the properties to be at BOL.
2021-10-27 23:44:41 +08:00
Ihor Radchenko
b135b8c7ae
org-element-cache: Rename interrupt' org-element--cache-interrupt'
* lisp/org-element.el (org-element--cache-sync,
org-element--cache-process-request, org-element--parse-to): Some other
code (at least, `org-indent-mode') is using `interrupt' signal in
`after-change-functions'.  Rename `interrupt' signal used in
org-element-cache to unique `org-element--cache-interrupt'.

Reported in https://list.orgmode.org/PAXPR08MB66400699DACEB31F4F0650F1A3849@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#u
2021-10-27 23:12:04 +08:00
Ihor Radchenko
cc3df3af2a
org--backward-paragraph-once: Fix infinite loop at first element in section
* lisp/org.el (org--backward-paragraph-once): Do not consider section
parent as greater element.  section elements starts at the same point
with its first child and we do not want to "move" from beginning of
child to the beginning of the section.

Fixes https://list.orgmode.org/87cznsnql6.fsf@localhost/T/#t
2021-10-27 23:09:02 +08:00
Ihor Radchenko
5ca866d08a
org-persist.el: Detect buffer-locals vars for moved files
* lisp/org-persist.el (org-persist--get-index): Match buffer inode and
hash if path does not match.
(org-persist-read-all): Do not require file path match before trying
to read local variables.
(org-persist-read): Do not try to read non-existing data.
2021-10-27 22:51:43 +08:00
Ihor Radchenko
994cad9fed
org-element.el/org-element--cache-self-verify: Update docstring
* lisp/org-element.el (org-element--cache-self-verify): Mention
`org-element--cache-self-verify-frequency' in the docstring.
2021-10-27 17:43:36 +08:00
Ihor Radchenko
52cdf53328
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-10-27 14:51:29 +08:00
Ihor Radchenko
f2b52f411c
org.el/org-scan-tags: Fix effort in tags agenda views
* lisp/org.el (org-scan-tags): Manually add effort and effort-minutes
properties to be used by agenda.
2021-10-27 11:11:03 +08:00
Ihor Radchenko
801be9dcd0
org-element-cache-map: Reduce regexp search overheads
* lisp/org-element.el (org-element--cache-gapless): New variable
tracking when cache does not contain gaps.
(org-element-cache-reset): Initialise `org-element--cache-gapless'.
(org-element-cache-map): Fill the cache gaps before running FUNC
query.  When multiple calls to `org-element-cache-map' are done on
unchanged buffer, pre-processing only requires a single regexp search
pass across i.e. headlines.  Subsequent `org-element-cache-map' calls
can then be reduced to a simple cache tree walk.
2021-10-27 11:11:03 +08:00
Ihor Radchenko
244bc7d174
org-element-cache-map: Improve compiled function check
* lisp/org-element.el (org-element-cache-map): Do not try to
byte-compile subroutines and natively compiled functions.
2021-10-27 11:11:02 +08:00
Ihor Radchenko
cf8906eee0
org-agenda-get-todos: Fix effort-up sorting in todo agenda
* lisp/org-agenda.el (org-agenda-get-todos): Calculate effort-minutes
before adding it as text property in agenda line.

Reported in https://old.reddit.com/r/emacs/comments/qfqcip/sorting_by_effort_doesnt_work_on_latest_org/
2021-10-26 09:47:58 +08:00
TEC
9dc08c9093
org: Don't change image size based on font size
* lisp/org.el (org--create-inline-image): Set :scale parameter to 1 to
prevent font-size based rescaling.

When `create-image' is called without the :scale parameter, the image
size is expanded based on the default font size (if it is larger than
10px).  When displaying images with a specified width in Org buffers,
either in pixels or proportional to the text width, this width should
not be modified according the to font size.  Giving a :scale parameter
of 1 prevents this font-size based rescaling.
2021-10-25 21:48:04 +08:00
TEC
76f33fea31
oc-csl: Support bare author citations
* lisp/oc-csl.el (org-cite-csl--create-structure-params): Add support
for bare (b), bare-caps (bc), bare-full (bf), and bare-caps-full (bcf)
author citation styles.
2021-10-25 21:46:26 +08:00
Ihor Radchenko
4c6595d2b4
org-in-archived-heading-p: Use ELEMENT arg more optimally
* lisp/org.el (org-in-archived-heading-p): Do not check for point
position when ELEMENT is provided and use ELEMENT when checking
archive status of ancestors.
2021-10-25 19:15:14 +08:00
Ihor Radchenko
30f1f187d1
org-element-cache-map: Improve speed
* lisp/org-element.el (org-element-cache-map): Remove unnecessary
expensive let binding.
2021-10-25 19:13:23 +08:00
Ihor Radchenko
5f4fd0880a
org--get-expected-indentation: Consider section parent type
* lisp/org.el (org--get-expected-indentation): Consider new :parent
structure when `org-element-at-point' returns parent section and
headline elements.

* testing/lisp/test-org.el (test-org/indent-region): Add test.

Fixes https://list.orgmode.org/87pmrupu0s.fsf@gmail.com/T/#t
2021-10-24 19:46:00 +08:00
Ihor Radchenko
e2fa3c4c40
org-element-cache-map: Increase minimal Emacs version in 717a847d6
* lisp/org-element.el (org-element-cache-map): Do not byte-compile
FUNC in Emacs 28 as well.  Some variants of Emacs 28 do not
byte-compile the lambda correctly [1].

[1] https://list.orgmode.org/87tuha62rq.fsf@localhost/T/#ma9f23ef9e96de01c53451f40d097e4ce2fd51571
2021-10-24 16:38:52 +08:00
Nicolas Goaziou
d2f4d4b457 Merge branch 'bugfix' 2021-10-23 14:33:18 +02:00
Nicolas Goaziou
52e6f1cf57 macro: Properly collect multiple authors
* lisp/org-macro.el (org-macro--collect-macros): Multiple lines are
allowed for AUTHOR keyword (per `org-export-options-alist') so make
sure we collect all of them.
* testing/lisp/test-org-macro.el (test-org-macro/author): Add test.

Reported-by: Vinicius Vinicius <vinicius.vin@yandex.com>
<http://lists.gnu.org/r/emacs-orgmode/2021-10/msg00727.html>
2021-10-23 14:32:00 +02:00
Ihor Radchenko
717a847d64
org-element-cache-map: Do not byte-compile FUNC in older Emacs
* lisp/org-element.el (org-element-cache-map): Fix reported bug [1]
when some agenda items are missing when `org-element-cache-map' is
called from `org-agenda-get-scheduled'.  Byte compilation of FUNC
matcher somehow fails to produce equivalent function in Emacs <28.

[1] https://list.orgmode.org/87tuha62rq.fsf@localhost/T/#t
2021-10-23 19:34:35 +08:00
Nicolas Goaziou
d3143feaf7 Fix sloppiness when collecting keywords
* lisp/org.el (org--collect-keywords-1): Use an accurate
function instead of an approximation. Accuracy trumps speed when parsing.
* testing/lisp/test-org.el (test-org/collect-keywords): New test.
2021-10-23 11:18:10 +02:00
Ihor Radchenko
6ca685c3c5
org-element.el: Encourage bug reports in case of cache issues
* lisp/org-element.el (org-element--cache-remove,
org-element--cache-sync, org-element--cache-process-request,
org-element--parse-to, org-element--cache-for-removal,
org-element--cache-verify-element, org-element-at-point): Update
warning messages.
2021-10-23 14:09:15 +08:00
Ihor Radchenko
0a92b2db19
org-element.el: Allow user to interrupt cache sync by default
* lisp/org-element.el (org-element--cache-interrupt-C-g,
org-element--cache-interrupt-C-g-max-count,
org-element--cache-interrupt-C-g-count): Add docstring and change
default value of `org-element--cache-interrupt-C-g' to t.
(org-element--parse-to): Show informative message when user tries to
interrupt in the middle of cache sync.
2021-10-23 14:02:44 +08:00
Ihor Radchenko
5315773e8a
Fix "Variable binding depth exceeds max-specpdl-size"
* lisp/org-persist.el (org-persist-register): Fix `add-hook' args.

Reported in:
https://list.orgmode.org/8735ouxz6y.fsf@yandex.com/
https://list.orgmode.org/1012598.1634829727@apollo2.minshall.org/T/#u
2021-10-21 23:58:03 +08:00
Ihor Radchenko
79971b748d
org-element.el: Prevent cache key collisions
* lisp/org-element.el (org-element--cache-sync,
org-element-cache-reset): Do not use `buffer-chars-modified-tick' as
`org-element--cache-sync-keys-value'.  Instead, make sure that
`org-element--cache-sync-keys-value' is always changed upon completing
cache request sequence.  Using `buffer-chars-modified-tick' can
trigger using obsolete sync keys after we add elements to cache via
`org-element--parse-to' after cache sync is completed, but no other
changes were made in the buffer.  The newly added elements are then
not comparable with the obsolete sync keys.

(org-element--cache-persist-before-write): Cleanup
`:org-element--cache-sync-key' from elements before saving element
cache to file.  If we do not do it, obsolete keys may be reused
inintentionally during next Emacs session.
2021-10-21 23:38:42 +08:00
Ihor Radchenko
4eab5bd3f0
org-element: Allow force-quitting during cache sync
* lisp/org-element.el (org-element--cache-interrupt-C-g,
org-element--cache-interrupt-C-g-max-count,
org-element--cache-interrupt-C-g-count): New variables controlling
force-quitting cache sync process.  If
`org-element--cache-interrupt-C-g' is non-nil, user can force
terminating syncronisation request even in the middle of sync process
by invoking `keyboard-quit'
`org-element--cache-interrupt-C-g-max-count' times.
`org-element--cache-interrupt-C-g-count' stores the number of
invokations during current sync process.

(org-element--cache-sync): Initialise
`org-element--cache-interrupt-C-g-count' before processing sync
request.
(org-element--parse-to): Handle interruption in potentially infinite
loop.
2021-10-21 20:05:05 +08:00
Ihor Radchenko
a149fdd569
org-agenda-get-scheduled: Fix deadline value when using cache
* lisp/org-agenda.el (org-agenda-get-scheduled): First `deadline'
let-binding when element cache is enabled should not be timestamp
element, but a string.  Make it so.

Reprted in https://list.orgmode.org/87tuhazs36.fsf@localhost/T/#t
2021-10-21 16:50:10 +08:00
Ihor Radchenko
f7403e56eb
org-element--cache-submit-request: Re-enable future-change
* lisp/org-element.el (org-element--cache-submit-request): Re-enable
FUTURE-CHANGE argument in `org-element--cache-sync' call.  Without
this argument, cache can be processed incorrectly because elements
within changed region may be shifted and not deleted in subsequent
phase 0 request.
2021-10-21 14:58:40 +08:00