Commit Graph

17 Commits

Author SHA1 Message Date
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 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 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
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 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 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 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 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 fc6314b267
org-fold.el: Fix typo 2022-04-25 19:40:15 +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 3fba34900e
Fix org-fold--hide-drawers--overlays 2022-04-25 19:40:06 +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 91b4c6e6ea
Separate folding functions from org.el into new library: org-fold 2022-04-25 19:39:48 +08:00