ソースを参照

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.
Nicolas Goaziou 4 年 前
コミット
4fbc36a057
2 ファイル変更16 行追加4 行削除
  1. 16 0
      lisp/org-compat.el
  2. 0 4
      lisp/org.el

+ 16 - 0
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)))

+ 0 - 4
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)