Commit Graph

24745 Commits

Author SHA1 Message Date
Ihor Radchenko 7a14d6035c
Fix element property queries for inlinetasks
* lisp/org.el (org-get-tags): Do not ignore local tags in inlinetasks.
(org-in-commented-heading-p): Do not ignore commented inlinetasks.
* testing/lisp/test-org.el (test-org/get-tags): Add tests for
inlinetasks.

Fixes https://list.orgmode.org/CAKJdtO8-KkVvhcviTqhi+DMZmSK=o37jn1jJPM9qxcuXZPnGgw@mail.gmail.com/T/#u
2021-11-22 19:34:21 +08:00
Matt Huszagh cd3e138ee5
org.el: Improve inline image width calculation
* lisp/org.el (org-display-inline-image--width): When
display-line-numbers-width is nil, the width is computed dynamically.
This does not mean that the line number width is necessarily 0.
2021-11-22 03:13:04 +08:00
Ihor Radchenko 54da1d6d7b
org-element--cache-process-request: Fix phase 2 with nil parent field
* lisp/org-element.el (org-element--cache-process-request): Fix
potential error raised when merging phase 2 requests with current
request having nil parent field.

Should help with https://list.orgmode.org/PAXPR08MB664034C85DDC73D21AD1CB0FA39E9@PAXPR08MB6640.eurprd08.prod.outlook.com/T/#t
2021-11-21 17:52:40 +08:00
Ihor Radchenko 28d47cfb82
org-element--cache-sync: Do not show warning on known safe modifications
* lisp/org-element.el (org-element--cache-sync): Do not raise warning
when `buffer-chars-modified-tick' changes safely outside
org-element-cache visibility.  Safe modifications are detected
according to heuristics based on `buffer-chars-modified-tick' and
`buffer-modified-tick'.  Their difference contains footprint for some
known [1,2,3] modifications triggered by Emacs internals.  However,
still reset cache to avoid false-positives for all but one [1] type of
modification.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-11/msg01069.html
[2] https://list.orgmode.org/YYy9Hx8mNQN08U7e@smoon.bkoty.ru/T/#t
[3] https://list.orgmode.org/87ee7jdv70.fsf@localhost/T/#t
2021-11-21 16:26:00 +08:00
Clément Pit-Claudel ebd06c15b5
org-src: Reset buffer-modified-p after fontifying
* lisp/org-src.el (org-src-font-lock-fontify-block): Reset the
modification flag of the temporary fontification buffer after
fontifying.

Without this some modes cause Emacs to prompt about unsaved buffers
when exiting: "Save buffer *org-src-fontification:...-mode*?".
2021-11-21 14:59:43 +08:00
Kyle Meyer 27edae8ced tangle: Fix :version keyword of org-babel-tangle-default-file-mode
* lisp/ob-tangle.el (org-babel-tangle-default-file-mode): Prefer
":package-version" to ":version".

The :version keyword should correspond to the Emacs version.  Using
the Org version leads to an incorrect help message:

  This variable was introduced, or its default value was changed, in
  version 9.6 of Emacs.

Instead go through :package-version so that the displayed message is

  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.
2021-11-20 14:36:21 -05:00
Kyle Meyer 58cc9efd7d Update customize-package-emacs-version-alist
* lisp/org.el (customize-package-emacs-version-alist): Map Org 9.6 to
Emacs 29.1.

Emacs 28.1 is nearing release.  The earliest Emacs version that Org
9.6 would be synced with is 29.1.
2021-11-20 14:36:10 -05:00
TEC b21d11c614
Document new :tangle-mode forms
* etc/ORG-NEWS: Mention new forms that :tangle-mode accepts.

* doc/org-manual.org (Header arguments): Mention new forms that
:tangle-mode accepts.
2021-11-21 03:06:20 +08:00
TEC e6ae351f96
ob-tangle: Rename org-babel-tangle-default-mode
* lisp/ob-tangle.el (org-babel-tangle-default-mode,
org-babel-interpret-file-mode): Rename `org-babel-tangle-default-mode`
to the slightly more apt `org-babel-tangle-default-file-mode`, and
update `org-babel-interpret-file-mode` accordingly.
2021-11-21 03:06:19 +08:00
Nicolas Goaziou 1db301a758 element: Drop `org-end-of-subtree' use
* lisp/org-element.el (org-element-headline-parser): Implement
a simple end of subtree search instead of relying on
`org-end-of-subtree'.
2021-11-20 19:54:41 +01:00
Kyle Meyer 69dbe86625 org-element: Silence byte-compiler
* lisp/org-element.el (org-element--cache-gapless): Move definition
before first use to remove byte-compiler warning about assignment to
free variable.
2021-11-20 13:52:48 -05:00
Bruce D'Arcus 9b398ba626 oc-basic: Add function to shorten names
* lisp/oc-basic.el (org-cite-basic--shorten-names): new function to
shorten author names

* lisp/oc-basic.el (org-cite-basic--print-entry): shorten author name
list for the "plain" output style
2021-11-20 19:40:36 +01:00
Kyle Meyer af40fa9ae7 Merge branch 'bugfix' 2021-11-20 13:22:37 -05:00
Stefan Kangas c5d6656328 Backport commit 42d4e24ff from Emacs
; Fix typos
42d4e24ff3f13ccbd401d93d70ecdee99b88a26d
Stefan Kangas
Fri Nov 12 13:59:58 2021 +0100
2021-11-20 13:03:45 -05:00
TEC 048f478799
ob-tangle: Make ls-style file mode regex stricter
* lisp/ob-tangle (org-babel-interpret-file-mode): Instead of allowing 9
characters from [rwx-], require [r-][w-][x-] repeated thrice.  This no
longer allows invalid ls-style file modes.
2021-11-20 22:57:20 +08:00
TEC ff6fd93876
ob-tangle: Check that integer file modes are valid
* lisp/ob-tangle.el (org-babel-interpret-file-mode): Check that the
integer as an octal represents a valid file mode, and complain
otherwise.
2021-11-20 22:57:20 +08:00
TEC 3a6686010e
ob-tangle: Use oXXX as file mode octal shorthand
* lisp/ob-tangle (org-babel-interpret-file-mode): Accept "o755" and
similar as octal shorthand. A non-digit character must be included as
otherwise `org-babel-parse-header-arguments' will convert it to a
base-10 integer.
2021-11-20 22:57:20 +08:00
Nicolas Goaziou 26e68816bd element: Integrate some syntax constants
* lisp/org-element.el (org-element-archive-tag):
(org-element-clock-line-re):
(org-element-comment-string):
(org-element-closed-keyword):
(org-element-deadline-keyword):
(org-element-scheduled-keyword):
(org-element-planning-keywords-re):
(org-element-planning-line-re):
(org-element-drawer-re):
(org-element-dynamic-block-open-re):
(org-element-headline-re): New constants.
(org-element-drawer-parser):
(org-element-dynamic-block-parser):
(org-element--footnote-separator):
(org-element--get-node-properties):
(org-element--get-time-properties):
(org-element-headline-parser):
(org-element-headline-interpreter):
(org-element-inlinetask-parser):
(org-element--list-struct):
(org-element-paragraph-parser):
(org-element-planning-parser):
(org-element-planning-interpreter):
(org-element--current-element):
(org-element--cache-for-removal):
(org-element-cache-map):
(org-element-context): Use new constants so as to not use org.el's.
* testing/lisp/test-org-element.el (test-org-element/headline-comment-keyword):
(test-org-element/headline-archive-tag):
* testing/lisp/test-ox.el (test-org-export/handle-options): Fix tests.
2021-11-20 11:37:52 +01:00
Nicolas Goaziou 652e8db821 Merge branch 'bugfix' 2021-11-19 09:53:56 +01:00
Nicolas Goaziou a51e4dc710 ox-icalendar: Fix error dangling footnotes
* lisp/ox-icalendar.el (icalendar): Add an inner-template function so
as to not use "ox-ascii"'s.
(org-icalendar-inner-template): New function.

This fixes <https://lists.gnu.org/archive/html/emacs-orgmode/2013-04/msg01478.html>
and <http://lists.gnu.org/r/emacs-orgmode/2021-11/msg00395.html>.

Footnote definition is lost, but references are already removed from
the description anyway, so the problem is not worse.
2021-11-19 09:53:13 +01:00
Jeremie Juste 58db28db04
ob-R: Tidy up bits of the async implementation
* ob-R.el (ob-session-async-org-babel-R-evaluate-session): Use
defvaralias for `ess-eval-visibly-p' instead of modifying user-defined
variable.  Remove temporary declaration that silences the byte-compiler.

* ob-R.el (org-babel-R-evaluate,
ob-session-async-org-babel-R-evaluate-session, org-babel-R-evaluate):
Remove mentions of unused argument `result-params'.
2021-11-18 18:42:38 +08:00
TEC fa97f9a395
ob-tangle: Accept more :tangle-mode forms
* lisp/ob-tangle.el (org-babel-tangle): Accept many more forms for
:tangle-mode, including octal strings (#o755, 0755, 755), ls forms (rwx,
rw-r--r--), and chmod forms (a=rw,u+x).  The interpretation of the input
is now handled by the new function `org-babel-interpret-file-mode' which
references the new variable `org-babel-tangle-default-mode' when
considering relative mode forms.
2021-11-18 18:18:00 +08:00
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