Commit Graph

24873 Commits

Author SHA1 Message Date
Bruce D'Arcus 30dbfc6cf1
org-manual: minor org-cite additions
* doc/org-manual.org (Handling citations): Add note and example to load
a processor package, and on the PRINT_BIBLIOGRAPHY keyword.
2021-11-18 16:07:07 +08:00
Ihor Radchenko faf8ce7dee
org-element--cache-sync: Ignore some more silent changes
* lisp/org-element.el (org-element--cache-sync): Add heuristics
skipping silent buffer changes made by quail.el when inserting "S-\"
using computer-russian input method.

Reported in https://list.orgmode.org/smre9o$hn1$1@ciao.gmane.io/
2021-11-15 19:39:29 +08:00
Ihor Radchenko bc3f385c97
org-element--cache-diagnostics-modifications: Fix docstring width 2021-11-15 19:39:28 +08:00
Ihor Radchenko fefb867d91
org-persist-write-all: Fix when BUFFER is nil 2021-11-15 19:39:17 +08:00
Nicolas Goaziou 2bbac432a8 org-element: Remove dependency on ’org-emph-re’
* lisp/org-element.el (org-element--parse-generic-emphasis): New fuction.
(org-element-bold-parser):
(org-element-code-parser):
(org-element-italic-parser):
(org-element-strike-through-parser):
(org-element-underline-parser):
(org-element-verbatim-parser): Use new function.

The consequence of this patch is that the syntax does not inherit from
unrelated limitations from ‘org-emph-re’, i.e., the number of lines
allowed in the markup.
2021-11-15 10:47:03 +01:00
Nicolas Goaziou c47b535bbd org-element: Remove dependency on ‘org-emphasis-regexp-components’
* lisp/org-element.el (org-element--set-regexps): Hard-code syntax,
since this is not configurable.
2021-11-14 15:13:41 +01:00
Ihor Radchenko 577b987972
org-element-cache: Honour org-odd-levels-only
* lisp/org-element.el (org-element--parse-to): Fix incorrect heading
regexps when `org-odd-levels-only' is non-nil.
(org-element--cache-before-change): Use reduced level for
`org-element--cache-change-warning' when headlines are modified.
2021-11-14 15:09:47 +08:00
Ihor Radchenko c3f4573758
org-element--cache-sync: Fix warning about unregistered modifications
* lisp/org-element.el (org-element--cache-diagnostics-modifications):
New variable to enable/disable warnings when unregistered
modifications are detected in Org buffers.
* lisp/org-element.el (org-element--cache-sync): Only show
"Unregistered modification" warning when
`org-element--cache-diagnostics-modifications' is non-nil or during
Org tests.  Add special handling for unregistered changes by
`replace-match' in Emacs <28.

Fixes https://list.orgmode.org/87pmr6lu1y.fsf@localhost/T/#t
2021-11-14 14:48:43 +08:00
Ihor Radchenko d8606c316e
org-element--cache-sync: Handle silent changes for non-latin input methods
* lisp/org-element.el (org-element--cache-sync): Detect silent changes
in buffer made by quail.el when non-latin input methods are active.
These silent changes do not modify the buffer, but only change
`buffer-chars-modified-tick' and do no affect element cache.  Note
that the detection uses heuristics.

Fixes https://list.orgmode.org/87sfw2luhj.fsf@localhost/T/#you
2021-11-13 22:43:44 +08:00
Ihor Radchenko 494c203639
org-element-at-point: Fix breakage when called at the end of section
* lisp/org-element.el (org-element-at-point): Do no unconditionally
return first matching cached element when point is within blank lines
after section element and CACHED-ONLY is non-nil.

Fixes https://list.orgmode.org/smbl59$qjm$1@ciao.gmane.io/T/#u
2021-11-10 21:23:08 +08:00
Nicolas Goaziou e961125768 oc: Fix docstring typos
* lisp/oc.el (org-cite-make-insert-processor): Fix typos in docstring.
Fill mostly under 60 characters.
2021-11-10 11:47:22 +01:00
Ihor Radchenko 876e813334
org-persist.el: Fix Emacs versions where xdg.el is not available
* lisp/org-persist.el (org-persist-directory): Make `xdg-cache-home'
call optional.  Prefer cache directory in `user-emacs-directory' when
the cache already exists there.

Fixes https://list.orgmode.org/CAFqubHf+WpuNEEapKcG94WjHFcRxVSF+j-7Ut3b_roMfKQchhg@mail.gmail.com/T/#m99c63439a745c07fd7c30cde0b49b3d5bd1757f0
2021-11-10 09:45:16 +08:00
Ihor Radchenko ded97b7672
org-element.el: Fix regression from d3836c1a1
* lisp/org-element.el: Do not require `backtrace'.  It is not
available in Emacs 26.
(org-element--cache-sync, org-element-at-point): Do not try to show
backtrace in warning when `backtrace' library is not available.

Reported in https://list.orgmode.org/d20a8753-8d0a-b4bf-c3fc-bce2f0a22392@gmail.com/T/#u
2021-11-09 08:39:20 +08:00
Marco Wahl 35e21b6161
org-goto: Fix UI
* lisp/org-goto.el (org-goto-location): Drop the wrap by
`org-no-popups'.  This restores the expected functionality of org-goto
with interface type 'outline.

See ml: https://list.orgmode.org/87mtnovv7f.fsf@alphapapa.net/.
2021-11-09 00:14:10 +08:00
Ihor Radchenko d3836c1a13
org-element.el: Add missing require for `backtrace' 2021-11-08 22:11:27 +08:00
Ihor Radchenko 343e228d6d
org-element-at-point: Provide more helpful warning in case of error
* lisp/org-element.el (org-element-at-point): Print current backtrace
when `org-element--parse-to' throws error.
2021-11-07 12:36:53 +08:00
Kyle Meyer dbd192bbc6 Merge branch 'bugfix' 2021-11-06 17:11:40 -04:00
Kyle Meyer ada13f916c test-oc: Fix incorrect expectation
* testing/lisp/test-oc.el (test-org-cite/main-affixes): Fix spacing in
an expected string.

Link: https://list.orgmode.org/878ry1ovz8.fsf@nicolasgoaziou.fr
2021-11-06 17:10:18 -04:00
Kyle Meyer 77e2ecd71f test-oc: Add missing space to test docstring 2021-11-06 13:21:52 -04:00
Juan Manuel Macías 85998490d9 ox-latex: add `options' latex attribute to tables
* lisp/ox-latex.el (org-latex--org-table): The `:options' LaTeX
attribute allows adding an optional argument (`\begin{env}[opt]'),
since certain tabular environments, such as `longtblr', accept optional
arguments.
* doc/org-manual.org (Tables in LaTeX export): this feature in the manual.
* etc/ORG-NEWS (New :options attribute when exporting tables to
LaTeX): this feature in `ORG-NEWS'.
2021-11-06 14:50:27 +01:00
Ihor Radchenko 1492fc5857
org-element--cache-persist-before-write: Avoid saving in non-org buffers
* lisp/org-element.el (org-element--cache-persist-before-write): Do
not try to save cache when buffer is not in Org mode and when cache is
not initialised.

Fixes https://list.orgmode.org/CAFyQvY1rEbL8LJWSR-q6sNgwS1_+Assyd=Jmv1YgeeQ_R3Yn5g@mail.gmail.com/T/#u
2021-11-05 22:21:33 +08:00
Ihor Radchenko ced2b33357
org-element--parse-to: Fix return value at the and of first section
* lisp/org-element.el (org-element--parse-to): Fix edge case when
calling `org-element--parse-to' at contents end point of first
section.  We need to return outermost element ending before point in
such scenario.

Fixes https://list.orgmode.org/01bc6137-200d-8e2d-fdd7-6aad8382c619@posteo.eu/T/#u
2021-11-04 23:04:57 +08:00
Nicolas Goaziou e4ee04eeae Merge branch 'bugfix' 2021-11-03 17:50:13 +01:00
Nicolas Goaziou 4e185becbf oc-basic: Use `org-cite-main-affixes' when appropriate
* lisp/oc-basic.el (org-cite-basic-export-citation): Use
`org-cite-main-affixes' when appropriate.
2021-11-03 17:49:41 +01:00
Sébastien Miquel 975462e653 Small fix to image width computation
org.el (org-display-inline-image--width): The variable
display-line-numbers-width is nil by default.
2021-11-03 17:23:56 +01:00
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