Commit Graph

17754 Commits

Author SHA1 Message Date
Ihor Radchenko 4dda0d7a8d
org-element: Fix org-element-timestamp-parser for incomplete ranges
* lisp/org-element.el (org-element-timestamp-parser): Use more strict
regexp to match second timestamp in timestamp--timestamp range.

Fixes https://list.orgmode.org/orgmode/87tuh88kjv.fsf@localhost/
2022-05-30 19:42:34 +08:00
Ihor Radchenko 1525a5a64e
org-babel-load-file: Do not rely on `org-babel-tangle-file' making changes
* lisp/org.el (org-babel-load-file): Update modification time even
when `org-babel-tangle-file' does not actually modify the tangled
file.  This makes sure that modify-time comparison logic does not make
Org re-tangle Org file that had been changed but the changes did not
affect the tangled code.

See https://orgmode.org/list/t5j75h$dbo$1@ciao.gmane.io
2022-05-30 11:02:08 +08:00
Ihor Radchenko f6f26d4ce4
org-babel-tangle: Do not overwrite when contents does not change
* lisp/ob-tangle.el (org-babel-tangle): Do not overwrite existing
tangled files if their contents is exactly the same as we are going to
write during tangle process.  This avoids unneeded disk writes and can
speed up tangling significantly when many small files are tangled from
a single .org source.

An example of performance improvement when tangling an .org file into
~200 files:
(benchmark-run 10 (org-babel-tangle))
Before the commit (on SSD): (76.33826743 8 11.551725374)
After the commit:           (43.628606052 4 5.751274237)
2022-05-30 11:02:07 +08:00
Ihor Radchenko a407a89c5f
org-footnote.el:org-footnote-section: Fix typo in docstring
Reported in https://list.orgmode.org/c43cc980-108a-176b-accc-e5649264ba53@gmail.com/T/#u
2022-05-29 20:55:01 +08:00
Ihor Radchenko d37e4dc0f2
ox-latex: Scale inlinetasks according to column width
* lisp/ox-latex.el (org-latex-format-inlinetask-default-function): Set
inlinetask box width relative to \linewidth in current column.  Using
\textwidth scales the box wider than column in multi-column documents.
2022-05-29 18:06:12 +08:00
Ihor Radchenko 66528468a1
org-src-font-lock-fontify-block: Do not transfer non-existing properties
* lisp/org-src.el (org-src-font-lock-fontify-block): Never set
font-lock properties when `get-text-property' returns nil.  This
usually means that the property is not present in the position
property list.  The old behavior could, for example, set 'invisible
property to nil explicitly and prevent folding completely.

Fixes https://list.orgmode.org/CA+G3_PN6RvcRcvN2fM=vfK1K6UsT=nNPJ7SUucmA1Ypc=Emorg@mail.gmail.com/T/#u
2022-05-28 09:35:32 +08:00
Ihor Radchenko 5e0afb669b
org-cycle-hide-block-startup: Fix docstring
* lisp/org-cycle.el (org-cycle-hide-block-startup): #+STARTUP:
showblocks does not work, according to `org-startup-options'.  Users
need to use nohideblocks instead.
2022-05-27 15:11:17 +08:00
Aaron L. Zeng 713c15d852
org-todo-yesterday: Fix interactive arg when in agenda buffer
* lisp/org.el (org-todo-yesterday): Fix an incorrect use of apply when
`org-todo-yesterday' intends to call `org-agenda-todo-yesterday' with
the same interactive arg.  Before this change, the command incorrectly
set the todo state of the task to blank when called with C-u C-u C-u
in an agenda buffer (supposed to bypass any blocked
checkboxes/subtasks).

TINYCHANGE
2022-05-26 12:32:58 +08:00
Bastien 8e69adabe2 Merge branch 'bugfix' 2022-05-22 22:02:12 +02:00
Bastien 4aaa2683b6 lisp/org-clock.el: Fix `read-number' prompt
* lisp/org-clock.el (org-clock-resolve): Fix `read-number' prompt.
2022-05-22 22:01:19 +02:00
Ihor Radchenko 2cb4f46fec
org-latex-compile: Add commentary on fallback compiler command
* lisp/ox-latex.el (org-latex-compile): Clarify when "pdflatex"
constant is used as a fallback.
2022-05-22 11:43:38 +08:00
Tyler Grinn e268e47971
lisp/org.el: Add org-property-separators option
* lisp/org.el (org-property-separators, org-property-get-separator):
Created.
(org-entry-get, org-entry-get-with-inheritance): Use new
`org-property-get-separator' function.

* testing/lisp/test-org.el (test-org/entry-get): Added tests for
combining properties with custom separators

`org-property-separators' is a customization option that allows for
properties to be combined using a separator other than the default (a
single space).  It is an alist with the car of each element being a
list of property names or regular expression and the cdr being the
separator string, like '((("EXPORT_FILE_NAME") . "/")).
2022-05-20 15:56:11 +08:00
Marco Wahl 4f0f244477 Revert "org-src: Add RET to go from overlay to edit buffer"
This reverts commit 0d39ea6ef3.
2022-05-19 12:20:31 +02:00
Marco Wahl 0d39ea6ef3 org-src: Add RET to go from overlay to edit buffer
* lisp/org-src.el (org-edit-src-goto): org-edit-src-goto factors out
the functionality from org-edit-src-continue.  The latter needs an event.

The return key is bound to org-edit-src-goto for the overlay.
2022-05-18 22:50:33 +02:00
Ihor Radchenko 2778972509
org-fold--reveal-outline-maybe: Prevent wrong-side-of-point error
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Fix scenario when
point is moved beyond REGION.
2022-05-17 13:24:21 +08:00
Ihor Radchenko cdbb1c9633
org--deadline-or-schedule: Allow warning period in TIME argument
* lisp/org.el (org--deadline-or-schedule): Match warning period if
provided in TIME arg.
* testing/lisp/test-org.el (test-org/deadline): Add relevant tests.

Fixes https://orgmode.org/list/87o85bl582.fsf@localhost
2022-05-15 14:49:10 +08:00
Ihor Radchenko 5c14a17344
org-clock.el: Consider clocking-in in an empty narrowed buffer
* lisp/org-clock.el (org-clock-in): Fix wrong calculation of
TARGET-POS when we are inside an empty narrowing.

Fixes https://orgmode.org/list/87tufktz5z.fsf@posteo.de
2022-05-15 14:15:15 +08:00
Ihor Radchenko 513ab7c48c
Merge branch 'bugfix' 2022-05-14 19:34:41 +08:00
Ihor Radchenko ef41f385fb
fixup! org-babel-load-file: Fix loading with non-nil COMPILE argument 2022-05-14 19:34:08 +08:00
Ihor Radchenko d6bae908f3
Fix macro indentation and re-indent code misindented by nameless
* lisp/org-fold-core.el (org-fold-core-cycle-over-indirect-buffers):
(org-fold-core-ignore-modifications):
(org-fold-core-ignore-fragility-checks):
* lisp/org-macs.el (org-element-with-disabled-cache): Fix incorrect
indentation declare statement.  Body-only macros should use (indent 0)
to avoid indenting first line differently from other body.
* lisp/org-capture.el:
* lisp/org-clock.el:
* lisp/org-fold-core.el:
* lisp/org-fold.el:
* lisp/org-id.el:
* lisp/org-list.el:
* lisp/org-macs.el:
* lisp/org.el: Reindent.

Reported in https://orgmode.org/list/CAKJdtO_Z4LBGek3SUc6-a_Z0-dDd6L26_YfMYpZTn7F92uxXJQ@mail.gmail.com
2022-05-14 16:58:35 +08:00
Ihor Radchenko e5e7ae36cf
org-element--current-element: Fix #+BEGIN$ parsed as special block
* lisp/org-element.el (org-element--current-element): Use
`org-element-dynamic-block-open-re' to match blocks.

* testing/lisp/test-org-element.el (test-org-element/paragraph-parser):
Fix test relying on previous incorrect behaviour.  Empty #+BEGIN:
should be parsed as a keyword.

Reported in https://list.orgmode.org/Ycay4s3iAdEGSwgt@tuxteam.de/T/#t
2022-05-14 13:51:56 +08:00
Ihor Radchenko 3996ea99a3
org-element-map: Refer to `org-element-parse-buffer' in the docstring
* lisp/org-element.el (org-element-map): Update docstring.  Mention
that parse tree can be obtained using `org-element-parse-buffer'.  Add
an example.
2022-05-14 13:07:01 +08:00
Ihor Radchenko c508ff41e4
Merge branch 'bugfix' 2022-05-13 18:37:04 +08:00
Ihor Radchenko 4fe59b688f
org-babel-load-file: Fix loading with non-nil COMPILE argument
* lisp/org.el (org-babel-load-file): Use correct file name to load
compiled file.

Fixes https://orgmode.org/list/t5j75h$dbo$1@ciao.gmane.io
2022-05-13 18:35:13 +08:00
TEC 5766ddd758
ox-latex: Prefix lst: to source block labels
* lisp/ox-latex.el (org-latex--label): Use the "lst:" prefix when
generating source block labels ("lst" contracted from "listing").
2022-05-13 00:43:18 +08:00
TEC faa5c1887c
ox-latex: Support mathescape'd code with engraved
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src--engrave-mathescape-p): Using the mathescape functionality
in engrave-faces-latex v0.3.1, we can support the mathescape option of
fvextra well.  Along the way, we fix a minor issue with the localoptions
list in `org-latex-src-block--engraved`.
2022-05-13 00:43:17 +08:00
TEC af4ca40eae
ox-latex: Fix %-captions in minted/engraved code
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src-block--minted): Refactor float-env to be clearer, and
switch from `format' to `concat' to fix the bug where %-chars in
captions are interpreted as a format specifier.
2022-05-13 00:43:17 +08:00
TEC 4d5805755c
ox-latex: Support setting engraved theme per-block
* lisp/ox-latex.el (org-latex-src-block--engraved,
org-latex-src--engrave-code, org-latex-inline-src-block--engraved,
org-latex-generate-engraved-preamble): Allow for the engraved theme used
to be set on a per-src-block basis with #+attr_latex: :engraved-theme
THEME.  Extra setup code is now generated in
`org-latex-generate-engraved-preamble'.  To facilitate the application
of themes to src blocks, `org-latex-src--engrave-code' now takes on a
larger portion of the transcoding work.
2022-05-13 00:43:17 +08:00
TEC a16e208938
ox-latex: Support setting the engraved theme
* lisp/ox-latex.el (org-latex-generate-engraved-preamble,
org-latex-engraved-theme): Introduce the new export keyword
LATEX_ENGRAVED_THEME with default value given by
`org-latex-engraved-theme'.  This is used to set the engraved theme used
in org-latex-engraved-theme.

This bumps the minimum required version of engrave-faces from v0.2 to
v0.3.
2022-05-13 00:43:17 +08:00
TEC b4e4b3c502
ox-latex: Replace `org-latex-listings'
* lisp/ox-latex.el (org-latex-src-block, org-latex-keyword,
org-latex-inline-src-block, org-latex-template,
org-latex--caption/label-string, org-latex-engraved-preamble,
org-latex-listings): Replace `org-latex-listings' with
`org-latex-src-block-backend', which now can be set to listings/verbatim
and no longer advertises t/nil as valid values.

* lisp/ox-beamer.el (org-beamer-template): Update in the same manner as
`org-latex-template'.

* lisp/org-compat.el: Make `org-latex-listings' an obsolete alias for
`org-latex-src-block-backend'.

* testing/lisp/test-ox.el: Replace `org-latex-listings' reference with
`org-latex-src-block-backend'.

* doc/org-manual.org (Footnotes, LaTeX specific properties, Literal
Examples): Replace references to `org-latex-listings' with
`org-latex-src-block-backend'.

* etc/ORG-NEWS: Add a news entry noting this change.

The variable `org-latex-listings' originally indicated whether source
blocks should use the listings LaTeX package, or not.  This usage has
evolved over the years, and now it sets one of four different
fontification backends.  This renaming should make the variable name a
bit less misleading.
2022-05-13 00:43:17 +08:00
TEC e07b89c31c
ox-latex: Refactor source block transcode fun sigs
* lisp/ox-latex.el (org-latex-src-block--listings,
org-latex-src-block--engraved, org-latex-src-block--minted,
org-latex-src-block--custom): Refactor these --backend functions to use
cl-defun with keys instead of having an 11-argument signature.
(org-latex-src-block): Adjust for the change in signature of the
--backend functions, and refactor the `cond' statement to use `pcase'.
2022-05-13 00:43:17 +08:00
TEC bbba45a07f
ox-latex: Don't use `length' to get string width
* lisp/ox-latex.el (org-latex-src-block--listings,
org-latex-src-block--engraved, org-latex-src-block--minted): Use
`string-width' instead of `length' to gauge the displayed width of the
string in LaTeX.  This may not be a perfect match, but it should be an
improvement.
2022-05-13 00:43:17 +08:00
TEC d30738b786
ox-latex: Introduce "engraved" code highlighting
* lisp/ox-latex.el (org-latex-src-block, org-latex-src-block--engraved,
org-latex-inline-src-block, org-latex-inline-src-block--engraved,
org-latex-src--engrave-code, org-latex-template, org-latex-listings):
Make use of the engraved-faces package (available on ELPA) to provide an
alternative LaTeX code highlighting backend which functions similarly to
htmlize.el for HTML exports.

(org-latex-engraved-preamble, org-latex-engraved-options): Introduce
variables to construct the preamble for engraved code blocks.

* lisp/ox-beamer.el (org-beamer-template): Modify to add engrave-faces
preamble when applicable.
2022-05-13 00:43:17 +08:00
TEC ca91473639
ox-latex: More versitile option construction
* lisp/ox-latex.el (org-latex--make-option-string): Support a custom
option seperator string.

(org-latex--make-option-string, org-latex-minted-options,
org-latex-listings-options): The first line of the docstrings for
`org-latex-minted-options` and `org-latex-listings-options` describe the
variables as "association lists", yet `org-latex--make-option-string`
does not handle association lists and an example of two-value lists is
provided.  To make the behaviour match the docstring,
`org-latex--make-option-string` is modified to work with either a list
two-value lists or an association list, and the examples in
`org-latex-minted-options` and `org-latex-listings-options` updated
accordingly.
2022-05-13 00:43:17 +08:00
TEC 40c559ac3d
ox-latex: Refactor `org-latex-inline-src-block'
* lisp/ox-latex.el (org-latex-inline-src-block,
org-latex-inline-src-block--minted,
org-latex-inline-src-block--listings): Extract the minted and listings
specific logic out of `org-latex-inline-src-block` into the new
functions `org-latex-inline-src-block--minted` and
`org-latex-inline-src-block--listings`.
2022-05-13 00:43:17 +08:00
TEC 61d85bcdb3
ox-latex: Refactor `org-latex-src-block'
* lisp/ox-latex.el (org-latex-src-block): Extract the per-format logic
from `org-latex-src-block' into new dedicated functions:
+ `org-latex-src-block--verbatim'
+ `org-latex-src-block--custom'
+ `org-latex-src-block--minted'
+ `org-latex-src-block--listings'
This makes `org-latex-src-block' much less monolithic, taking it from
175 lines to 30, and I find also makes it easier to understand.
2022-05-13 00:43:17 +08:00
Ihor Radchenko d5a52be0a5
org-fold-core: Remove `org-fold-core-first-unfold-functions'
* lisp/org-fold-core.el (org-fold-core-first-unfold-functions):
Remove.  This is very too tricky to implement.  In particular, when we
use jit-lock, there can be a race between calls to
`org-fold-core-region' and fontification.  For example, consider that
one of the functions in the hook folds drawers and everything is
folded initially.  Then, if the user requests unfolding headlines,
drawers, and blocks, it happens before jit-lock is ran in invisible
parts of buffer (out of the display).  Those parts will be folded
despite user explicitly requested full unfold, which is wrong.  Fixing
this behaviour would involve implementing a full-fledged tracker on
top of jit-lock, which is very too complex and will likely introduce
hard-to-debug errors.

* lisp/org-fold-core.el (org-fold-core-initialize):
(org-fold-core-region):
(org-fold-core-remove-optimisation):
* lisp/org-cycle.el (org-cycle-hide-drawers):
(org-cycle-hide-archived-subtrees): Do not use
`org-fold-core-first-unfold-functions'.

Fixes https://list.orgmode.org/80k0ar1lml.fsf@felesatra.moe/T/#u
2022-05-12 21:38:01 +08:00
Daniel Fleischer aea24b3fea lisp/org.el: Fast tag selection disabled tag face
* lisp/org.el (org-fast-tag-selection): Disabled tags face

A tag can be either selected in "current", "inherited" or disabled. When
disabled, it should have the default face. Previously, if a tag was
already selected, when deselection it will still have an org-todo face.

https://lists.gnu.org/archive/html/emacs-orgmode/2021-10/msg00350.html
2022-05-10 08:33:15 +03:00
Ihor Radchenko 0b07b30dea
orgtbl-toggle-comment: Fix when table is at `point-min' or `point-max'
* lisp/org-table.el (orgtbl-toggle-comment): Avoid infinite loop when
begin/end line of the table is at `point-min' or `point-max'.

Fixes https://orgmode.org/list/874k20v7sj.fsf@gmail.com
2022-05-09 21:31:54 +08:00
Ihor Radchenko 717f83bf75
org-fold--reveal-outline-maybe: Fix wrong side of point error
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Widen the buffer
before testing headline validity.  Otherwise, `goto-char' may not move
where expected in narrowed buffer.
2022-05-09 20:39:57 +08:00
Ignacio a3d9999d28
lisp/org.el: Match COMMENT in `org-complex-heading-regexp-format'
* lisp/org.el (org-set-regexps-and-options): Change
`org-complex-heading-regexp-format' initialization so that the regexp
it produces also matches a headline if it is commented.

TINYCHANGE
2022-05-08 18:22:01 +08:00
Tim Van den Langenbergh 06d08e6f30
lisp/ob-scheme.el: Use synchronous eval.
* ob-scheme.el (org-babel-scheme-execute-with-geiser): If available,
use the synchronous `geiser-eval-region/wait' function to get the
evaluation result.

Works with geiser 0.18 (before introduction of async evaluation) and
geiser 0.22 (which introduces `geiser-eval-region/wait').

Modified from a patch proposal by Felipe Lema.

TINYCHANGE
2022-05-08 17:59:59 +08:00
Ihor Radchenko 2e4ed52b19
org-fold: Revert old behaviour when handling invisible edits
* lisp/org-fold-core.el (org-fold-core-folded-p): Allow list of fold
types to be passed as argument.
* lisp/org-fold.el (org-fold-check-before-invisible-edit--overlays):
(org-fold-check-before-invisible-edit--text-properties): Make
overlay/text-property behaviour consistent.  Do not handle edits
inside folded links.  Fix inconsistencies.
* testing/lisp/test-org-fold.el:
* testing/lisp/test-org.el: Move folding-related tests to new test
file.
* testing/lisp/test-org-fold.el:
(test-org-fold/org-catch-invisible-edits): New test.

See https://orgmode.org/list/m2o809q170.fsf@gmail.com
2022-05-08 17:26:42 +08:00
Ihor Radchenko b5f0efc049
ob-plantuml: Allow setting PlantUML args for jar file
* lisp/ob-plantuml.el (org-plantuml-args): Rename
`org-plantuml-executable-args' to `org-plantuml-args'.
(org-babel-execute:plantuml): Use `org-plantuml-args' when calling
jar.
* lisp/org-compat.el (org-plantuml-executable-args): Obsolete old
variable name.
* etc/ORG-NEWS (=org-plantump-executable-args= is renamed and applies
to jar as well): Document change.

See the discussion in https://list.orgmode.org/orgmode/87y23hr045.fsf@localhost/
2022-05-08 14:44:58 +08:00
TEC 15d25644cc
org-entities: Change \minus to -
* lisp/org-entities.el: The LaTeX command \minus doesn't exist, but a
hyphen in math mode produces a minus symbol.
2022-05-04 23:49:48 +08:00
Ihor Radchenko d2a459d259
org-fold-check-before-invisible-edit: Be smart about editing at border
*
lisp/org-fold.el (org-fold-check-before-invisible-edit--text-properties):
Consider `border-and-ok-direction' value when deciding whether to
throw an error and reveal the fold.  Never throw an error when editing
at border without affecting the text inside.

Fixes https://orgmode.org/list/m2ilqle995.fsf@gmail.com
2022-05-04 22:37:29 +08:00
Ihor Radchenko ebbef7b30c
org-fold-save-outline-visibility: Make it work with 'text-properties
*
lisp/org-fold.el (org-fold-save-outline-visibility--text-properties):
Do not expand list of specs on compile time.  Simplify saving and
re-applying folds.

* lisp/org-fold.el (org-fold-save-outline-visibility): Fix typo when
-> if.
2022-05-03 14:27:25 +08:00
Ihor Radchenko 5d3173cb04
org-compile-prefix-format: Document argument
* lisp/org-agenda.el (org-compile-prefix-format): Document the KEY
argument in the docstring.

Reported in https://orgmode.org/list/CAJ1MqVGR0w93wYi7r0NNmDJxBKeY8vh2=f307u1JeGBOUC597g@mail.gmail.com
2022-05-03 11:38:10 +08:00
Ihor Radchenko f8bb414615
org-at-timestamp-p: Fix compatibility with Emacs 26
* lisp/org.el (org-at-timestamp-p): Do not use variables in regexp rx
form.  They are not yet supported in Emacs 26.  Expand them at runtime
instead.
2022-05-02 12:03:52 +08:00
Jacopo De Simoi 2bd34edb64
ob-tangle.el: Handle non-string arguments more gracefully
* lisp/ob-tangle.el (org-babel-tangle-single-block): If the
  argument to :tangle is nil (e.g. when parsing conditional
  tangling such as (when condition "yes") the current code
  throws an error in `file-name-directory'.  This commit
  checks if the argument is a string before calling the fun

TINYCHANGE
2022-05-01 11:36:04 +08:00
Andrew Arensburger 82a09ba0ae
org-macs.el: Fix template expansion
* lisp/org-macs.el (org-fill-template): Fix a bug in template
expansion: if one key is a substring of another key (like "noweb" and
"noweb-ref", or "tangle" and "tangle-mode"), the second key wouldn't
get expanded properly.  The problem was that keys were processed in
order of increasing length; they are now sorted in order of descending
length.

TINYCHANGE
2022-04-30 17:45:33 +08:00
Ihor Radchenko 5f184b5f23
org-inlinetask.el: Fix visibility cycling for inlinetasks
* lisp/org-inlinetask.el (org-inlinetask-hide-tasks): Make sure that
we loop over inlinetasks inside current section only.
`org-inlinetask-goto-end' moves point to the end of the inlinetask
element.  If an inlinetask is followed by a heading, the function
logic will treat the heading as the beginning of another inline task.
Prevent it by moving the point at the end of the END line of the
inlinetask.

Fixes
https://list.orgmode.org/orgmode/CAP7OBx+rs-7v4jstEFYC4u0=0NZ3xJKfb3CNrWeDvjmwRTvgxw@mail.gmail.com/
2022-04-30 16:54:15 +08:00
Sébastien Miquel 2063596b90
ob-core.el: Add `:noweb-prefix` babel header argument
* lisp/ob-core.el (org-babel-expand-noweb-references): Add support for
`noweb-prefix' header argument, to not repeat the prefix characters
when expanding a noweb reference.
(org-babel-common-header-args-w-values):
(org-babel-safe-header-args): Add `noweb-prefix' value.
* doc/org-manual.org: Document `noweb-prefix' babel header argument.
* etc/ORG-NEWS: Document `:noweb-prefix'.
2022-04-30 16:13:55 +08:00
Ihor Radchenko a3dac4d20a
fixup! org-fold-show-set-visibility: Do not reveal emphasis unless DETAIL is `local'
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Consider nil value for REGION.
2022-04-29 10:55:42 +08:00
Ihor Radchenko 782a661921
org-fold-show-set-visibility: Do not reveal emphasis unless DETAIL is `local'
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Prevent revealing hidden emphasis unless requested DETAIL is `local'.
* lisp/ol.el (org-next-link): Honour `org-fold-show-context-detail'.

Reported in https://orgmode.org/list/626a0713.1c69fb81.a3583.1a07SMTPIN_ADDED_BROKEN@mx.google.com
2022-04-28 14:33:43 +08:00
Ihor Radchenko a0b8adf08a
org-fold: Reveal hidden macro markers
* lisp/org-fold.el (org-fold-show-set-visibility--text-properties):
Unfold hidden macro markers on invisible edit.
2022-04-28 14:02:32 +08:00
Ihor Radchenko 1ed9e42238
org-todo: Fix point moving after setting todo keyword in empty heading
* lisp/org.el (org-todo): Insert new todo keyword before
`save-excursion' markers.  This avoids apparent point movement when a
new keyword is inserted into an empty heading.
Before: "* <point>" -> "*<point> TODO";
After: "* <point>" -> "* TODO<point>";

Fixes https://orgmode.org/list/87mtg6265i.fsf@yandex.com
2022-04-27 19:29:36 +08:00
Ihor Radchenko e142bd8a9a
org-fold: Fix folding blank lines after newly inserted heading
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Reveal blank
lines after newly inserted heading after a folded heading.
2022-04-27 19:28:39 +08:00
Ihor Radchenko 2d6f26c057
org-fold: Prevent folding level 1 headlines
* lisp/org-fold.el (org-fold--reveal-outline-maybe): Never keep level
1 headlines inserted inside folded region hidden.  Such headlines can
often be added to end of buffer by capture.  This change prevents such
headlines to be hidden.

Reported in https://orgmode.org/list/CABUh-74vvn7i06T3zB=38_BFfBKS9J9H8NxGp_-eecoAPgygoQ@mail.gmail.com
2022-04-27 16:45:06 +08:00
Ihor Radchenko 4280762e4c
org-refile: Restore previous behaviour of not revealing the refiled headline
* lisp/org-refile.el (org-refile): Do not reveal the refiled headline.
This reverts the new behaviour accidentally introduced by org-fold
patchset.

See https://orgmode.org/list/87r15l5kce.fsf@gnu.org
2022-04-26 17:46:37 +08:00
Ihor Radchenko 407104459b
org-fold: Honour `org-fold-show-context-detail' for isearch
* lisp/org-fold.el (org-fold--isearch-reveal): Call
`org-fold-show-visibility'.  The previously used
`org-fold-show-set-visibility' does not accept context as argument.

Reported in https://orgmode.org/list/8735i5gd8n.fsf@gmail.com
2022-04-25 19:40:19 +08:00
Ihor Radchenko 24c1c877cf
org-fold-core-fontify-region: Calculate jit-lock-bounds accurately
* lisp/org-fold-core.el (org-fold-core-fontify-region): Collect all
the return values of `font-lock-default-fontify-region' on visible
regions and extend jit-lock-bounds accordingly.
2022-04-25 19:40:18 +08:00
Ihor Radchenko 2249f4d7e5
org-fold-core-fontify-region: Remove unused variable
* lisp/org-fold-core.el (org-fold-core-fontify-region):
2022-04-25 19:40:17 +08:00
Ihor Radchenko 312f39a05d
org-string-width: Do not remove face info when PIXELS is non-nil
* lisp/org-macs.el (org-string-width): Do not remove the STRING faces
unless character width is requested.  Faces might alter pixel width of
the string and removing them would yield incorrect results.
2022-04-25 19:40:17 +08:00
Ihor Radchenko 9bc6c363da
org-fold-core: Fix edge case when fontification goes beyond requested
* lisp/org-fold-core.el (org-fold-core-fontify-region): Run
`org-fold-core-first-unfold-functions' on all the regions unmarked by
'org-fold-core-fontified property instead of using incorrect
heuristics with `point' position.  Make sure that fontified region is
registered as fontified according to the return value of
`font-lock-default-fontify-region'

Fixes https://orgmode.org/list/8735i5gd8n.fsf@gmail.com
2022-04-25 19:40:16 +08:00
Ihor Radchenko fc6314b267
org-fold.el: Fix typo 2022-04-25 19:40:15 +08:00
Ihor Radchenko ce58542c85
org-agenda.el: Re-enable native compilation
* lisp/org-agenda.el: Re-enable native compilation as it does not
cause any issues with agenda rendering without other custom changes
not included in this branch.
2022-04-25 19:40:14 +08:00
Ihor Radchenko 219bc6c2d3
org-fold-core-fontify-region: Fix cases when fontification is not registered
* lisp/org-fold-core.el (org-fold-core-fontify-region): Handle FORCE
argument better.  Skip unnecessary code parts when FORCE is non-nil.
Assign `fontified' text property manually in the actually fontified
regions.  We cannot just supply correct return value since jit-lock
does not allow piecewise fontification.
2022-04-25 19:40:14 +08:00
Ihor Radchenko 062e30be8a
org-macs.el: Fix fontification checks take 2 2022-04-25 19:40:13 +08:00
Ihor Radchenko f28f02bde9
org-link-make-string: Throw error when both LINK and DESCRIPTION are empty
This behaviour is expected according to `test-ol/make-string'.
2022-04-25 19:40:11 +08:00
Ihor Radchenko 87babca898
org--string-from-props: Fix handling folds in Emacs <28
* lisp/org-macs.el (org--string-from-props): Respect
`char-property-alias-alist' when querying for `invisible' text
property.
2022-04-25 19:40:11 +08:00
Ihor Radchenko 3da1b2d240
org-fold-core: Fix fontification inside folded regions
* lisp/org-fold-core.el (org-fold-core-initialize): Declare
`org-fold-core-fontified' text property for font-lock.
(org-fold-core--force-fontification): New variable controlling forced
fontification inside folded regions.
(org-fold-core-fontify-region): Fix cases when BEG is inside folded
region.  Respect `org-fold-core--force-fontification'.
* lisp/org-macs.el (org-with-forced-fontification): New macro.
(org-buffer-substring-fontified):
(org-looking-at-fontified): Do not rely on jit-lock.  Use
`org-fold-core-fontified' text property to determine whether text is
already fontified.
2022-04-25 19:40:09 +08:00
Ihor Radchenko 0bca8bc418
org-fold-show-set-visibility: Fix edge case when folded region is at BOB 2022-04-25 19:40:09 +08:00
Ihor Radchenko 0daa209a74
org-string-width: Work around `window-pixel-width' bug in old Emacs 2022-04-25 19:40:08 +08:00
Ihor Radchenko 2e3566e1e9
org-string-width: Handle undefined behaviour in older Emacs
* lisp/org-macs.el (org-string-width): Force older Emacs treating
invisible text with ellipsis as zero-width.  Newer Emacs versions do
exactly this.
2022-04-25 19:40:07 +08:00
Ihor Radchenko 3fba34900e
Fix org-fold--hide-drawers--overlays 2022-04-25 19:40:06 +08:00
Anders Johansson f813f10818
Rename remaining org-force-cycle-archived → org-cycle-force-archived 2022-04-25 19:40:06 +08:00
Anders Johansson baffebbc33
Fix bug in org-get-heading
Fixes #26, where fontification could make the matching and extraction of heading
components fail.
2022-04-25 19:40:05 +08:00
Anders Johansson 240a14988f
Fix typo: delete-duplicates → delete-dups 2022-04-25 19:40:04 +08:00
Ihor Radchenko 52a0ef94c9
Backport contributed commits 2022-04-25 19:40:03 +08:00
Ihor Radchenko e8d8db63a0
Restore old visibility behaviour of org-refile 2022-04-25 19:40:00 +08:00
Ihor Radchenko 17e762426d
Move `org-buffer-list' to org-macs.el 2022-04-25 19:40:00 +08:00
Ihor Radchenko d4f65e74a2
org-compat: Work around some third-party packages using outline-* functions 2022-04-25 19:39:59 +08:00
Ihor Radchenko a6eab82fd6
Obsolete old function names that are now in org-fold 2022-04-25 19:39:58 +08:00
Ihor Radchenko 4fbd8bfae0
Alias new org-fold functions to their old shorter names 2022-04-25 19:39:57 +08:00
Ihor Radchenko bf6bd6d21d
Support extra org-fold optimisations for huge buffers 2022-04-25 19:39:57 +08:00
Ihor Radchenko f63ff07441
Fix subtle differences between overlays and invisible text properties
* lisp/org-clock.el (org-clock-in):
(org-clock-find-position):
(org-clock-out):
* lisp/org.el (org-add-planning-info):
(org-scan-tags):
(org-global-tags-completion-table):
(org-make-tags-matcher):
(org-tags-expand):
(org--property-local-values):
(org-read-date-analyze):
(org-revert-all-org-buffers):
(org-beginning-of-line): Make sure that we inherit invisible state
when inserting text.
(org-sort-entries): Preserve invisible state after replace-match.

(org-log-beginning): Do not try to move by visible lines.

* lisp/org-macs.el (org-preserve-local-variables): Do not try to
preserve overlays.
* lisp/ox.el (org-export--generate-copy-script): Preserve folding
properties in export buffer.
* testing/lisp/test-ob.el (test-ob/preserve-results-indentation): Fix
test failure.
* testing/lisp/test-org.el (test-org/meta-return):
(test-org/custom-properties): Use new folding.
2022-04-25 19:39:56 +08:00
Ihor Radchenko cd83606cfd
org-fold: Handle indirect buffer visibility 2022-04-25 19:39:55 +08:00
Ihor Radchenko 77aa9be5ac
Implement overlay- and text-property-based versions of some functions 2022-04-25 19:39:54 +08:00
Ihor Radchenko 67275f4664
Implement link folding
* lisp/ol.el (org-link--link-folding-spec):
(org-link--description-folding-spec): New variables controlling link
folding settings.
(org-link--reveal-maybe): Handle revealing folded links.
(org-link-descriptive-ensure): Implement `org-link-descriptive'
support with org-fold.
(org-toggle-link-display--overlays):
(org-toggle-link-display--text-properties):
(org-toggle-link-display): Provide text-properties and overlays
versions.
* lisp/org-agenda.el (org-agenda-mode): Use org-fold to fold links in
agenda.
* lisp/org.el (org-do-emphasis-faces): Use org-fold.
2022-04-25 19:39:54 +08:00
Ihor Radchenko fa7530c7b4
Rename old function call to use org-fold 2022-04-25 19:39:53 +08:00
Ihor Radchenko d048c153dd
org-string-width: Reimplement to work with new folding
* lisp/org-macs.el (org--string-from-props): Removed since it is no
longer needed.
(org-string-width): Updated to use `window-text-pixel-size'.
2022-04-25 19:39:52 +08:00
Ihor Radchenko bc0caec6eb
org-at-heading-p: Accept optional argument
* lisp/org.el (org-at-heading-p): Use second argument to allow
checking for visible headings.  Note that by default, unlike
`outline-on-heading-p', `org-at-heading-p' returns non-nil for
invisible headings. Passing second argument is just like
`(outline-on-heading-p)'.
(org-indent-line):
* lisp/org-agenda.el (org-agenda-add-entry-to-org-agenda-diary-file):
* lisp/org-colview.el (org-columns--call):
(org-columns-store-format): Update arguments in `org-at-heading-p'
calls.
2022-04-25 19:39:51 +08:00
Ihor Radchenko b7dae51dbb
org-macs: New function org-find-text-property-region 2022-04-25 19:39:51 +08:00
Ihor Radchenko b415111aff
Disable native-comp in agenda
It caused cryptic bugs in the past.
2022-04-25 19:39:50 +08:00
Ihor Radchenko d72ac89c7c
Remove functions from org.el that are now moved elsewhere 2022-04-25 19:39:49 +08:00
Ihor Radchenko ffdc508429
Separate cycling functions from org.el into new library: org-cycle 2022-04-25 19:39:48 +08:00
Ihor Radchenko 91b4c6e6ea
Separate folding functions from org.el into new library: org-fold 2022-04-25 19:39:48 +08:00
Ihor Radchenko 88f86237c5
Add org-fold-core: new folding engine 2022-04-25 19:39:35 +08:00
Ihor Radchenko 81a2fe4f0b
org-agenda: Use `window-max-chars-per-line' to calculate max text width
* lisp/org-agenda.el (org-agenda-prepare):
(org-todo-list):
(org-agenda-align-tags):
(org-agenda-show-new-time): Calculate the maximum number of chars
fitting into window via `window-max-chars-per-line' instead of
`window-with' or `window-text-with'.  The latter functions can return
larger number when fringes are disabled [1].

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19395

Reported in https://orgmode.org/list/87czhdqi9p.fsf_-_@moondust.localdomain
2022-04-24 14:54:49 +08:00
Ihor Radchenko 96529e933b
org-element-export-snippet-parser: Fix snippets without ending @@
* lisp/org-element.el (org-element-export-snippet-parser): Do not
recognise snippets without closing @@ as empty "@@backend:" snippets.

Example:
@@html:fo aksjdaksjd ajs d

askdjas aksj daj sao@@

Reported in
https://github.com/lucasvreis/org-parser/blob/master/SPEC.org#export-snippets
2022-04-24 13:00:12 +08:00
Ihor Radchenko adccb81d54
ob-gnuplot.el: Honour `default-directory'
* lisp/ob-gnuplot.el (org-babel-expand-body:gnuplot): Do not force
Gnuplot working dir to be `buffer-file-name'.  Trust more configurable
`default-directory'.
2022-04-21 20:00:22 +08:00
Ihor Radchenko 6ea247d79a
org-at-timestamp-p: Fix compatibility with Emacs 26
* lisp/org.el (org-at-timestamp-p): Do not use variables in regexp rx
form.  They are not yet supported in Emacs 26.  Expand them at runtime
instead.
2022-04-21 17:34:06 +08:00
Bastien 81289bddee lisp/ox-latex.el: Add Daniel Fleischer as the maintainer 2022-04-20 08:32:46 +02:00
Bastien bee31004bc Merge branch 'bugfix' 2022-04-19 11:27:03 +02:00
Bastien 69c588947d lisp/org.el: Bump version to 9.5.3 2022-04-19 11:24:07 +02:00
Bastien 8aff825682 Revert "org-faces.el: Use fixed-pitch"
This reverts commit 667cb6f1ae.
2022-04-19 11:23:35 +02:00
Ihor Radchenko bebf0bd42d
Merge branch 'bugfix' 2022-04-18 22:58:10 +08:00
Ihor Radchenko 1f617727f1
org-at-timestamp-p: Fix invalid regexp groups for 'agenda scope
* lisp/org.el (org-at-timestamp-p): Make sure that match groups follow
the docstring in `agenda' scope.  Update docstring explaining return
values for sexp timestamps.

Reported in https://orgmode.org/list/CAKJdtO8bqdbW5N6pRFNQRATjm2daEBDCpJj0njwcd4fmhSJSKQ@mail.gmail.com
2022-04-18 22:54:28 +08:00
Kyle Meyer 0ea476ad75 Merge branch 'bugfix' 2022-04-17 15:27:33 -04:00
Kyle Meyer 682ccdfffe org.el: Silence byte-compiler under 'make single' 2022-04-17 15:22:27 -04:00
Ihor Radchenko 685d78f63c
Merge branch 'bugfix' 2022-04-16 18:05:16 +08:00
Ihor Radchenko fa5c832e9b
org-cite-basic--key-completion-table: Reuse bibliography for speed
* lisp/oc-basic.el (org-cite-basic--key-completion-table): Supply the
pre-calculated bibliography entries when getting entry fields.  This
avoids excessive file change checks inside
`org-cite-basic--parse-bibliography'.
2022-04-16 18:04:02 +08:00
Ihor Radchenko 7ddc5b57c0
oc-basic: Speed up cached bibliography retrival
* lisp/oc-basic.el (org-cite-basic--file-id-cache): New variable
storing hash of bibliography file contents.
(org-cite-basic--parse-bibliography): Skip buffer hash calculation
when bibliography file is unchanged on disk.  Calculating buffer hash
on every call is slow when bibliography file is large.

* lisp/org-compat.el:
(org-file-has-changed-p--hash-table, org-file-has-changed-p): Define
`file-has-changed-p' from Emacs 29 if necessary.

See https://list.orgmode.org/LO2P265MB1758E12E04832DC712F5A8E9DC149@LO2P265MB1758.GBRP265.PROD.OUTLOOK.COM/T/#t
2022-04-16 18:04:02 +08:00
Bastien f6813dbea9 lisp/org.el: Don't use lexical scope for diary related evals
* lisp/org.el (org-diary-sexp-entry): Don't use lexical scope for eval
sexps.

This commit partially reverts 6d73cd34a.

Reported-by: Eric S Fraga <e.fraga@ucl.ac.uk>
2022-04-07 14:51:26 +02:00
Karl Fogel d80aa2776c
lisp/org-macs.el: Fix spelling of `org-truly-invisible-p'
* lisp/org-macs.el (org-truly-invisible-p): Fix spelling of name.
* lisp/org-compat.el (org-truely-invisible-p): Add compatibility
  alias for the old name.
2022-04-07 12:43:36 +08:00
TEC cbe3f2d697
org-src: add toml and desktop lang aliases
* lisp/org-src.el (org-src-lang-modes): It is reasonable to assume that
src blocks with the "toml" and "desktop" lang should use
`conf-toml-mode' and `conf-desktop-mode', respectively.
2022-04-03 01:01:04 +08:00
Stefan Monnier 6d73cd34a0 Replace all uses of the old `defadvice` with the new `advice-add`
* lisp/org.el (org-run-like-in-org-mode): Strength reduce `eval`
to `cl-progv`.
(org--check-org-structure-template-alist): Strength reduce `eval`
to `symbol-value`.
(org-map-entries, org-eval-in-calendar, org-diary-sexp-entry):
Make sure we use the new lexically scoped dialect.
(org--math-always-on): New function, extracted from advice.
(org-cdlatex-mode): Use it with `advice-add`.
(org-self-insert-command): Simplify `and`+`listp` into `consp`.
(org-submit-bug-report):
Make sure we use the new lexically scoped dialect.

* lisp/org-protocol.el (org-protocol-convert-query-to-plist):
Use `cl-mapcan`.
(org--protocol-detect-protocol-server): New function, extracted
from advice.
(server-visit-files): Use it with `advice-add`.

* lisp/org-mouse.el (org--mouse-dnd-insert-text): New function, extracted
from advice.
(dnd-insert-text): Use it with `advice-add`.
(org--mouse-dnd-open-file): New function, extracted from advice.
(dnd-open-file): Use it with `advice-add`.
(org--mouse-open-at-point): New function, extracted from advice.
(org-mode-hook): Advise `org-open-at-point` with `advice-add`.

* lisp/org-ctags.el (org--ctags-load-tag-list): New function, extracted
from advice.
(visit-tags-table): Use it with `advice-add`.
(org--ctags-set-org-mark-before-finding-tag): New function, extracted
from advice.
(xref-find-definitions): Use it with `advice-add`.

* lisp/org-compat.el (org-bookmark-jump-unhide): Accept (unused) args.
(save-place-find-file-hook): Use `advice-add`.
(org--ecb-show-context): New function, extracted from advice.
(ecb-method-clicked): Use it with `advice-add`.
(org-mark-jump-unhide): Accept (unused) args.
(pop-to-mark-command, exchange-point-and-mark, pop-global-mark):
Use `advice-add`.

Along the way, remove some redundant `:group` args
(redundant because they specify the same group as would be used by
default anyway) and make a few other simplifications.
Also don't bother putting `advice-add` within an eval-after-load
since the advice machinery already takes care of handling it.
2022-04-01 07:50:01 +02:00
Bastien d7cae14953 Merge branch 'bugfix' 2022-03-31 17:47:54 +02:00
Bastien 64ee5c2c47 lisp/org-table.el: Fix bug in `org-table-row-get-visible-string'
* lisp/org-table.el (org-table-row-get-visible-string): Don't use
`backward-char' in a function called in a post-command hook.
2022-03-31 17:31:50 +02:00
Bastien 971eb6885e Merge branch 'bugfix' 2022-03-28 14:35:53 +02:00
Bastien 1354e872a7 lisp/ox-html.el: Fix `org-html-style-default'
* lisp/ox-html.el (org-html-style-default): Remove faulty .org-svg css
class specifications.

Reported-by: Yuchen Guo <Guoyuc@students.uni-marburg.de>
2022-03-28 14:34:11 +02:00
Bastien 1bdacbe729 Merge branch 'bugfix' 2022-03-28 14:26:44 +02:00
Nick Dokos 7caae6c088 Fix typo in doc string
* lisp/org-agenda.el (org-todo-list): Fix typo in doc string.
2022-03-28 14:26:26 +02:00
Ihor Radchenko 6304afcaa4
Merge branch 'bugfix' 2022-03-26 15:20:22 +08:00
Ihor Radchenko b1a570b3b4
org-agenda: Fix regression when diary sexp timestamps are ignored
* lisp/org.el (org-at-timestamp-p): Return non-nil on sexp timestamps
when called with 'agenda argument.
* testing/examples/agenda-file.org (test sexp timestamp inside properties):
* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking sexp timestamp inside properties drawer.
2022-03-26 15:17:45 +08:00
Nicolas Goaziou c5ea195c76 Merge branch 'bugfix' 2022-03-23 23:38:50 +01:00
Nicolas Goaziou 667fa06646 oc-biblatex: Remove \relax hack after multicite commands
* lisp/oc-biblatex.el (org-cite-biblatex--multi-arguments): Do not try
to be smart and add \relax{} after multicite commands, as it breaks
csquotes.

Reported-by: Zac E <zac.endter@gmail.com>
<https://list.orgmode.org/8E381952-2AE5-45BF-B142-91DB4B18A26E@gmail.com/T/#t>
2022-03-23 23:18:05 +01:00
Ihor Radchenko c9c0b9d004
Merge branch 'bugfix' 2022-03-22 17:40:49 +08:00
Ihor Radchenko d9bf64f064
org-agenda: Match timestamps inside node properties
* lisp/org-agenda.el (org-agenda-get-timestamps): Use
`org-at-timestamp-p' instead of org-element to check if at valid
timestamp.  Agenda should consider timestamps inside node properties
even though they are not parsed by org-element.

* testing/lisp/test-org-agenda.el (test-org-agenda/property-timestamp):
Add new test checking active timestamp inside property drawer.

* testing/examples/agenda-file.org (test timestamp inside properties):
Add heading for `test-org-agenda/property-timestamp'.

Reported in https://list.orgmode.org/06d301d83d9e$f8b44340$ea1cc9c0$@tomdavey.com
2022-03-22 17:37:47 +08:00
Ihor Radchenko b7c32d873d
Merge branch 'bugfix' 2022-03-21 15:26:37 +08:00
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