* lisp/org-list.el (org-cycle-list-bullet): Keep point position
relative to bullet beginning/end when changing the list bullet.
* testing/lisp/test-org-list.el (test-org-list/cycle-bullet): Add
tests.
Fixes https://orgmode.org/list/m2wndjfi32.fsf@gmail.com
* lisp/ob-exp.el (org-babel-exp-src-block): New optional argument
providing ELEMENT at point.
(org-babel-exp-code-template): Use lower-case #+begin/#+end lines to
avoid triggering source code block changes when the blocks are
exported with :exports code and also contain lower-case
#+begin/#+end. We prefer lower-case default because other parts of
Org, like `org-insert-structure-template' default to lower-case as
well.
(org-babel-exp-process-buffer): Do no disable cache as changes are not
expected to be as frequent anymore. Pass pre-calculated element at
point to inner function calls to `org-in-commented-heading-p',
`org-in-archived-heading-p', `org-element-context', and
`org-babel-exp-src-block'. Do not force-replace source block contents
when no change is required.
* testing/lisp/test-ob-exp.el (ob-export/export-with-results-before-block):
(ob-export/body-with-coderef):
(ob-exp/src-block-with-affiliated-keyword): Update tests according to
the new `org-babel-exp-code-template'.
* lisp/oc.el (org-cite-list-citations): Avoid quadratic complexity.
Pre-calculate list of all footnote definitions and cache the footnote
label search hits. Do not make `org-element-map' accumulate unused
result.
* doc/Makefile (org.texi):
(orgguide.texi): Set `gc-cons-threshold` to `most-positive=fixnum' and
thus disable garbage collection while exporting manuals. This reduces
the manual generation time.
* lisp/ox.el (org-export-as): Use `buffer-chars-modified-tick' and
avoid extra invocations of `org-set-regexps-and-options' and
`org-update-radio-target-regexp' when the buffer is not changed.
Also, disable folding checks. Folding is irrelevant inside export
buffer.
* lisp/org-macs.el (org-preserve-local-variables): Do not mark buffer
as modified or alter `buffer-undo-list' when body does not actually
modify the buffer.
This commit fixes a bug with `org-copy-subtree', which marked the
buffer as modified and added an entry to the undo list when the visited
file had local variables.
* lisp/ob-lilypond.el (org-babel-lilypond-commands):
* lisp/ob-shell.el (org-babel-shell-names):
* lisp/org-capture.el (org-capture-templates):
* lisp/org-clock.el (org-clock-ask-before-exiting):
* lisp/org-duration.el (org-duration-units):
* lisp/org-faces.el (org-set-tag-faces):
* lisp/org-footnote.el (org-footnote-section):
* lisp/org-list.el (org-plain-list-ordered-item-terminator):
(org-list-allow-alphabetical):
* lisp/org.el (org-babel-do-load-languages):
(org-set-modules):
(org-export-backends):
(org-use-fast-todo-selection):
(org-enforce-todo-dependencies):
(org-enforce-todo-checkbox-dependencies):
(org-display-custom-times):
(org-set-packages-alist):
(org-set-emph-re):
* lisp/ox-odt.el (org-odt-schema-dir): Use
`set-default-toplevel-value' instead of `set' or `set-default' in
`defcustom' :set argument.
This commit fixes a bug that occurred when using an autoload function
inside a let-binding for a custom variable when the feature defining
both the function and the custom variable had not been loaded yet.
See bug#54399 and
https://lists.gnu.org/archive/html/emacs-orgmode/2022-03/msg00085.html,
https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00226.html
* ob-core.el (org-babel-merge-params): Specifying the symbol 'attach`
or string "'attach" as the value of the `:dir' header now functions as
":dir (org-attach-dir nil t) :mkdirp t".
(org-babel-result-to-file): Optional TYPE argument accepts symbol
'attachment to fixup up paths under `(org-attach-dir)' and use the
link type "attachment:" when that is detected.
(org-babel-insert-result): Pass symbol `attachment' as TYPE to
`org-babel-result-to-file'.
* org-attach.el (org-attach-dir): Added autoload header to simplify
dependencies necessary to support this feature (called in
`org-babel-merge-params').
* test-ob.el (test-ob-core/dir-attach): Added unit test for the new
attach feature.
* lisp/org-fold-core.el (org-fold-core-style):
* lisp/org-persist.el (org-persist-remote-files):
(org-persist-default-expiry):
Don't quote the symbol given as value for a const.
* lisp/org.el (org-mode): Remove the old performance workaround for
right-to-left text in Org buffers. With newer Emacs settings, it is
the 'left-to-right value of `bidi-paragraph-direction' that causes the
slowdown; not the vice versa.
Old discussion on overriding the defaults:
https://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00285.html
The new discussion with example file demonstrating the performance
problem:
https://orgmode.org/list/87a6iqo7x8.fsf@localhost
* lisp/ox.el (org-export--prepare-file-contents,
org-export--inclusion-absolute-lines): Replace instances of
`(insert-file-contents FILE)' with `(insert (org-file-contents FILE))',
as in `org--collect-keywords-1'.
(org-export-expand-include-keyword): Tweak to accept a URL as FILE, and
not perform the standard "file exists and is readable" check.
* etc/ORG-NEWS: Mention this change in behaviour.
* lisp/ob-exp.el (org-babel-exp-process-buffer): Do not track buffer
changes in element cache and org-fold after-change hooks while
updating src blocks. `org-babel-exp-process-buffer' makes a large
number of changes, which would overload the element cache and degrade
performance.
* lisp/ox.el (org-export-resolve-fuzzy-link): Before matching LINK,
pre-process and cache all the non-nil search cells in the parse tree.
When matching, use the pre-processed info. Fix the :test function for
the cache hash table.
* lisp/ox.el (org-export-get-footnote-definition): Pre-process parse
tree once to filter out all non-footnote elements. This speeds up
subsequent footnote definition searches.
* lisp/org.el (org-in-commented-heading-p): When element at point is
not yet in cache, parse the parent headline instead of also parsing
section up to point.
* lisp/org-list.el (org-list-struct-apply-struct): Make sure the
origin marker is not moved to bol when promoting/demoting item in
special case:
- item
- <point> ::
Do not remove the trailing space after point as well.
(org-insert-item): Do not expect point to remain at bol after writing
list struct.
* testing/lisp/test-org-list.el (test-org-list/indent-item): Add tests.
Fixes https://orgmode.org/list/87o88hlkvv.fsf@gmail.com
* doc/org-manual.org (Footnotes): Add `org-cyclic' and `org-block' to
note about org diary functions. Add function indices for `org-date',
`org-anniversary', `org-cyclic', and `org-block'.
* lisp/org.el (org-latex-preview): With an active region, display
images for all fragments in the region. With universal prefix
argument, remove all images in the region.
* lisp/ol.el (org-update-radio-target-regexp): Sort radio targets
before building the regexp that matches them.
* testing/lisp/test-org.el: Test shadowed radio targets. The bug
occurs when two targets share the same prefix and when and the longer
target appears first.
* lisp/org-element.el (org-element--cache-key-less-p): Clarify that
comparison between buffer points and cache keys is not reliable.
(org-element--cache-find): Do not compare POS with cache keys.
(org-element-at-point): Use cache BEG field to determine the cached
buffer portion.
* lisp/org.el (org-get-buffer-tags): Use hash table to accumulate
unique tags only. The old approach also used hash tables under the
hood of `delete-dups', but required extra memory allocation to store
the full tag list.
* 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)