* 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.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-element.el (org-element-begin):
(org-element-end):
(org-element-contents-begin):
(org-element-contents-end):
(org-element-post-affiliated):
(org-element-post-blank): New functions for fast access to frequently
used element properties. The functions are `setf'-able.
Update all the relevant code in Org to use the new functions instead
of genetic property queries.
* lisp/org-fold.el (org-fold-catch-invisible-edits-commands): New
custom option.
(org-fold-catch-invisible-edits): Mention the new custom option in the
docstring.
(org-fold-check-before-invisible-edit-maybe): New function checking
if edits are safe for `this-command'.
(org-fold--advice-edit-commands): New function advising the functions
with `org-fold-check-before-invisible-edit-maybe'.
* lisp/org.el (org-mode): Advice functions on Org startup.
(org-self-insert-command):
(org-delete-backward-char):
(org-delete-char):
(org-meta-return): Do not call `org-fold-check-before-invisible-edit'
and rely on the new advise mechanism instead.
* etc/ORG-NEWS (Commands affected by ~org-fold-catch-invisible-edits~
can now be customized): Announce the change.
* doc/org-manual.org (Catching invisible edits): Mention new
customization.
* lisp/org-fold.el (org-fold-show-children): Clarify the docstring
emphasizing that direct children are always displayed. Fix
grandchildren being displayed when the first child has deeper level
than the next children.
* lisp/org-fold.el (org-fold-subtree): Hide blank lines before the
next subtree as well. Add docstring.
Reported-by: Alexandros Prekates <aprekates@posteo.net>
Link: https://orgmode.org/list/20221114020008.03f40695@enous
* lisp/org-fold-core.el: Remove the code overriding
`font-lock-default-fontify-region'. Emacs itself is skipping
fontification of invisible text and doing it more efficiently. The
org-fold fontification overrides are redundant, except when some
poorly written third-party code is forcing fontification inside folded
regions. However, Org does not need to entertain poorly written third
party code, especially when the required supporting code is reducing
font-lock performance and is complicating the maintenance.
(org-fold-core--specs):
(org-fold-core-add-folding-spec): Remove `:font-lock-skip' spec.
(org-fold-core-initialize):
(org-fold-core--fontifying):
(org-fold-core-region):
(org-fold-core--force-fontification):
(org-fold-core-fontify-region): Remove custom fontification.
* lisp/org-fold.el (org-fold-initialize): Remove `:font-lock-skip'
spec.
* lisp/org-macs.el (org-fold-core--force-fontification):
(org-with-forced-fontification):
(org-buffer-substring-fontified):
(org-looking-at-fontified): Remove org-fold's font-lock logic.
* lisp/org-fold.el (org-fold-show-entry): Do not fold drawers in the
unfolded entry unless the new optional argument is non-nil. Folding
the drawers was introduced in 1027e02569, but does not follow the
function docstring. Moreover, folding drawers creates unexpected
behaviour in some cases. See
https://orgmode.org/list/m2a6bl4mmr.fsf@andrew.cmu.edu
* etc/ORG-NEWS (~org-fold-show-entry~ does not fold drawers by default
anymore): Document the change.
* lisp/org-agenda.el (org-agenda-show):
(org-agenda-show-and-scroll-up):
(org-agenda-show-1):
* lisp/org-compat.el (outline-toggle-children):
* lisp/org.el (org-move-subtree-down):
(org-return): Explicitly request folding drawers inside the revealed
entry in the places where it appears to make sense.
* lisp/org-timer.el (org-timer--get-timer-title): Do not unfold entry
at all. This is a noninteractive function.
* lisp/org-fold.el (org-fold-initialize): Do not extend the fold when
text is inserted right after it. This resembles folding overlay
behavior used in previous Org versions and in the 'overlays
`org-fold-core-style'.
Fixes https://orgmode.org/list/871quprrra.fsf@gmail.com
* lisp/org-fold-core.el (org-fold-core--fix-folded-region): Check
fragility in all the indirect buffers.
* lisp/org-fold.el (org-fold--reveal-headline-at-point): New function
revealing heading line or full heading when the heading only contains
blank lines.
(org-fold--reveal-outline-maybe): Check headline at the end of folded
region as well. Use `org-fold-core--fix-folded-region'.
* lisp/org.el (org-insert-heading): Make sure that the newline in
front of heading is revealed.
Emacs now advises using "website" (instead of "homepage") and
consequently to use the "URL" comment header instead of "Homepage".
* README:
* README_ELPA:
* doc/org-guide.org (Creating Footnotes):
* doc/org-manual.org (Creating Footnotes):
* etc/styles/README (URL): Prefer "website" to "homepage".
* lisp/*.el:
* mk/org-fixup.el: Replace the "Homepage" header comment with "URL".
* 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-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/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/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