* lisp/org-compat.el (org--flatten-tree): New internal compatibility
alias or function based on `flatten-tree' added to Emacs-27.1.
* lisp/org-protocol.el (org-protocol-flatten): Convert to an obsolete
function alias.
(org-protocol-flatten-greedy): Use the `org--flatten-tree' new
compatibility alias or function instead of `org-protocol-flatten'.
* lisp/org-src.el (org-src--get-known-shells): Make the function
compatible with Emacs-26 by using `org--flatten-tree' instead of
`flatten-tree'.
Reported as: Justin to emacs-orgmode. [PATCH] org-src: flatten-tree is
Emacs 27.1; require compat. Tue, 4 Jul 2023 19:21:05 -0400.
https://list.orgmode.org/0288575b-fde8-0e7d-ac74-1f0ac93ce56f@vallon.homeip.net
* lisp/org.el (org-indent-line): Simplify native indentation inside
src block. Ensure we add the org indentation if the line is empty.
* lisp/org-macs.el (org-do-remove-indentation): Preserve
indentation (spaces vs tabs) past the common indentation to remove.
Do not empty blank lines.
* lisp/org-src.el (org-src--contents-for-write-back): Preserve the
native indentation (spaces vs tabs). If necessary, add a common org
indentation to the block according to org's `indent-tabs-mode'.
(org-src-font-lock-fontify-block): Display the native indentation tab
characters with a fixed width, according to the native tab width
value, to preserve vertical alignement in the org buffer.
* testing/lisp/test-org-src.el (test-org-src/indented-blocks): Update
tests. Indentation no longer obeys `indent-tabs-mode' from the org
buffer, but is separated in an eventual org part, and the native part.
Link: https://list.orgmode.org/87a5wcez7e.fsf@localhost/T/#t
* CONTRIBUTE.org: Use the article 'an' for Org.
* org-manual.org: Use the article 'an' for Org.
Delete unnecessary whitespace at beginning of line.
Move LaTeX comment to the LaTeX code block.
TINYCHANGE
* lisp/org.el (org-metaleft-final-hook, org-metaright-final-hook,
org-metaup-final-hook, org-metadown-final-hook): Define final hooks
for S-cursor commands.
(org-metaleft, org-metaright, org-metaup, org-metadown): Add final
hooks to M-commands and document them in the docstring.
* lisp/org.el (org-shiftup, org-shiftdown, org-shiftright,
org-shiftleft): Document hooks for S-cursor commands in the docstring.
* lisp/org.el (org-shiftmetaleft-final-hook,
org-shiftmetaright-final-hook, org-shiftmetaup-final-hook,
org-shiftmetadown-final-hook): Define final hooks for the S-M-cursor
commands.
(org-shiftmetaleft, org-shiftmetaright, org-shiftmetaup,
org-shiftmetadown): Add final hooks to the S-M-cursor commands and
document hooks in the docstring.
* etc/ORG-NEWS (New final hooks for Modifier-Cursor keys): Document
new hooks.
TINYCHANGE
* lisp/ol.el (org-insert-link): Keep the link in `org-stored-links' if
the command was interrupted by the user during the reading of a
description from the minibuffer.
TINYCHANGE
* lisp/org.el (org-make-tags-matcher): When building tag completion
table, do not attempt to call `org-get-buffer-tags' when current
buffer is not an Org buffer.
Reported-by: Colin Baxter <m43cap@yandex.com>
Link: https://orgmode.org/list/87ilb1fakk.fsf@yandex.com
* lisp/org-fold-core.el (org-fold-core--isearch-setup): Use
add-function, respecting the value of `isearch-filter-predicate'.
(org-fold-core--isearch-filter-predicate-overlays): Remove.
Link: https://yhetil.org/emacs-devel/87o7lxpip9.fsf@web.de
* lisp/org-fold-core.el (org-fold-core--with-isearch-active): New
macro, signaling `org-fold-core-region' to store newly created folds
in `org-fold-core--isearch-overlays'.
(org-fold-core-region): Respect the new macro. Respect fold priority
for overlays.
(org-fold-core--isearch-setup): Do not run
`org-fold-core--clear-isearch-overlays' twice.
(org-fold-core--isearch-show): Fix when point is not on the match.
(org-fold-core--isearch-show-temporary): Rewrite, limiting to overlays
only and simplifying the code.
(org-fold-core--create-isearch-overlays): Extend link folds to full
link.
(org-fold-core--clear-isearch-overlay): Do not expect to be called in `isearch-mode-end-hook'.
* lisp/org-fold.el (org-fold--isearch-reveal): Respect argument.
* lisp/org-fold-core.el (org-fold-core-get-folding-spec): Only
consider folding using a single (currently selected) folding style.
Multiple fold styles may be present during isearch - we do not want to
mix them.
* lisp/org-fold.el (org-fold-show-set-visibility): Do not reveal
everything, including drawers under heading when point is outside
drawers. Reveal individual folding specs one by one, within their
folding bounds.
* lisp/org-agenda.el (org-agenda-skip): Never alter match-data. The
callers often use `re-search-forward' and do not expect the match data
to be altered.
* lisp/org-clock.el (org-find-open-clocks): Ensure that we only match
actual clock elements, not everything matching `org-clock-re',
including clocks inside verbatim environments.
* lisp/org-fold-core.el (org-fold-core--isearch-show): Make use of the
passed argument. Do not just rely on `point' being at the isearch
match.
This partially fixes edge case with point being moved to the end of
the folded region during isearch.
* lisp/org-element-ast.el (org-element-create): Do not use `length='
that is not yet available.
(org-element-property-inherited): Do not use `ensure-list' that is not
yet available.
* etc/ORG-NEWS (Major changes and additions to Org API):
(New functions and changes in function arguments): Document the
changes and additions to Org API.
Add new section "Misc", moving all the functions that do not belong to
other sections below. This also fixes defun order for
`org-compile-file' that needs `org-trim' to be defined.
* lisp/org.el (org-refresh-category-properties): Do not check if
org-element-cache is active. This function is now obsolete and can
only be called on purpose by third-party code that probably expects
the text properties to be assigned regardless whether the cache is
active.
This commit also fixes compiler warning as
`org-element--cache-active-p' is not declared anymore in lisp/org.el.
* lisp/org-element.el (org-element--headline-archivedp):
(org-element--headline-footnote-section-p):
(org-element--headline-raw-value):
(org-element--headline-parse-title-raw):
(org-element--headline-parse-title-parse):
(org-element--headline-deferred):
(org-element--get-global-node-properties):
(org-element--headline-parent-deferred): New internal constants
holding deferred values used by parser. These values are not a
subject of modification and thus can be re-used instead of
re-allocating a new instance for every new parsed element.
(org-element--headline-parse-title):
(org-element-headline-parser):
(org-element-org-data-parser):
(org-element-inlinetask-parser):
(org-element--parse-to): Use the new constants.
This patch aims for smaller memory footprint of Org AST and cache.
* lisp/org-element.el (org-element--headline-comment-re):
(org-element--timestamp-raw-value-regexp): New internal regexp
constants.
(org-element--headline-parse-title):
(org-element-timestamp-parser): Use the new constants.
* lisp/org-element.el (org-element-dynamic-block-open-re-nogroup):
(org-element--latex-begin-environment-nogroup): New constants for
internal regexps.
(org-element-comment-parser):
(org-element--current-element-re):
(org-element--current-element): Prefer string constants instead of
repeated plain strings that may be considered different by Emacs
regexp compiler. Also, avoid groups in these regexps as creating
groups makes Emacs regexp matches allocate extra memory. Finally,
avoid using \{N\} constructs in regexps as they are slightly more
costly for regexp engine.
* lisp/org-element.el (org-element--current-element): Slight
optimization of checking for property drawer at point. `forward-line'
is significantly faster compared to `beginning-of-line'.
`skip-chars-forward' also provides a bit of improvement compared to
`looking-at-p'.
Reported-by: Mattias Engdegård <mattias.engdegard@gmail.com>
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#80
* lisp/org-element.el (org-element-node-property-parser): Remove
unnecessary `re-search-forward'. It always triggers as long as
`org-property-drawer-re' only allow node properties inside property
drawer. Also, remove unnecessary `case-fold-search' setting that has
no meaning since we do not match against specific letters.
* lisp/org-list.el (org-item-re): Use faster `defsubst'. This
function is called very frequently when parsing Org buffers by
`org-element--current-element'.
(test-org-element/type):
(test-org-element/type-p):
(test-org-element/org-element-property-1):
(test-org-element/property):
(test-org-element/properties-resolve):
(test-org-element/secondary-p):
(test-org-element/class):
(test-org-element/ast-map):
(test-org-element/properties-mapc):
(test-org-element/properties-map):
(test-org-element/org-element-create):
(test-org-element/put-property):
(test-org-element/set):
(test-org-element/lineage-map): add new and extend tests according to
the new API.
* lisp/org-element.el (org-element-drawer-re-nogroup): New constant
regexp matching drawer line without creating regexp groups.
(org-element--current-element): Use the new constant.
* lisp/org.el (org-drawer-regexp): Ensure that it is the same with
org-element version and mark for removal/alias.
(org-property-drawer-re): Simplify, removing unnecessary matching of
node property structures.
Link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63225#62
* lisp/org-element.el (org-element--cache-remove):
(org-element--cache-interrupt-p):
(org-element--cache-sync):
(org-element--cache-process-request):
(org-element--parse-to):
(org-element--cache-submit-request):
(org-element--cache-for-removal): use `org-element-property-1' to
retrieve parent without checking if it is deferred. All the cached
elements have proper parent.