summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2020-04-18 12:16:27 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2020-04-18 18:34:56 +0200
commit4fbc36a0576a0eab1210e66534d81a5daf5e494b (patch)
tree28ea3088e70b306e01f5c025c0fbe358dda0be47
parentcd9e000d86b874b60bb9b1f5d24440df611d8d2e (diff)
downloadorg-mode-4fbc36a0576a0eab1210e66534d81a5daf5e494b.tar.gz
Deprecate `org-hide-block-toggle-all'
* lisp/org.el (org-hide-block-toggle-all): move... * lisp/org-compat.el (org-hide-block-toggle-all): ... here.
-rw-r--r--lisp/org-compat.el16
-rw-r--r--lisp/org.el4
2 files changed, 16 insertions, 4 deletions
diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 162e66e..8112269 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -661,6 +661,22 @@ an error. Return a non-nil value when toggling is successful."
(interactive)
(ignore-errors (org-hide-block-toggle)))
+(defun org-hide-block-toggle-all ()
+ "Toggle the visibility of all blocks in the current buffer."
+ (declare (obsolete "please notify Org mailing list if you use this function."
+ "Org 9.4"))
+ (let ((start (point-min))
+ (end (point-max)))
+ (save-excursion
+ (goto-char start)
+ (while (and (< (point) end)
+ (re-search-forward "^[ \t]*#\\+begin_?\
+\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$" end t))
+ (save-excursion
+ (save-match-data
+ (goto-char (match-beginning 0))
+ (org-hide-block-toggle)))))))
+
(defmacro org-with-silent-modifications (&rest body)
(declare (obsolete "use `with-silent-modifications' instead." "Org 9.2")
(debug (body)))
diff --git a/lisp/org.el b/lisp/org.el
index 7f90257..ae9ea5b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6005,10 +6005,6 @@ Return a non-nil value when toggling is successful."
(no-error nil)
(t (user-error "Not at a block")))))
-(defun org-hide-block-toggle-all ()
- "Toggle the visibility of all blocks in the current buffer."
- (org-block-map 'org-hide-block-toggle))
-
(defun org-hide-block-all ()
"Fold all blocks in the current buffer."
(interactive)