* lisp/org-element.el (org-element--cache-for-removal): Directly check
for headline at point instead of running full
`org-element--current-element' that is matching a large number of
regexps.
* lisp/org.el (org-delete-char):
(org-delete-backward-char): Wrap into
`org-fold-core-ignore-modifications'. These commands are for
interactive use anyway and they have no risk of not inheriting folding
properties.
* lisp/org.el (org-do-emphasis-faces): Reveal hidden parts of links
fontified by `org-activate-link', if any.
Partially fixes
https://list.orgmode.org/t7np1d$vu8$1@ciao.gmane.io/T/#u
The proper fix should also involve `org-activate-link' not hitting
false-positives inside verbatim.
* lisp/org-lint.el (org-lint): Fix the order of the arguments in
the `assoc-string' call when calculating the list of checkers to
invoke.
`C-u M-x org-lint' was failing to run any checkers, no matter what
category of checkers was chosen, because the calculation of the list
of checkers always returned `nil'.
* lisp/org-persist.el (org-persist-gc): Fix pcase pattern.
Otherwise, `(pred #'numberp)' expands to `(function numberp foo)'
where foo is the first arg of pcase.
* lisp/org-macs.el (org-unique-local-variables): Add newly added cache
variables. They must not be copied by `org-clone-local-variables'.
Otherwise, random failure may happen when cache does not correspond to
the buffer text.
* lisp/org-element.el (org-element--cache-hash-size):
(org-element--cache-hash-statistics):
(org-element--cache-hash-nocache):
(org-element--cache-hash-size):
(org-element--cache-hash-left):
(org-element--cache-hash-right): Implement recent search cache for
`org-element--cache-find'. The cache stores recent cache tree queries
as a vector with O(1) access time.
(org-element--cache-find): Make use of `org-element--cache-hash-left'
and `org-element--cache-hash-right' when cached query element starts
at POS and SIDE is nil. Record statistics.
(org-element-cache-reset): Reset search cache on init.
(org-element-cache-hash-show-statistics): Provide a command reporting
the new caching efficiency. Can be used for debugging/survey
purposes.
* lisp/org-macs.el (org-knuth-hash): Implement multiplicative hash
function.
Preliminary testing reveals that this simple strategy can reduce query
time from O(Log N) down to O(1) for ~30%-50% cache queries.
* lisp/org-persist.el (org-persist-disable-when-emacs-Q): New
variable.
(org-persist-gc):
(org-persist-read):
(org-persist-write): Do nothing when
`org-persist-disable-when-emacs-Q' is non-nil and
`emacs-user-directory' is nil.
* lisp/org-plot.el (org-plot/gnuplot): Instead of running
`org-plot/gnuplot-script' in a temp buffer, run it in the original Org
buffer to preserve file-local variables in the event the user has
configured `org-plot/gnuplot-term-extra' or
`org-plot/gnuplot-script-preamble' to functions that reply on local
variables.
* 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
* 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)
* 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.
* 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
* 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.
* 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
* 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") . "/")).
* 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.
* 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
* 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
* 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`.
* 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.
* 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.
* 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.
* 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.
* 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'.
* 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.
* 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.
* 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.
* 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`.
* 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.
* 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
* 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
* 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.
* 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
* 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
* 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
* 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/
*
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
*
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.
* 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
* 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
* 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/
* 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'.
* 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
* 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
* 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
* 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.
* 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.
* 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
* 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.
* 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.
* 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.
* 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.