emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 09/38] Rename old function call to use org-fold---


From: Ihor Radchenko
Subject: [PATCH v2 09/38] Rename old function call to use org-fold---
Date: Wed, 20 Apr 2022 21:25:09 +0800

---
 lisp/ob-core.el               |  14 ++--
 lisp/ob-lilypond.el           |   4 +-
 lisp/ob-ref.el                |   4 +-
 lisp/ol.el                    |  13 ++--
 lisp/org-agenda.el            |  43 +++++------
 lisp/org-archive.el           |  12 +--
 lisp/org-capture.el           |   2 +-
 lisp/org-clock.el             |  10 +--
 lisp/org-colview.el           |   6 +-
 lisp/org-compat.el            |  29 ++++----
 lisp/org-crypt.el             |   8 +-
 lisp/org-element.el           |   1 +
 lisp/org-feed.el              |   4 +-
 lisp/org-footnote.el          |   6 +-
 lisp/org-goto.el              |   6 +-
 lisp/org-id.el                |   4 +-
 lisp/org-keys.el              |  26 +++----
 lisp/org-lint.el              |   3 +-
 lisp/org-list.el              |  10 ++-
 lisp/org-macs.el              |  40 ++--------
 lisp/org-mobile.el            |   2 +-
 lisp/org-mouse.el             |   4 +-
 lisp/org-refile.el            |   2 +-
 lisp/org-src.el               |   6 +-
 lisp/org-timer.el             |   2 +-
 lisp/org.el                   | 135 +++++++++++++++++++---------------
 lisp/ox-org.el                |   2 +-
 testing/lisp/test-org-list.el |   2 +-
 testing/lisp/test-org.el      |  78 ++++++++++----------
 29 files changed, 241 insertions(+), 237 deletions(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 239a57f96..6590eeee7 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -26,7 +26,9 @@ ;;; Code:
 (require 'cl-lib)
 (require 'ob-eval)
 (require 'org-macs)
+(require 'org-fold)
 (require 'org-compat)
+(require 'org-cycle)
 
 (defconst org-babel-exeext
   (if (memq system-type '(windows-nt cygwin))
@@ -50,7 +52,7 @@ (declare-function org-babel-ref-resolve "ob-ref" (ref))
 (declare-function org-babel-ref-split-args "ob-ref" (arg-string))
 (declare-function org-babel-tangle-comment-links "ob-tangle" (&optional info))
 (declare-function org-current-level "org" ())
-(declare-function org-cycle "org" (&optional arg))
+(declare-function org-cycle "org-cycle" (&optional arg))
 (declare-function org-edit-src-code "org-src" (&optional code 
edit-buffer-name))
 (declare-function org-edit-src-exit "org-src"  ())
 (declare-function org-element-at-point "org-element" (&optional pom 
cached-only))
@@ -75,7 +77,7 @@ (declare-function org-narrow-to-subtree "org" (&optional 
element))
 (declare-function org-next-block "org" (arg &optional backward block-regexp))
 (declare-function org-open-at-point "org" (&optional in-emacs 
reference-buffer))
 (declare-function org-previous-block "org" (arg &optional block-regexp))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
 (declare-function org-src-get-lang-mode "org-src" (lang))
@@ -945,7 +947,7 @@ (defun org-babel-enter-header-arg-w-completion (&optional 
lang)
     (insert (concat header " " (or arg "")))
     (cons header arg)))
 
-(add-hook 'org-tab-first-hook 'org-babel-header-arg-expand)
+(add-hook 'org-cycle-tab-first-hook 'org-babel-header-arg-expand)
 
 ;;;###autoload
 (defun org-babel-load-in-session (&optional _arg info)
@@ -1469,7 +1471,7 @@ (defun org-babel-hide-result-toggle (&optional force)
        (push ov org-babel-hide-result-overlays)))))
 
 ;; org-tab-after-check-for-cycling-hook
-(add-hook 'org-tab-first-hook #'org-babel-hide-result-toggle-maybe)
+(add-hook 'org-cycle-tab-first-hook #'org-babel-hide-result-toggle-maybe)
 ;; Remove overlays when changing major mode
 (add-hook 'org-mode-hook
          (lambda () (add-hook 'change-major-mode-hook
@@ -1817,7 +1819,7 @@ (defun org-babel-goto-named-src-block (name)
   (let ((point (org-babel-find-named-block name)))
     (if point
         ;; Taken from `org-open-at-point'.
-        (progn (org-mark-ring-push) (goto-char point) (org-show-context))
+        (progn (org-mark-ring-push) (goto-char point) (org-fold-show-context))
       (message "source-code block `%s' not found in this buffer" name))))
 
 (defun org-babel-find-named-block (name)
@@ -1857,7 +1859,7 @@ (defun org-babel-goto-named-result (name)
   (let ((point (org-babel-find-named-result name)))
     (if point
         ;; taken from `org-open-at-point'
-        (progn (goto-char point) (org-show-context))
+        (progn (goto-char point) (org-fold-show-context))
       (message "result `%s' not found in this buffer" name))))
 
 (defun org-babel-find-named-result (name)
diff --git a/lisp/ob-lilypond.el b/lisp/ob-lilypond.el
index 15538b503..df128441a 100644
--- a/lisp/ob-lilypond.el
+++ b/lisp/ob-lilypond.el
@@ -34,7 +34,7 @@ ;;; Commentary:
 ;;; Code:
 (require 'ob)
 
-(declare-function org-show-all "org" (&optional types))
+(declare-function org-fold-show-all "org-fold" (&optional types))
 
 (defalias 'lilypond-mode 'LilyPond-mode)
 
@@ -279,7 +279,7 @@ (defun org-babel-lilypond-mark-error-line (file-name line)
     (setq case-fold-search nil)
     (if (search-forward line nil t)
         (progn
-          (org-show-all)
+          (org-fold-show-all)
           (set-mark (point))
           (goto-char (- (point) (length line))))
       (goto-char temp))))
diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el
index db8ced6b6..1a77e39b1 100644
--- a/lisp/ob-ref.el
+++ b/lisp/ob-ref.el
@@ -62,8 +62,8 @@ (declare-function org-find-property "org" (property &optional 
value))
 (declare-function org-id-find-id-file "org-id" (id))
 (declare-function org-id-find-id-in-file "org-id" (id file &optional markerp))
 (declare-function org-in-commented-heading-p "org" (&optional no-inheritance))
-(declare-function org-show-context "org" (&optional key))
 (declare-function org-narrow-to-subtree "org" (&optional element))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 
 (defvar org-babel-update-intermediate nil
   "Update the in-buffer results of code blocks executed to resolve 
references.")
@@ -104,7 +104,7 @@ (defun org-babel-ref-goto-headline-id (id)
          (pop-to-buffer-same-window (marker-buffer m))
          (goto-char m)
          (move-marker m nil)
-         (org-show-context)
+         (org-fold-show-context)
          t))))
 
 (defun org-babel-ref-headline-body ()
diff --git a/lisp/ol.el b/lisp/ol.el
index 1b2bb9a9a..4cc813d5b 100644
--- a/lisp/ol.el
+++ b/lisp/ol.el
@@ -29,6 +29,7 @@ ;;; Code:
 
 (require 'org-compat)
 (require 'org-macs)
+(require 'org-fold)
 
 (defvar clean-buffer-list-kill-buffer-names)
 (defvar org-agenda-buffer-name)
@@ -66,10 +67,10 @@ (declare-function org-mark-ring-push "org" (&optional pos 
buffer))
 (declare-function org-mode "org" ())
 (declare-function org-occur "org" (regexp &optional keep-previous callback))
 (declare-function org-open-file "org" (path &optional in-emacs line search))
-(declare-function org-overview "org" ())
+(declare-function org-cycle-overview "org-cycle" ())
 (declare-function org-restart-font-lock "org" ())
 (declare-function org-run-like-in-org-mode "org" (cmd))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-src-coderef-format "org-src" (&optional element))
 (declare-function org-src-coderef-regexp "org-src" (fmt &optional label))
 (declare-function org-src-edit-buffer-p "org-src" (&optional buffer))
@@ -700,7 +701,7 @@ (defun org-link--buffer-for-internals ()
                (make-indirect-buffer (current-buffer)
                                      indirect-buffer-name
                                      'clone))))
-      (with-current-buffer indirect-buffer (org-overview))
+      (with-current-buffer indirect-buffer (org-cycle-overview))
       indirect-buffer))))
 
 (defun org-link--search-radio-target (target)
@@ -718,7 +719,7 @@ (defun org-link--search-radio-target (target)
        (let ((object (org-element-context)))
          (when (eq (org-element-type object) 'radio-target)
            (goto-char (org-element-property :begin object))
-           (org-show-context 'link-search)
+           (org-fold-show-context 'link-search)
            (throw :radio-match nil))))
       (goto-char origin)
       (user-error "No match for radio target: %s" target))))
@@ -1257,7 +1258,7 @@ (defun org-link-search (s &optional avoid-pos stealth)
        (error "No match for fuzzy expression: %s" normalized)))
     ;; Disclose surroundings of match, if appropriate.
     (when (and (derived-mode-p 'org-mode) (not stealth))
-      (org-show-context 'link-search))
+      (org-fold-show-context 'link-search))
     type))
 
 (defun org-link-heading-search-string (&optional string)
@@ -1430,7 +1431,7 @@ (defun org-next-link (&optional search-backward)
            (`nil nil)
            (link
             (goto-char (org-element-property :begin link))
-            (when (org-invisible-p) (org-show-context))
+            (when (org-invisible-p) (org-fold-show-context))
             (throw :found t)))))
       (goto-char pos)
       (setq org-link--search-failed t)
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 862243f28..fa60f4f19 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -47,6 +47,7 @@ ;;; Code:
 
 (require 'cl-lib)
 (require 'ol)
+(require 'org-fold-core)
 (require 'org)
 (require 'org-macs)
 (require 'org-refile)
@@ -9393,7 +9394,7 @@ (defun org-agenda-goto (&optional highlight)
     (push-mark)
     (goto-char pos)
     (when (derived-mode-p 'org-mode)
-      (org-show-context 'agenda)
+      (org-fold-show-context 'agenda)
       (recenter (/ (window-height) 2))
       (org-back-to-heading t)
       (let ((case-fold-search nil))
@@ -9682,7 +9683,7 @@ (defun org-agenda-switch-to (&optional 
delete-other-windows)
       (widen)
       (goto-char pos)
       (when (derived-mode-p 'org-mode)
-       (org-show-context 'agenda)
+       (org-fold-show-context 'agenda)
        (run-hooks 'org-agenda-after-show-hook)))))
 
 (defun org-agenda-goto-mouse (ev)
@@ -9698,7 +9699,7 @@ (defun org-agenda-show (&optional full-entry)
   (interactive "P")
   (let ((win (selected-window)))
     (org-agenda-goto t)
-    (when full-entry (org-show-entry))
+    (when full-entry (org-fold-show-entry))
     (select-window win)))
 
 (defvar org-agenda-show-window nil)
@@ -9717,12 +9718,12 @@ (defun org-agenda-show-and-scroll-up (&optional arg)
          (select-window org-agenda-show-window)
          (ignore-errors (scroll-up)))
       (org-agenda-goto t)
-      (org-show-entry)
+      (org-fold-show-entry)
       (if arg (org-cycle-hide-drawers 'children)
        (org-with-wide-buffer
         (narrow-to-region (org-entry-beginning-position)
                           (org-entry-end-position))
-        (org-show-all '(drawers))))
+        (org-fold-show-all '(drawers))))
       (setq org-agenda-show-window (selected-window)))
     (select-window win)))
 
@@ -9753,7 +9754,7 @@ (defun org-agenda-show-1 (&optional more)
     (set-window-start (selected-window) (point-at-bol))
     (cond
      ((= more 0)
-      (org-flag-subtree t)
+      (org-fold-subtree t)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'folded))
@@ -9761,20 +9762,20 @@ (defun org-agenda-show-1 (&optional more)
      ((and (called-interactively-p 'any) (= more 1))
       (message "Remote: show with default settings"))
      ((= more 2)
-      (outline-show-entry)
-      (org-show-children)
+      (org-fold-show-entry)
+      (org-fold-show-children)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'children))
       (message "Remote: CHILDREN"))
      ((= more 3)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (save-excursion
        (org-back-to-heading)
        (run-hook-with-args 'org-cycle-hook 'subtree))
       (message "Remote: SUBTREE"))
      ((> more 3)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (message "Remote: SUBTREE AND ALL DRAWERS")))
     (select-window win)))
 
@@ -9906,7 +9907,7 @@ (defun org-agenda-todo (&optional arg)
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (let ((current-prefix-arg arg))
           (call-interactively 'org-todo)
            ;; Make sure that log is recorded in current undo.
@@ -9947,7 +9948,7 @@ (defun org-agenda-add-note (&optional _arg)
     (with-current-buffer buffer
       (widen)
       (goto-char pos)
-      (org-show-context 'agenda)
+      (org-fold-show-context 'agenda)
       (org-add-note))))
 
 (defun org-agenda-change-all-lines (newhead hdmarker
@@ -10096,7 +10097,7 @@ (defun org-agenda-priority (&optional force-direction)
       (with-current-buffer buffer
        (widen)
        (goto-char pos)
-       (org-show-context 'agenda)
+       (org-fold-show-context 'agenda)
        (org-priority force-direction)
        (end-of-line 1)
        (setq newhead (org-get-heading)))
@@ -10120,7 +10121,7 @@ (defun org-agenda-set-tags (&optional tag onoff)
        (with-current-buffer buffer
          (widen)
          (goto-char pos)
-         (org-show-context 'agenda)
+         (org-fold-show-context 'agenda)
          (if tag
              (org-toggle-tag tag onoff)
            (call-interactively #'org-set-tags-command))
@@ -10145,7 +10146,7 @@ (defun org-agenda-set-property ()
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-set-property))))))
 
 (defun org-agenda-set-effort ()
@@ -10164,7 +10165,7 @@ (defun org-agenda-set-effort ()
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-set-effort)
         (end-of-line 1)
         (setq newhead (org-get-heading)))
@@ -10186,7 +10187,7 @@ (defun org-agenda-toggle-archive-tag ()
        (with-current-buffer buffer
         (widen)
         (goto-char pos)
-        (org-show-context 'agenda)
+        (org-fold-show-context 'agenda)
         (call-interactively 'org-toggle-archive-tag)
         (end-of-line 1)
         (setq newhead (org-get-heading)))
@@ -10396,7 +10397,7 @@ (defun org-agenda-clock-in (&optional arg)
         (with-current-buffer (marker-buffer marker)
          (widen)
          (goto-char pos)
-         (org-show-context 'agenda)
+         (org-fold-show-context 'agenda)
          (org-clock-in arg)
          (setq newhead (org-get-heading)))
        (org-agenda-change-all-lines newhead hdmarker))
@@ -10485,7 +10486,7 @@ (defun org-agenda-diary-entry-in-org-file ()
        (find-file-noselect org-agenda-diary-file))
       (require 'org-datetree)
       (org-datetree-find-date-create d1)
-      (org-reveal t))
+      (org-fold-reveal t))
      (t (user-error "Invalid selection character `%c'" char)))))
 
 (defcustom org-agenda-insert-diary-strategy 'date-tree
@@ -10587,7 +10588,7 @@ (defun org-agenda-add-entry-to-org-agenda-diary-file 
(type text &optional d1 d2)
          (message "%s entry added to %s"
                   (capitalize (symbol-name type))
                   (abbreviate-file-name org-agenda-diary-file)))
-      (org-reveal t)
+      (org-fold-reveal t)
       (message "Please finish entry here"))))
 
 (defun org-agenda-insert-diary-as-top-level (text)
@@ -10625,7 +10626,7 @@ (defun org-agenda-insert-diary-make-new-entry (text)
     (unless (bolp) (insert "\n"))
     (unless (looking-at-p "^[ \t]*$") (save-excursion (insert "\n")))
     (when org-adapt-indentation (indent-to-column col)))
-  (org-show-set-visibility 'lineage))
+  (org-fold-show-set-visibility 'lineage))
 
 (defun org-agenda-diary-entry ()
   "Make a diary entry, like the `i' command from the calendar.
diff --git a/lisp/org-archive.el b/lisp/org-archive.el
index 6ea16f8c1..1026a295e 100644
--- a/lisp/org-archive.el
+++ b/lisp/org-archive.el
@@ -324,7 +324,7 @@ (defun org-archive-subtree (&optional find-done)
                  (org-todo-regexp tr-org-todo-regexp)
                  (org-todo-line-regexp tr-org-todo-line-regexp))
              (goto-char (point-min))
-             (org-show-all '(headings blocks))
+             (org-fold-show-all '(headings blocks))
              (if (and heading (not (and datetree-date (not 
datetree-subheading-p))))
                  (progn
                    (if (re-search-forward
@@ -339,7 +339,7 @@ (defun org-archive-subtree (&optional find-done)
                      (insert (if datetree-date "" "\n") heading "\n")
                      (end-of-line 0))
                    ;; Make the subtree visible
-                   (outline-show-subtree)
+                   (org-fold-show-subtree)
                    (if org-archive-reversed-order
                        (progn
                          (org-back-to-heading t)
@@ -417,7 +417,7 @@ (defun org-archive-subtree (&optional find-done)
                 (if (eq this-buffer buffer)
                     (concat "under heading: " heading)
                   (concat "in file: " (abbreviate-file-name afile)))))))
-    (org-reveal)
+    (org-fold-reveal)
     (if (looking-at "^[ \t]*$")
        (outline-next-visible-heading 1))))
 
@@ -487,13 +487,13 @@ (defun org-archive-to-archive-sibling ()
         (format-time-string
          (substring (cdr org-time-stamp-formats) 1 -1)))
        (outline-up-heading 1 t)
-       (org-flag-subtree t)
+       (org-fold-subtree t)
        (org-cycle-show-empty-lines 'folded)
        (when org-provide-todo-statistics
          ;; Update TODO statistics of parent.
          (org-update-parent-todo-statistics))
        (goto-char pos)))
-    (org-reveal)
+    (org-fold-reveal)
     (if (looking-at "^[ \t]*$")
        (outline-next-visible-heading 1))))
 
@@ -602,7 +602,7 @@ (defun org-toggle-archive-tag (&optional find-done)
        (save-excursion
          (org-back-to-heading t)
          (setq set (org-toggle-tag org-archive-tag))
-         (when set (org-flag-subtree t)))
+         (when set (org-fold-subtree t)))
        (and set (beginning-of-line 1))
        (message "Subtree %s" (if set "archived" "unarchived"))))))
 
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index bbb37eb27..1324ffab4 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1129,7 +1129,7 @@ (defun org-capture-place-template (&optional 
inhibit-wconf-store)
   (org-switch-to-buffer-other-window
    (org-capture-get-indirect-buffer (org-capture-get :buffer) "CAPTURE"))
   (widen)
-  (org-show-all)
+  (org-fold-show-all)
   (goto-char (org-capture-get :pos))
   (setq-local outline-level 'org-outline-level)
   (pcase (org-capture-get :type)
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 6f441c18e..583b30237 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1035,7 +1035,7 @@ (defun org-clock-jump-to-current-clock (&optional 
effective-clock)
               (let ((element (org-element-at-point)))
                 (when (eq (org-element-type element) 'drawer)
                   (when (> (org-element-property :end element) (car clock))
-                    (org-hide-drawer-toggle 'off nil element))
+                    (org-fold-hide-drawer-toggle 'off nil element))
                   (throw 'exit nil)))))))))))
 
 (defun org-clock-resolve (clock &optional prompt-fn last-valid fail-quietly)
@@ -1843,10 +1843,10 @@ (defun org-clock-goto (&optional select)
     (pop-to-buffer-same-window (marker-buffer m))
     (if (or (< m (point-min)) (> m (point-max))) (widen))
     (goto-char m)
-    (org-show-entry)
+    (org-fold-show-entry)
     (org-back-to-heading t)
     (recenter org-clock-goto-before-context)
-    (org-reveal)
+    (org-fold-reveal)
     (if recent
        (message "No running clock, this is the most recently clocked task"))
     (run-hooks 'org-clock-goto-hook)))
@@ -2140,7 +2140,7 @@ (defun org-clock-report (&optional arg)
   (org-clock-remove-overlays)
   (when arg
     (org-find-dblock "clocktable")
-    (org-show-entry))
+    (org-fold-show-entry))
   (pcase (org-in-clocktable-p)
     (`nil
      (org-create-dblock
@@ -3125,7 +3125,7 @@ (defun org-clock-load ()
             (let ((org-clock-in-resume 'auto-restart)
                   (org-clock-auto-clock-resolution nil))
               (org-clock-in)
-              (when (org-invisible-p) (org-show-context))))))
+              (when (org-invisible-p) (org-fold-show-context))))))
        (_ nil)))))
 
 (defun org-clock-kill-emacs-query ()
diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 15cab35f0..c8443c135 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -159,8 +159,8 @@ (defconst org-columns-summary-types-default
 (defun org-columns-content ()
   "Switch to contents view while in columns view."
   (interactive)
-  (org-overview)
-  (org-content))
+  (org-cycle-overview)
+  (org-cycle-content))
 
 (org-defkey org-columns-map "c"        #'org-columns-content)
 (org-defkey org-columns-map "o"        #'org-overview)
@@ -701,7 +701,7 @@ (defun org-columns--call (fun)
                          (move-beginning-of-line 2)
                          (org-at-heading-p)))))
     (unwind-protect (funcall fun)
-      (when hide-body (outline-hide-entry)))))
+      (when hide-body (org-fold-hide-entry)))))
 
 (defun org-columns-previous-allowed-value ()
   "Switch to the previous allowed value for this column."
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index b35e66b84..ed2ae62f4 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -50,18 +50,20 @@ (declare-function org-element-property "org-element" 
(property element))
 (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
 (declare-function org-get-heading "org" (&optional no-tags no-todo no-priority 
no-comment))
 (declare-function org-get-tags "org" (&optional pos local))
-(declare-function org-hide-block-toggle "org" (&optional force no-error 
element))
+(declare-function org-fold-hide-block-toggle "org-fold" (&optional force 
no-error element))
 (declare-function org-link-display-format "ol" (s))
 (declare-function org-link-set-parameters "ol" (type &rest rest))
 (declare-function org-log-into-drawer "org" ())
 (declare-function org-make-tag-string "org" (tags))
 (declare-function org-reduced-level "org" (l))
 (declare-function org-return "org" (&optional indent arg interactive))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function org-table-end "org-table" (&optional table-type))
 (declare-function outline-next-heading "outline" ())
 (declare-function speedbar-line-directory "speedbar" (&optional depth))
 (declare-function table--at-cell-p "table" (position &optional object 
at-column))
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
+(declare-function org-fold-show-all "org-fold" (&optional types))
 
 (defvar calendar-mode-map)
 (defvar org-complex-heading-regexp)
@@ -72,6 +74,7 @@ (defvar org-table-any-border-regexp)
 (defvar org-table-dataline-regexp)
 (defvar org-table-tab-recognizes-table.el)
 (defvar org-table1-hline-regexp)
+(defvar org-fold-core-style)
 
 
 ;;; Emacs < 29 compatibility
@@ -656,7 +659,7 @@ (make-obsolete 'org-capture-import-remember-templates
 (defun org-show-block-all ()
   "Unfold all blocks in the current buffer."
   (interactive)
-  (remove-overlays nil nil 'invisible 'org-hide-block))
+  (org-fold-show-all '(blocks)))
 
 (make-obsolete 'org-show-block-all
               "use `org-show-all' instead."
@@ -699,7 +702,7 @@ (defun org-flag-drawer (flag &optional element beg end)
 When buffer positions BEG and END are provided, hide or show that
 region as a drawer without further ado."
   (declare (obsolete "use `org-hide-drawer-toggle' instead." "9.4"))
-  (if (and beg end) (org-flag-region beg end flag 'outline)
+  (if (and beg end) (org-fold-region beg end flag (if (eq org-fold-core-style 
'text-properties) 'drawer 'outline))
     (let ((drawer
           (or element
               (and (save-excursion
@@ -708,12 +711,12 @@ (defun org-flag-drawer (flag &optional element beg end)
                    (org-element-at-point)))))
       (when (memq (org-element-type drawer) '(drawer property-drawer))
        (let ((post (org-element-property :post-affiliated drawer)))
-         (org-flag-region
+         (org-fold-region
           (save-excursion (goto-char post) (line-end-position))
           (save-excursion (goto-char (org-element-property :end drawer))
                           (skip-chars-backward " \t\n")
                           (line-end-position))
-          flag 'outline)
+          flag (if (eq org-fold-core-style 'text-properties) 'drawer 'outline))
          ;; When the drawer is hidden away, make sure point lies in
          ;; a visible part of the buffer.
          (when (invisible-p (max (1- (point)) (point-min)))
@@ -725,7 +728,7 @@ (defun org-hide-block-toggle-maybe ()
 an error.  Return a non-nil value when toggling is successful."
   (declare (obsolete "use `org-hide-block-toggle' instead." "9.4"))
   (interactive)
-  (org-hide-block-toggle nil t))
+  (org-fold-hide-block-toggle nil t))
 
 (defun org-hide-block-toggle-all ()
   "Toggle the visibility of all blocks in the current buffer."
@@ -741,7 +744,7 @@ (defun org-hide-block-toggle-all ()
        (save-excursion
          (save-match-data
             (goto-char (match-beginning 0))
-            (org-hide-block-toggle)))))))
+            (org-fold-hide-block-toggle)))))))
 
 (defun org-return-indent ()
   "Goto next table row or insert a newline and indent.
@@ -973,7 +976,7 @@ (eval-after-load 'imenu
      (add-hook 'imenu-after-jump-hook
               (lambda ()
                 (when (derived-mode-p 'org-mode)
-                  (org-show-context 'org-goto))))
+                  (org-fold-show-context 'org-goto))))
      (add-hook 'org-mode-hook
               (lambda ()
                 (setq imenu-create-index-function 'org-imenu-get-tree)))))
@@ -1038,7 +1041,7 @@ (eval-after-load 'speedbar
      (define-key speedbar-file-key-map ">" 'org-agenda-remove-restriction-lock)
      (define-key speedbar-file-key-map "\C-c\C-x>" 
'org-agenda-remove-restriction-lock)
      (add-hook 'speedbar-visiting-tag-hook
-              (lambda () (and (derived-mode-p 'org-mode) (org-show-context 
'org-goto))))))
+              (lambda () (and (derived-mode-p 'org-mode) 
(org-fold-show-context 'org-goto))))))
 
 ;;;; Add Log
 
@@ -1152,7 +1155,7 @@ (defun org-bookmark-jump-unhide (&rest _)
        (or (org-invisible-p)
           (save-excursion (goto-char (max (point-min) (1- (point))))
                           (org-invisible-p)))
-       (org-show-context 'bookmark-jump)))
+       (org-fold-show-context 'bookmark-jump)))
 
 ;; Make `bookmark-jump' shows the jump location if it was hidden.
 (add-hook 'bookmark-after-jump-hook #'org-bookmark-jump-unhide)
@@ -1217,7 +1220,7 @@ (advice-add 'ecb-method-clicked :after 
#'org--ecb-show-context)
 (defun org--ecb-show-context (&rest _)
   "Make hierarchy visible when jumping into location from ECB tree buffer."
   (when (derived-mode-p 'org-mode)
-    (org-show-context)))
+    (org-fold-show-context)))
 
 ;;;; Simple
 
@@ -1225,7 +1228,7 @@ (defun org-mark-jump-unhide (&rest _)
   "Make the point visible with `org-show-context' after jumping to the mark."
   (when (and (derived-mode-p 'org-mode)
             (org-invisible-p))
-    (org-show-context 'mark-goto)))
+    (org-fold-show-context 'mark-goto)))
 
 (advice-add 'pop-to-mark-command :after #'org-mark-jump-unhide)
 
diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el
index 41813cb18..b2542ab43 100644
--- a/lisp/org-crypt.el
+++ b/lisp/org-crypt.el
@@ -73,7 +73,7 @@ (declare-function org-before-first-heading-p "org" ())
 (declare-function org-end-of-meta-data "org" (&optional full))
 (declare-function org-end-of-subtree "org" (&optional invisible-ok to-heading))
 (declare-function org-entry-get "org" (pom property &optional inherit 
literal-nil))
-(declare-function org-flag-subtree "org" (flag))
+(declare-function org-fold-subtree "org-fold" (flag))
 (declare-function org-make-tags-matcher "org" (match))
 (declare-function org-previous-visible-heading "org" (arg))
 (declare-function org-scan-tags "org" (action matcher todo-only &optional 
start-level))
@@ -243,7 +243,7 @@ (defun org-encrypt-entry ()
              (error (error-message-string err)))))
         (when folded-heading
           (goto-char folded-heading)
-          (org-flag-subtree t))
+          (org-fold-subtree t))
         nil)))))
 
 ;;;###autoload
@@ -280,7 +280,7 @@ (defun org-decrypt-entry ()
                             'org-crypt-text encrypted-text))
         (when folded-heading
           (goto-char folded-heading)
-          (org-flag-subtree t))
+          (org-fold-subtree t))
         nil)))
     (_ nil)))
 
@@ -313,7 +313,7 @@ (defun org-crypt-use-before-save-magic ()
    'org-mode-hook
    (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t))))
 
-(add-hook 'org-reveal-start-hook 'org-decrypt-entry)
+(add-hook 'org-fold-reveal-start-hook 'org-decrypt-entry)
 
 (provide 'org-crypt)
 
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 28339c1b8..f627dd4ea 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -70,6 +70,7 @@ (require 'org-footnote)
 (require 'org-list)
 (require 'org-macs)
 (require 'org-table)
+(require 'org-fold-core)
 
 (declare-function org-at-heading-p "org" (&optional _))
 (declare-function org-escape-code-in-string "org-src" (s))
diff --git a/lisp/org-feed.el b/lisp/org-feed.el
index a5fea0888..d634f9c41 100644
--- a/lisp/org-feed.el
+++ b/lisp/org-feed.el
@@ -412,8 +412,8 @@ (defun org-feed-update (feed &optional retrieve-only)
 
          ;; Normalize the visibility of the inbox tree
          (goto-char inbox-pos)
-         (org-flag-subtree t)
-         (org-show-children)
+         (org-fold-subtree t)
+         (org-fold-show-children)
 
          ;; Hooks and messages
          (when org-feed-save-after-adding (save-buffer))
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index b55f6d98e..a4c9ae770 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -52,7 +52,7 @@ (declare-function org-in-verbatim-emphasis "org" ())
 (declare-function org-inside-LaTeX-fragment-p "org" ())
 (declare-function org-inside-latex-macro-p "org" ())
 (declare-function org-mark-ring-push "org" (&optional pos buffer))
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-fold-show-context "org-fold" (&optional key))
 (declare-function outline-next-heading "outline")
 
 (defvar electric-indent-mode)
@@ -555,7 +555,7 @@ (defun org-footnote-goto-definition (label &optional 
location)
     (goto-char def-start)
     (looking-at (format "\\[fn:%s[]:]" (regexp-quote label)))
     (goto-char (match-end 0))
-    (org-show-context 'link-search)
+    (org-fold-show-context 'link-search)
     (when (derived-mode-p 'org-mode)
       (message "%s" (substitute-command-keys
                     "Edit definition and go back with \
@@ -581,7 +581,7 @@ (defun org-footnote-goto-previous-reference (label)
           (user-error "Reference is outside narrowed part of buffer")))
     (org-mark-ring-push)
     (goto-char start)
-    (org-show-context 'link-search)))
+    (org-fold-show-context 'link-search)))
 
 
 ;;;; Getters
diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index 860b0a3de..cd5000037 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -222,13 +222,13 @@ (defun org-goto-location (&optional _buf help)
                                    "  Just type for auto-isearch."
                                  "  n/p/f/b/u to navigate, q to quit.")))))
        (org-fit-window-to-buffer (get-buffer-window "*Org Help*"))
-       (org-overview)
+       (org-cycle-overview)
        (setq buffer-read-only t)
        (if (and (boundp 'org-goto-start-pos)
                 (integer-or-marker-p org-goto-start-pos))
            (progn (goto-char org-goto-start-pos)
                   (when (org-invisible-p)
-                    (org-show-set-visibility 'lineage)))
+                    (org-fold-show-set-visibility 'lineage)))
          (goto-char (point-min)))
        (let (org-special-ctrl-a/e) (org-beginning-of-line))
        (message "Select location and press RET")
@@ -279,7 +279,7 @@ (defun org-goto (&optional alternative-interface)
          (org-mark-ring-push org-goto-start-pos)
          (goto-char selected-point)
          (when (or (org-invisible-p) (org-invisible-p2))
-           (org-show-context 'org-goto)))
+           (org-fold-show-context 'org-goto)))
       (message "Quit"))))
 
 (provide 'org-goto)
diff --git a/lisp/org-id.el b/lisp/org-id.el
index a8f8eb4eb..0331b7c1d 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -333,7 +333,7 @@ (defun org-id-goto (id)
     (pop-to-buffer-same-window (marker-buffer m))
     (goto-char m)
     (move-marker m nil)
-    (org-show-context)))
+    (org-fold-show-context)))
 
 ;;;###autoload
 (defun org-id-find (id &optional markerp)
@@ -745,7 +745,7 @@ (defun org-id-open (id _)
        (funcall cmd (marker-buffer m)))
     (goto-char m)
     (move-marker m nil)
-    (org-show-context)))
+    (org-fold-show-context)))
 
 (org-link-set-parameters "id" :follow #'org-id-open)
 
diff --git a/lisp/org-keys.el b/lisp/org-keys.el
index b8e9ddd93..782ffa871 100644
--- a/lisp/org-keys.el
+++ b/lisp/org-keys.el
@@ -67,8 +67,8 @@ (declare-function org-ctrl-c-star "org" ())
 (declare-function org-ctrl-c-tab "org" (&optional arg))
 (declare-function org-cut-special "org" ())
 (declare-function org-cut-subtree "org" (&optional n))
-(declare-function org-cycle "org" (&optional arg))
-(declare-function org-cycle-agenda-files "org" ())
+(declare-function org-cycle "org-cycle" (&optional arg))
+(declare-function org-cycle-agenda-files "org-cycle" ())
 (declare-function org-date-from-calendar "org" ())
 (declare-function org-dynamic-block-insert-dblock "org" (&optional arg))
 (declare-function org-dblock-update "org" (&optional arg))
@@ -94,7 +94,7 @@ (declare-function org-feed-update-all "org" ())
 (declare-function org-fill-paragraph "org" (&optional justify region))
 (declare-function org-find-file-at-mouse "org" (ev))
 (declare-function org-footnote-action "org" (&optional special))
-(declare-function org-force-cycle-archived "org" ())
+(declare-function org-cycle-force-archived "org-cycle" ())
 (declare-function org-force-self-insert "org" (n))
 (declare-function org-forward-element "org" ())
 (declare-function org-forward-heading-same-level "org" (arg &optional 
invisible-ok))
@@ -143,8 +143,8 @@ (declare-function org-previous-visible-heading "org" (arg))
 (declare-function org-priority "org" (&optional action show))
 (declare-function org-promote-subtree "org" ())
 (declare-function org-redisplay-inline-images "org" ())
-(declare-function org-refile "org" (&optional arg1 default-buffer rfloc msg))
-(declare-function org-refile-copy "org" ())
+(declare-function org-refile "org-refile" (&optional arg1 default-buffer rfloc 
msg))
+(declare-function org-refile-copy "org-refile" ())
 (declare-function org-refile-reverse "org-refile" (&optional arg 
default-buffer rfloc msg))
 (declare-function org-reftex-citation "org" ())
 (declare-function org-reload "org" (&optional arg1))
@@ -152,7 +152,7 @@ (declare-function org-remove-file "org" (&optional file))
 (declare-function org-resolve-clocks "org" (&optional only-dangling-p 
prompt-fn last-valid))
 (declare-function org-return "org" (&optional indent))
 (declare-function org-return-and-maybe-indent "org" ())
-(declare-function org-reveal "org" (&optional siblings))
+(declare-function org-fold-reveal "org-fold" (&optional siblings))
 (declare-function org-schedule "org" (arg &optional time))
 (declare-function org-self-insert-command "org" (N))
 (declare-function org-set-effort "org" (&optional increment value))
@@ -172,9 +172,9 @@ (declare-function org-shiftmetaup "org" (&optional arg))
 (declare-function org-shiftright "org" (&optional arg))
 (declare-function org-shifttab "org" (&optional arg))
 (declare-function org-shiftup "org" (&optional arg))
-(declare-function org-show-all "org" (&optional types))
-(declare-function org-show-children "org" (&optional level))
-(declare-function org-show-subtree "org" ())
+(declare-function org-fold-show-all "org-fold" (&optional types))
+(declare-function org-fold-show-children "org-fold" (&optional level))
+(declare-function org-fold-show-subtree "org-fold" ())
 (declare-function org-sort "org" (&optional with-case))
 (declare-function org-sparse-tree "org" (&optional arg type))
 (declare-function org-table-copy-down "org" (n))
@@ -423,7 +423,7 @@ (define-key org-mode-map [menu-bar hide] 'undefined)
 (define-key org-mode-map [menu-bar show] 'undefined)
 
 (define-key org-mode-map [remap outline-mark-subtree] #'org-mark-subtree)
-(define-key org-mode-map [remap outline-show-subtree] #'org-show-subtree)
+(define-key org-mode-map [remap outline-show-subtree] #'org-fold-show-subtree)
 (define-key org-mode-map [remap outline-forward-same-level]
   #'org-forward-heading-same-level)
 (define-key org-mode-map [remap outline-backward-same-level]
@@ -437,14 +437,14 @@ (define-key org-mode-map [remap 
outline-next-visible-heading]
   #'org-next-visible-heading)
 (define-key org-mode-map [remap outline-previous-visible-heading]
   #'org-previous-visible-heading)
-(define-key org-mode-map [remap show-children] #'org-show-children)
+(define-key org-mode-map [remap outline-show-children] 
#'org-fold-show-children)
 
 ;;;; Make `C-c C-x' a prefix key
 (org-defkey org-mode-map (kbd "C-c C-x") (make-sparse-keymap))
 
 ;;;; TAB key with modifiers
 (org-defkey org-mode-map (kbd "TAB") #'org-cycle)
-(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-force-cycle-archived)
+(org-defkey org-mode-map (kbd "C-c C-<tab>") #'org-cycle-force-archived)
 ;; Override text-mode binding to expose `complete-symbol' for
 ;; pcomplete functionality.
 (org-defkey org-mode-map (kbd "M-TAB") nil)
@@ -544,7 +544,7 @@ (org-remap org-mode-map
 
 ;;;; All the other keys
 (org-defkey org-mode-map (kbd "|") #'org-force-self-insert)
-(org-defkey org-mode-map (kbd "C-c C-r") #'org-reveal)
+(org-defkey org-mode-map (kbd "C-c C-r") #'org-fold-reveal)
 (org-defkey org-mode-map (kbd "C-M-t") #'org-transpose-element)
 (org-defkey org-mode-map (kbd "M-}") #'org-forward-element)
 (org-defkey org-mode-map (kbd "ESC }") #'org-forward-element)
diff --git a/lisp/org-lint.el b/lisp/org-lint.el
index b21412be1..cce6fddbd 100644
--- a/lisp/org-lint.el
+++ b/lisp/org-lint.el
@@ -91,6 +91,7 @@ (require 'oc)
 (require 'ol)
 (require 'org-attach)
 (require 'org-macro)
+(require 'org-fold)
 (require 'ox)
 (require 'seq)
 
@@ -264,7 +265,7 @@ (defun org-lint--jump-to-source ()
   (let ((l (org-lint--current-line)))
     (switch-to-buffer-other-window org-lint--source-buffer)
     (org-goto-line l)
-    (org-show-set-visibility 'local)
+    (org-fold-show-set-visibility 'local)
     (recenter)))
 
 (defun org-lint--show-source ()
diff --git a/lisp/org-list.el b/lisp/org-list.el
index f1ab2ca76..05a73a609 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -79,6 +79,7 @@ ;;; Code:
 (require 'cl-lib)
 (require 'org-macs)
 (require 'org-compat)
+(require 'org-fold-core)
 
 (defvar org-M-RET-may-split-line)
 (defvar org-adapt-indentation)
@@ -138,7 +139,8 @@ (declare-function org-outline-level "org" ())
 (declare-function org-previous-line-empty-p "org" ())
 (declare-function org-reduced-level "org" (L))
 (declare-function org-set-tags "org" (tags))
-(declare-function org-show-subtree "org" ())
+(declare-function org-fold-show-subtree "org-fold" ())
+(declare-function org-fold-region "org-fold" (from to flag &optional spec))
 (declare-function org-sort-remove-invisible "org" (S))
 (declare-function org-time-string-to-seconds "org" (s))
 (declare-function org-timer-hms-to-secs "org-timer" (hms))
@@ -2029,7 +2031,7 @@ (defun org-list-set-item-visibility (item struct view)
    ((eq view 'folded)
     (let ((item-end (org-list-get-item-end-before-blank item struct)))
       ;; Hide from eol
-      (org-flag-region (save-excursion (goto-char item) (line-end-position))
+      (org-fold-region (save-excursion (goto-char item) (line-end-position))
                       item-end t 'outline)))
    ((eq view 'children)
     ;; First show everything.
@@ -2042,7 +2044,7 @@ (defun org-list-set-item-visibility (item struct view)
    ((eq view 'subtree)
     ;; Show everything
     (let ((item-end (org-list-get-item-end item struct)))
-      (org-flag-region item item-end nil 'outline)))))
+      (org-fold-region item item-end nil 'outline)))))
 
 (defun org-list-item-body-column (item)
   "Return column at which body of ITEM should start."
@@ -2455,7 +2457,7 @@ (defun org-reset-checkbox-state-subtree ()
     (save-restriction
       (save-excursion
        (org-narrow-to-subtree)
-       (org-show-subtree)
+       (org-fold-show-subtree)
        (goto-char (point-min))
        (let ((end (point-max)))
          (while (< (point) end)
diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index f63458f70..7703e09e4 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -35,11 +35,16 @@ (require 'cl-lib)
 (require 'format-spec)
 
 (declare-function org-mode "org" ())
-(declare-function org-show-context "org" (&optional key))
+(declare-function org-agenda-files "org" (&optional unrestricted archives))
+(declare-function org-fold-show-context "org-fold" (&optional key))
+(declare-function org-fold-save-outline-visibility "org-fold" (use-markers 
&rest body))
+(declare-function org-fold-next-visibility-change "org-fold" (&optional pos 
limit ignore-hidden-p previous-p))
+(declare-function org-fold-folded-p "org-fold" (&optional pos limit 
ignore-hidden-p previous-p))
 (declare-function string-collate-lessp "org-compat" (s1 s2 &optional locale 
ignore-case))
 
 (defvar org-ts-regexp0)
 (defvar ffap-url-regexp)
+(defvar org-fold-core-style)
 
 
 ;;; Macros
@@ -117,38 +122,7 @@ (defmacro org-no-read-only (&rest body)
   (declare (debug (body)))
   `(let ((inhibit-read-only t)) ,@body))
 
-(defmacro org-save-outline-visibility (use-markers &rest body)
-  "Save and restore outline visibility around BODY.
-If USE-MARKERS is non-nil, use markers for the positions.  This
-means that the buffer may change while running BODY, but it also
-means that the buffer should stay alive during the operation,
-because otherwise all these markers will point to nowhere."
-  (declare (debug (form body)) (indent 1))
-  (org-with-gensyms (data invisible-types markers?)
-    `(let* ((,invisible-types '(org-hide-block outline))
-           (,markers? ,use-markers)
-           (,data
-            (mapcar (lambda (o)
-                      (let ((beg (overlay-start o))
-                            (end (overlay-end o))
-                            (type (overlay-get o 'invisible)))
-                        (and beg end
-                             (> end beg)
-                             (memq type ,invisible-types)
-                             (list (if ,markers? (copy-marker beg) beg)
-                                   (if ,markers? (copy-marker end t) end)
-                                   type))))
-                    (org-with-wide-buffer
-                     (overlays-in (point-min) (point-max))))))
-       (unwind-protect (progn ,@body)
-        (org-with-wide-buffer
-         (dolist (type ,invisible-types)
-           (remove-overlays (point-min) (point-max) 'invisible type))
-         (pcase-dolist (`(,beg ,end ,type) (delq nil ,data))
-           (org-flag-region beg end t type)
-           (when ,markers?
-             (set-marker beg nil)
-             (set-marker end nil))))))))
+(defalias 'org-save-outline-visibility #'org-fold-save-outline-visibility)
 
 (defmacro org-with-wide-buffer (&rest body)
   "Execute body while temporarily widening the buffer."
diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
index 5cfaa7fe0..dd5333399 100644
--- a/lisp/org-mobile.el
+++ b/lisp/org-mobile.el
@@ -1064,7 +1064,7 @@ (defun org-mobile-edit (what old new)
          (progn
            ;; Workaround a `org-insert-heading-respect-content' bug
            ;; which prevents correct insertion when point is invisible
-           (org-show-subtree)
+           (org-fold-show-subtree)
            (end-of-line 1)
            (org-insert-heading-respect-content t)
            (org-demote))
diff --git a/lisp/org-mouse.el b/lisp/org-mouse.el
index 2d8136b75..912efb770 100644
--- a/lisp/org-mouse.el
+++ b/lisp/org-mouse.el
@@ -1007,10 +1007,10 @@ (defun org-mouse-do-remotely (command)
            (with-current-buffer buffer
              (widen)
              (goto-char pos)
-             (org-show-hidden-entry)
+             (org-fold-show-hidden-entry)
              (save-excursion
                (and (outline-next-heading)
-                    (org-flag-heading nil)))   ; show the next heading
+                    (org-fold-heading nil)))   ; show the next heading
              (org-back-to-heading)
              (setq marker (point-marker))
              (goto-char (max (point-at-bol) (- (point-at-eol) anticol)))
diff --git a/lisp/org-refile.el b/lisp/org-refile.el
index 5ad73422e..6f2b019ad 100644
--- a/lisp/org-refile.el
+++ b/lisp/org-refile.el
@@ -521,7 +521,7 @@ (defun org-refile (&optional arg default-buffer rfloc msg)
                (goto-char (cond (pos)
                                 ((org-notes-order-reversed-p) (point-min))
                                 (t (point-max))))
-               (org-show-context 'org-goto))
+               (org-fold-show-context 'org-goto))
            (if regionp
                (progn
                  (org-kill-new (buffer-substring region-start region-end))
diff --git a/lisp/org-src.el b/lisp/org-src.el
index 663ccb334..cc4918161 100644
--- a/lisp/org-src.el
+++ b/lisp/org-src.el
@@ -1358,8 +1358,10 @@ (defun org-edit-src-exit ()
       (goto-char beg)
       (cond
        ;; Block is hidden; move at start of block.
-       ((cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block))
-                (overlays-at (point)))
+       ((if (eq org-fold-core-style 'text-properties)
+            (org-fold-folded-p nil 'block)
+          (cl-some (lambda (o) (eq (overlay-get o 'invisible) 'org-hide-block))
+                  (overlays-at (point))))
        (beginning-of-line 0))
        (write-back (org-src--goto-coordinates coordinates beg end))))
     ;; Clean up left-over markers and restore window configuration.
diff --git a/lisp/org-timer.el b/lisp/org-timer.el
index a6f3648fa..0c9350e76 100644
--- a/lisp/org-timer.el
+++ b/lisp/org-timer.el
@@ -478,7 +478,7 @@ (defun org-timer--get-timer-title ()
        (with-current-buffer (marker-buffer marker)
          (org-with-wide-buffer
           (goto-char hdmarker)
-          (org-show-entry)
+          (org-fold-show-entry)
           (or (ignore-errors (org-get-heading))
               (buffer-name (buffer-base-buffer))))))))
    ((derived-mode-p 'org-mode)
diff --git a/lisp/org.el b/lisp/org.el
index 8c823a7c8..ca4973bc3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -96,6 +96,9 @@ (require 'org-keys)
 (require 'ol)
 (require 'oc)
 (require 'org-table)
+(require 'org-fold)
+
+(require 'org-cycle)
 
 ;; `org-outline-regexp' ought to be a defconst but is let-bound in
 ;; some places -- e.g. see the macro `org-with-limited-levels'.
@@ -4670,7 +4673,7 @@ (define-derived-mode org-mode outline-mode "Org"
        t))
      (when org-startup-with-inline-images (org-display-inline-images))
      (when org-startup-with-latex-preview (org-latex-preview '(16)))
-     (unless org-inhibit-startup-visibility-stuff (org-set-startup-visibility))
+     (unless org-inhibit-startup-visibility-stuff 
(org-cycle-set-startup-visibility))
      (when org-startup-truncated (setq truncate-lines t))
      (when org-startup-numerated (require 'org-num) (org-num-mode 1))
      (when org-startup-indented (require 'org-indent) (org-indent-mode 1))))
@@ -5865,7 +5868,7 @@ (defun org-tree-to-indirect-buffer (&optional arg)
       (pop-to-buffer ibuf))
      (t (error "Invalid value")))
     (narrow-to-region beg end)
-    (org-show-all '(headings drawers blocks))
+    (org-fold-show-all '(headings drawers blocks))
     (goto-char pos)
     (run-hook-with-args 'org-cycle-hook 'all)
     (and (window-live-p cwin) (select-window cwin))))
@@ -5977,10 +5980,15 @@ (defun org-insert-heading (&optional arg invisible-ok 
top)
       ;; When INVISIBLE-OK is non-nil, ensure newly created headline
       ;; is visible.
       (unless invisible-ok
-       (pcase (get-char-property-and-overlay (point) 'invisible)
-         (`(outline . ,o)
-          (move-overlay o (overlay-start o) (line-end-position 0)))
-         (_ nil))))
+        (if (eq org-fold-core-style 'text-properties)
+           (cond
+            ((org-fold-folded-p (line-beginning-position) 'headline)
+             (org-fold-region (line-end-position 0) (line-end-position) nil 
'headline))
+            (t nil))
+          (pcase (get-char-property-and-overlay (point) 'invisible)
+           (`(outline . ,o)
+            (move-overlay o (overlay-start o) (line-end-position 0)))
+           (_ nil)))))
      ;; At a headline...
      ((org-at-heading-p)
       (cond ((bolp)
@@ -6522,7 +6530,7 @@ (defun org-convert-to-oddeven-levels ()
   (goto-char (point-min))
   ;; First check if there are no even levels
   (when (re-search-forward "^\\(\\*\\*\\)+ " nil t)
-    (org-show-set-visibility 'canonical)
+    (org-fold-show-set-visibility 'canonical)
     (error "Not all levels are odd in this file.  Conversion not possible"))
   (when (yes-or-no-p "Are you sure you want to globally change levels to 
odd-even? ")
     (let ((outline-regexp org-outline-regexp)
@@ -6615,9 +6623,9 @@ (defun org-move-subtree-down (&optional arg)
      (setq txt (buffer-substring beg end))
      (org-save-markers-in-region beg end)
      (delete-region beg end)
-     (org-remove-empty-overlays-at beg)
-     (unless (= beg (point-min)) (org-flag-region (1- beg) beg nil 'outline))
-     (unless (bobp) (org-flag-region (1- (point)) (point) nil 'outline))
+     (when (eq org-fold-core-style 'overlays) (org-remove-empty-overlays-at 
beg))
+     (unless (= beg (point-min)) (org-fold-region (1- beg) beg nil 'outline))
+     (unless (bobp) (org-fold-region (1- (point)) (point) nil 'outline))
      (and (not (bolp)) (looking-at "\n") (forward-char 1))
      (let ((bbb (point)))
        (insert-before-markers txt)
@@ -6628,9 +6636,9 @@ (defun org-move-subtree-down (&optional arg)
      (org-skip-whitespace)
      (move-marker ins-point nil)
      (if folded
-        (org-flag-subtree t)
-       (org-show-entry)
-       (org-show-children))
+        (org-fold-subtree t)
+       (org-fold-show-entry)
+       (org-fold-show-children))
      (org-clean-visibility-after-subtree-move)
      ;; move back to the initial column we were at
      (move-to-column col))))
@@ -6988,7 +6996,7 @@ (defun org-clone-subtree-with-time-shift (n &optional 
shift)
                  (insert template)
                  (org-mode)
                  (goto-char (point-min))
-                 (org-show-subtree)
+                 (org-fold-show-subtree)
                  (and idprop (if org-clone-delete-id
                                  (org-entry-delete nil "ID")
                                (org-id-get-create t)))
@@ -7260,7 +7268,7 @@ (defun org-sort-entries
                       (point))
            what "children")
       (goto-char start)
-      (outline-show-subtree)
+      (org-fold-show-subtree)
       (outline-next-heading))
      (t
       ;; we will sort the top-level entries in this file
@@ -7276,7 +7284,7 @@ (defun org-sort-entries
       (setq end (point-max))
       (setq what "top-level")
       (goto-char start)
-      (org-show-all '(headings drawers blocks))))
+      (org-fold-show-all '(headings drawers blocks))))
 
     (setq beg (point))
     (when (>= beg end) (goto-char start) (user-error "Nothing to sort"))
@@ -7860,7 +7868,7 @@ (defun org-open-file (path &optional in-emacs line search)
       (funcall (cdr (assq 'file org-link-frame-setup)) file)
       (widen)
       (cond (line (org-goto-line line)
-                 (when (derived-mode-p 'org-mode) (org-reveal)))
+                 (when (derived-mode-p 'org-mode) (org-fold-reveal)))
            (search (condition-case err
                        (org-link-search search)
                      ;; Save position before error-ing out so user
@@ -8156,7 +8164,7 @@ (defun org-mark-ring-goto (&optional n)
     (setq m (car p))
     (pop-to-buffer-same-window (marker-buffer m))
     (goto-char m)
-    (when (or (org-invisible-p) (org-invisible-p2)) (org-show-context 
'mark-goto))))
+    (when (or (org-invisible-p) (org-invisible-p2)) (org-fold-show-context 
'mark-goto))))
 
 ;;; Following specific links
 
@@ -10167,7 +10175,7 @@ (defun org-occur (regexp &optional keep-previous 
callback)
   "Make a compact tree showing all matches of REGEXP.
 
 The tree will show the lines where the regexp matches, and any other context
-defined in `org-show-context-detail', which see.
+defined in `org-fold-show-context-detail', which see.
 
 When optional argument KEEP-PREVIOUS is non-nil, highlighting and exposing
 done by a previous call to `org-occur' will be kept, to allow stacking of
@@ -10189,7 +10197,7 @@ (defun org-occur (regexp &optional keep-previous 
callback)
       (when (or (not keep-previous)        ; do not want to keep
                (not org-occur-highlights)) ; no previous matches
        ;; hide everything
-       (org-overview))
+       (org-cycle-overview))
       (let ((case-fold-search (if (eq org-occur-case-fold-search 'smart)
                                  (isearch-no-upper-case-p regexp t)
                                org-occur-case-fold-search)))
@@ -10199,12 +10207,12 @@ (defun org-occur (regexp &optional keep-previous 
callback)
            (setq cnt (1+ cnt))
            (when org-highlight-sparse-tree-matches
              (org-highlight-new-match (match-beginning 0) (match-end 0)))
-           (org-show-context 'occur-tree)))))
+           (org-fold-show-context 'occur-tree)))))
     (when org-remove-highlights-with-change
       (add-hook 'before-change-functions 'org-remove-occur-highlights
                nil 'local))
     (unless org-sparse-tree-open-archived-trees
-      (org-hide-archived-subtrees (point-min) (point-max)))
+      (org-fold-hide-archived-subtrees (point-min) (point-max)))
     (run-hooks 'org-occur-hook)
     (when (called-interactively-p 'interactive)
       (message "%d match(es) for regexp %s" cnt regexp))
@@ -10488,7 +10496,7 @@ (defun org-scan-tags (action matcher todo-only 
&optional start-level)
     (save-excursion
       (goto-char (point-min))
       (when (eq action 'sparse-tree)
-       (org-overview)
+       (org-cycle-overview)
        (org-remove-occur-highlights))
       (if (org-element--cache-active-p)
           (let ((fast-re (concat "^"
@@ -10537,7 +10545,7 @@ (defun org-scan-tags (action matcher todo-only 
&optional start-level)
                          (org-get-heading) (match-end 0)
                          (org-highlight-new-match
                           (match-beginning 1) (match-end 1)))
-                    (org-show-context 'tags-tree))
+                    (org-fold-show-context 'tags-tree))
                    ((eq action 'agenda)
                      (let* ((effort (org-entry-get (point) 
org-effort-property))
                             (effort-minutes (when effort (save-match-data 
(org-duration-to-minutes effort)))))
@@ -10663,7 +10671,7 @@ (defun org-scan-tags (action matcher todo-only 
&optional start-level)
                     (org-get-heading) (match-end 0)
                     (org-highlight-new-match
                      (match-beginning 1) (match-end 1)))
-               (org-show-context 'tags-tree))
+               (org-fold-show-context 'tags-tree))
               ((eq action 'agenda)
                (setq txt (org-agenda-format-item
                           ""
@@ -10701,7 +10709,7 @@ (defun org-scan-tags (action matcher todo-only 
&optional start-level)
            (and (= (point) lspos) (end-of-line 1))))))
     (when (and (eq action 'sparse-tree)
               (not org-sparse-tree-open-archived-trees))
-      (org-hide-archived-subtrees (point-min) (point-max)))
+      (org-fold-hide-archived-subtrees (point-min) (point-max)))
     (nreverse rtn)))
 
 (defun org-remove-uninherited-tags (tags)
@@ -12549,7 +12557,7 @@ (defun org-insert-property-drawer ()
           (inhibit-read-only t))
        (unless (bobp) (insert "\n"))
        (insert ":PROPERTIES:\n:END:")
-       (org-flag-region (line-end-position 0) (point) t 'outline)
+       (org-fold-region (line-end-position 0) (point) t (if (eq 
org-fold-core-style 'text-properties) 'drawer 'outline))
        (when (or (eobp) (= begin (point-min))) (insert "\n"))
        (org-indent-region begin (point))))))
 
@@ -14391,7 +14399,7 @@ (defun org-timestamp-change (n &optional what updown 
suppress-tmp-delay)
                  (message "No clock to adjust")
                (save-excursion
                  (org-goto-marker-or-bmk clfixpos)
-                 (org-show-subtree)
+                 (org-fold-show-subtree)
                  (when (re-search-forward clrgx nil t)
                    (goto-char (match-beginning 1))
                    (let (org-clock-adjust-closest)
@@ -15893,7 +15901,7 @@ (defun org-self-insert-command (N)
 If the cursor is in a table looking at whitespace, the whitespace is
 overwritten, and the table is not marked as requiring realignment."
   (interactive "p")
-  (org-check-before-invisible-edit 'insert)
+  (org-fold-check-before-invisible-edit 'insert)
   (cond
    ((and org-use-speed-commands
         (let ((kv (this-command-keys-vector)))
@@ -15963,7 +15971,7 @@ (defun org-delete-backward-char (N)
 because, in this case the deletion might narrow the column."
   (interactive "p")
   (save-match-data
-    (org-check-before-invisible-edit 'delete-backward)
+    (org-fold-check-before-invisible-edit 'delete-backward)
     (if (and (= N 1)
             (not overwrite-mode)
             (not (org-region-active-p))
@@ -15983,7 +15991,7 @@ (defun org-delete-char (N)
 because, in this case the deletion might narrow the column."
   (interactive "p")
   (save-match-data
-    (org-check-before-invisible-edit 'delete)
+    (org-fold-check-before-invisible-edit 'delete)
     (cond
      ((or (/= N 1)
          (eq (char-after) ?|)
@@ -16169,11 +16177,11 @@ (defun org-shifttab (&optional arg)
    ((integerp arg)
     (let ((arg2 (if org-odd-levels-only (1- (* 2 arg)) arg)))
       (message "Content view to level: %d" arg)
-      (org-content (prefix-numeric-value arg2))
+      (org-cycle-content (prefix-numeric-value arg2))
       (org-cycle-show-empty-lines t)
       (setq org-cycle-global-status 'overview)
       (run-hook-with-args 'org-cycle-hook 'overview)))
-   (t (call-interactively 'org-global-cycle))))
+   (t (call-interactively 'org-cycle-global))))
 
 (defun org-shiftmetaleft ()
   "Promote subtree or delete table column.
@@ -16327,14 +16335,14 @@ (defun org-check-for-hidden (what)
          (setq beg (point-at-bol))
          (beginning-of-line 2)
          (while (and (not (eobp)) ;; this is like `next-line'
-                     (get-char-property (1- (point)) 'invisible))
+                     (org-invisible-p (1- (point))))
            (beginning-of-line 2))
          (setq end (point))
          (goto-char beg)
          (goto-char (point-at-eol))
          (setq end (max end (point)))
          (while (re-search-forward re end t)
-           (when (get-char-property (match-beginning 0) 'invisible)
+           (when (org-invisible-p (match-beginning 0))
              (throw 'exit t))))
        nil))))
 
@@ -16622,11 +16630,18 @@ (defun org-copy-visible (beg end)
   (interactive "r")
   (let ((result ""))
     (while (/= beg end)
-      (if (invisible-p beg)
-          (setq beg (next-single-char-property-change beg 'invisible nil end))
+      (if (eq org-fold-core-style 'text-properties)
+          (progn
+            (while (org-invisible-p beg)
+             (setq beg (org-fold-next-visibility-change beg end)))
+            (let ((next (org-fold-next-visibility-change beg end)))
+             (setq result (concat result (buffer-substring beg next)))
+             (setq beg next)))
+        (when (invisible-p beg)
+         (setq beg (next-single-char-property-change beg 'invisible nil end)))
         (let ((next (next-single-char-property-change beg 'invisible nil end)))
-          (setq result (concat result (buffer-substring beg next)))
-          (setq beg next))))
+         (setq result (concat result (buffer-substring beg next)))
+         (setq beg next))))
     (setq deactivate-mark t)
     (kill-new result)
     (message "Visible strings have been copied to the kill ring.")))
@@ -17000,14 +17015,14 @@ (defun org-kill-note-or-show-branches ()
   (cond (org-finish-function
         (let ((org-note-abort t)) (funcall org-finish-function)))
        ((org-before-first-heading-p)
-        (org-show-branches-buffer)
-        (org-hide-archived-subtrees (point-min) (point-max)))
+        (org-fold-show-branches-buffer)
+        (org-fold-hide-archived-subtrees (point-min) (point-max)))
        (t
         (let ((beg (progn (org-back-to-heading) (point)))
               (end (save-excursion (org-end-of-subtree t t) (point))))
-          (outline-hide-subtree)
-          (outline-show-branches)
-          (org-hide-archived-subtrees beg end)))))
+          (org-fold-hide-subtree)
+          (org-fold-show-branches)
+          (org-fold-hide-archived-subtrees beg end)))))
 
 (defun org-delete-indentation (&optional arg)
   "Join current line to previous and fix whitespace at join.
@@ -17130,7 +17145,7 @@ (defun org-return (&optional indent arg interactive)
         (org-auto-align-tags (org-align-tags))
         (t (org--align-tags-here tags-column))) ;preserve tags column
        (end-of-line)
-       (org-show-entry)
+       (org-fold-show-entry)
        (org--newline indent arg interactive)
        (when string (save-excursion (insert (org-trim string))))))
      ;; In a list, make sure indenting keeps trailing text within.
@@ -17168,11 +17183,11 @@ (defun org-ctrl-c-tab (&optional arg)
     (call-interactively #'org-table-toggle-column-width))
    ((org-before-first-heading-p)
     (save-excursion
-      (org-flag-above-first-heading)
-      (outline-hide-sublevels (or arg 1))))
+      (org-fold-flag-above-first-heading)
+      (org-fold-hide-sublevels (or arg 1))))
    (t
-    (outline-hide-subtree)
-    (org-show-children arg))))
+    (org-fold-hide-subtree)
+    (org-fold-show-children arg))))
 
 (defun org-ctrl-c-star ()
   "Compute table, or change heading status of lines.
@@ -17307,7 +17322,7 @@ (defun org-meta-return (&optional arg)
 `org-table-wrap-region', depending on context.  When called with
 an argument, unconditionally call `org-insert-heading'."
   (interactive "P")
-  (org-check-before-invisible-edit 'insert)
+  (org-fold-check-before-invisible-edit 'insert)
   (or (run-hook-with-args-until-success 'org-metareturn-hook)
       (call-interactively (cond (arg #'org-insert-heading)
                                ((org-at-table-p) #'org-table-wrap-region)
@@ -17327,8 +17342,8 @@ (easy-menu-define org-org-menu org-mode-map "Org menu."
      ["Cycle Visibility" org-cycle :active (or (bobp) (outline-on-heading-p))]
      ["Cycle Global Visibility" org-shifttab :active (not (org-at-table-p))]
      ["Sparse Tree..." org-sparse-tree t]
-     ["Reveal Context" org-reveal t]
-     ["Show All" org-show-all t]
+     ["Reveal Context" org-fold-reveal t]
+     ["Show All" org-fold-show-all t]
      "--"
      ["Subtree to indirect buffer" org-tree-to-indirect-buffer t])
     "--"
@@ -17787,7 +17802,7 @@ (defun org-goto-marker-or-bmk (marker &optional 
bookmark)
        (when (or (> marker (point-max)) (< marker (point-min)))
          (widen))
        (goto-char marker)
-       (org-show-context 'org-goto))
+       (org-fold-show-context 'org-goto))
     (if bookmark
        (bookmark-jump bookmark)
       (error "Cannot find location"))))
@@ -18024,7 +18039,7 @@ (defun org-occur-in-agenda-files (regexp &optional 
_nlines)
      regexp)))
 
 (add-hook 'occur-mode-find-occurrence-hook
-         (lambda () (when (derived-mode-p 'org-mode) (org-reveal))))
+         (lambda () (when (derived-mode-p 'org-mode) (org-fold-reveal))))
 
 (defun org-occur-link-in-agenda-files ()
   "Create a link and search for it in the agendas.
@@ -18960,7 +18975,7 @@ (defun org-next-block (arg &optional backward 
block-regexp)
          (cl-decf count))))
     (if (= count 0)
        (prog1 (goto-char (org-element-property :post-affiliated last-element))
-         (save-match-data (org-show-context)))
+         (save-match-data (org-fold-show-context)))
       (goto-char origin)
       (user-error "No %s code blocks" (if backward "previous" "further")))))
 
@@ -19441,7 +19456,7 @@ (defun org-kill-line (&optional _arg)
    ((or (not org-special-ctrl-k)
        (bolp)
        (not (org-at-heading-p)))
-    (when (and (get-char-property (line-end-position) 'invisible)
+    (when (and (org-invisible-p (line-end-position))
               org-ctrl-k-protect-subtree
               (or (eq org-ctrl-k-protect-subtree 'error)
                   (not (y-or-n-p "Kill hidden subtree along with headline? 
"))))
@@ -19529,7 +19544,7 @@ (defun org-yank-generic (command arg)
             (or (looking-at org-outline-regexp)
                 (re-search-forward org-outline-regexp-bol end t))
             (while (and (< (point) end) (looking-at org-outline-regexp))
-              (org-flag-subtree t)
+              (org-fold-subtree t)
               (org-cycle-show-empty-lines 'folded)
               (condition-case nil
                   (outline-forward-same-level 1)
@@ -19586,7 +19601,7 @@ (defun org-back-to-heading (&optional invisible-ok)
                      (fboundp 'org-inlinetask-end-p)
                      (org-inlinetask-end-p))
                 (org-inlinetask-goto-beginning)
-             (setq found (and (or invisible-ok (not (org-invisible-p)))
+             (setq found (and (or invisible-ok (not (org-fold-folded-p)))
                               (point))))))
        (goto-char found)
        found)))
@@ -20623,9 +20638,9 @@ (defun org-info-find-node (&optional nodename)
 
 ;;; Finish up
 
-(add-hook 'org-mode-hook     ;remove overlays when changing major mode
+(add-hook 'org-mode-hook     ;remove folds when changing major mode
          (lambda () (add-hook 'change-major-mode-hook
-                              'org-show-all 'append 'local)))
+                         'org-fold-show-all 'append 'local)))
 
 (provide 'org)
 
diff --git a/lisp/ox-org.el b/lisp/ox-org.el
index 3d3c4fe6a..96d22d178 100644
--- a/lisp/ox-org.el
+++ b/lisp/ox-org.el
@@ -329,7 +329,7 @@ (defun org-org-publish-to-org (plist filename pub-dir)
           newbuf)
       (with-current-buffer work-buffer
         (org-font-lock-ensure)
-        (org-show-all)
+        (org-fold-show-all)
         (setq newbuf (htmlize-buffer)))
       (with-current-buffer newbuf
        (when org-org-htmlized-css-url
diff --git a/testing/lisp/test-org-list.el b/testing/lisp/test-org-list.el
index e21409ca5..a9490692e 100644
--- a/testing/lisp/test-org-list.el
+++ b/testing/lisp/test-org-list.el
@@ -627,7 +627,7 @@ (ert-deftest 
test-org-list/move-item-down-contents-visibility ()
   #+BEGIN_CENTER
   Text2
   #+END_CENTER"
-    (org-hide-block-all)
+    (org-fold-hide-block-all)
     (let ((invisible-property-1
           (progn
             (search-forward "Text1")
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 6aecc3af8..0a47618ca 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -3787,7 +3787,7 @@ (ert-deftest test-org/end-of-line ()
   (should-not
    (org-test-with-temp-text "#+BEGIN_CENTER\nContents\n#+END_CENTER"
      (let ((org-special-ctrl-a/e t))
-       (org-hide-block-toggle)
+       (org-fold-hide-block-toggle)
        (org-end-of-line)
        (eobp))))
   ;; Get past invisible characters at the end of line.
@@ -3935,7 +3935,7 @@ (ert-deftest test-org/forward-paragraph ()
   (should
    (= 6
       (org-test-with-temp-text "#+begin_center\nP1\n\nP2\n#+end_center\nP3"
-       (org-hide-block-toggle)
+       (org-fold-hide-block-toggle)
        (org-forward-paragraph)
        (org-current-line))))
   ;; On an item or a footnote definition, move past the first element
@@ -4055,7 +4055,7 @@ (ert-deftest test-org/backward-paragraph ()
      (bobp)))
   (should
    (org-test-with-temp-text "#+begin_center\nP1\n\nP2\n#+end_center\n"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (goto-char (point-max))
      (org-backward-paragraph)
      (bobp)))
@@ -8057,108 +8057,110 @@ (ert-deftest test-org/timestamp-to-time ()
 ;;; Visibility
 
 (ert-deftest test-org/hide-drawer-toggle ()
-  "Test `org-hide-drawer-toggle' specifications."
+  "Test `org-fold-hide-drawer-toggle' specifications."
   ;; Error when not at a drawer.
   (should-error
    (org-test-with-temp-text ":fake-drawer:\ncontents"
-     (org-hide-drawer-toggle 'off)
+     (org-fold-hide-drawer-toggle 'off)
      (get-char-property (line-end-position) 'invisible)))
   (should-error
    (org-test-with-temp-text
        "#+begin_example\n<point>:D:\nc\n:END:\n#+end_example"
-     (org-hide-drawer-toggle t)))
+     (org-fold-hide-drawer-toggle t)))
   ;; Hide drawer.
   (should
    (org-test-with-temp-text ":drawer:\ncontents\n:end:"
-     (org-hide-drawer-toggle)
+     (org-fold-show-all)
+     (org-fold-hide-drawer-toggle)
      (get-char-property (line-end-position) 'invisible)))
   ;; Show drawer unconditionally when optional argument is `off'.
   (should-not
    (org-test-with-temp-text ":drawer:\ncontents\n:end:"
-     (org-hide-drawer-toggle)
-     (org-hide-drawer-toggle 'off)
+     (org-fold-hide-drawer-toggle)
+     (org-fold-hide-drawer-toggle 'off)
      (get-char-property (line-end-position) 'invisible)))
   ;; Hide drawer unconditionally when optional argument is non-nil.
   (should
    (org-test-with-temp-text ":drawer:\ncontents\n:end:"
-     (org-hide-drawer-toggle t)
+     (org-fold-hide-drawer-toggle t)
      (get-char-property (line-end-position) 'invisible)))
   ;; Do not hide drawer when called from final blank lines.
   (should-not
    (org-test-with-temp-text ":drawer:\ncontents\n:end:\n\n<point>"
-     (org-hide-drawer-toggle)
+     (org-fold-show-all)
+     (org-fold-hide-drawer-toggle)
      (goto-char (point-min))
      (get-char-property (line-end-position) 'invisible)))
   ;; Don't leave point in an invisible part of the buffer when hiding
   ;; a drawer away.
   (should-not
    (org-test-with-temp-text ":drawer:\ncontents\n<point>:end:"
-     (org-hide-drawer-toggle)
+     (org-fold-hide-drawer-toggle)
      (get-char-property (point) 'invisible))))
 
 (ert-deftest test-org/hide-block-toggle ()
-  "Test `org-hide-block-toggle' specifications."
+  "Test `org-fold-hide-block-toggle' specifications."
   ;; Error when not at a block.
   (should-error
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents"
-     (org-hide-block-toggle 'off)
+     (org-fold-hide-block-toggle 'off)
      (get-char-property (line-end-position) 'invisible)))
   ;; Hide block.
   (should
    (org-test-with-temp-text "#+BEGIN_CENTER\ncontents\n#+END_CENTER"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (get-char-property (line-end-position) 'invisible)))
   (should
    (org-test-with-temp-text "#+BEGIN_EXAMPLE\ncontents\n#+END_EXAMPLE"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (get-char-property (line-end-position) 'invisible)))
   ;; Show block unconditionally when optional argument is `off'.
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE"
-     (org-hide-block-toggle)
-     (org-hide-block-toggle 'off)
+     (org-fold-hide-block-toggle)
+     (org-fold-hide-block-toggle 'off)
      (get-char-property (line-end-position) 'invisible)))
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE"
-     (org-hide-block-toggle 'off)
+     (org-fold-hide-block-toggle 'off)
      (get-char-property (line-end-position) 'invisible)))
   ;; Hide block unconditionally when optional argument is non-nil.
   (should
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE"
-     (org-hide-block-toggle t)
+     (org-fold-hide-block-toggle t)
      (get-char-property (line-end-position) 'invisible)))
   (should
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE"
-     (org-hide-block-toggle)
-     (org-hide-block-toggle t)
+     (org-fold-hide-block-toggle)
+     (org-fold-hide-block-toggle t)
      (get-char-property (line-end-position) 'invisible)))
   ;; Do not hide block when called from final blank lines.
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n#+END_QUOTE\n\n<point>"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (goto-char (point-min))
      (get-char-property (line-end-position) 'invisible)))
   ;; Don't leave point in an invisible part of the buffer when hiding
   ;; a block away.
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE\ncontents\n<point>#+END_QUOTE"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (get-char-property (point) 'invisible))))
 
 (ert-deftest test-org/hide-block-toggle-maybe ()
-  "Test `org-hide-block-toggle-maybe' specifications."
+  "Test `org-fold-hide-block-toggle' specifications."
   (should
    (org-test-with-temp-text "#+BEGIN: dynamic\nContents\n#+END:"
-     (org-hide-block-toggle-maybe)))
-  (should-not
-   (org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe))))
+     (org-hide-block-toggle)))
+  (should-error
+   (org-test-with-temp-text "Paragraph" (org-hide-block-toggle))))
 
 (ert-deftest test-org/show-set-visibility ()
-  "Test `org-show-set-visibility' specifications."
+  "Test `org-fold-show-set-visibility' specifications."
   ;; Do not throw an error before first heading.
   (should
    (org-test-with-temp-text "Preamble\n* Headline"
-     (org-show-set-visibility 'tree)
+     (org-fold-show-set-visibility 'tree)
      t))
   ;; Test all visibility spans, both on headline and in entry.
   (let ((list-visible-lines
@@ -8180,7 +8182,7 @@ (ert-deftest test-org/show-set-visibility ()
 "
             (org-cycle t)
             (search-forward (if headerp "Self" "Match"))
-            (org-show-set-visibility state)
+            (org-fold-show-set-visibility state)
             (goto-char (point-min))
             (let (result (line 0))
               (while (not (eobp))
@@ -8211,24 +8213,24 @@ (ert-deftest test-org/show-set-visibility ()
   ;; visible.
   (should-not
    (org-test-with-temp-text "#+BEGIN_QUOTE\nText\n#+END_QUOTE"
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (search-forward "Text")
-     (org-show-set-visibility 'minimal)
+     (org-fold-show-set-visibility 'minimal)
      (org-invisible-p2)))
   (should-not
    (org-test-with-temp-text ":DRAWER:\nText\n:END:"
-     (org-hide-drawer-toggle)
+     (org-fold-hide-drawer-toggle)
      (search-forward "Text")
-     (org-show-set-visibility 'minimal)
+     (org-fold-show-set-visibility 'minimal)
      (org-invisible-p2)))
   (should-not
    (org-test-with-temp-text
        "#+BEGIN_QUOTE\n<point>:DRAWER:\nText\n:END:\n#+END_QUOTE"
-     (org-hide-drawer-toggle)
+     (org-fold-hide-drawer-toggle)
      (forward-line -1)
-     (org-hide-block-toggle)
+     (org-fold-hide-block-toggle)
      (search-forward "Text")
-     (org-show-set-visibility 'minimal)
+     (org-fold-show-set-visibility 'minimal)
      (org-invisible-p2))))
 
 (ert-deftest test-org/copy-visible ()
-- 
2.35.1



-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong 
University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]