Browse Source

Deprecate `org-hide-block-toggle-maybe'

* lisp/org.el (org-hide-block-all): Use `org-hide-block-toggle'.
(org-hide-block-toggle-maybe): move...
* lisp/org-compat.el (org-hide-block-toggle-maybe): ... here.
Nicolas Goaziou 11 months ago
parent
commit
cd9e000d86
2 changed files with 9 additions and 8 deletions
  1. 8 0
      lisp/org-compat.el
  2. 1 8
      lisp/org.el

+ 8 - 0
lisp/org-compat.el

@@ -653,6 +653,14 @@ region as a drawer without further ado."
 	  (when (invisible-p (max (1- (point)) (point-min)))
 	    (goto-char post)))))))
 
+(defun org-hide-block-toggle-maybe ()
+  "Toggle visibility of block at point.
+Unlike to `org-hide-block-toggle', this function does not throw
+an error.  Return a non-nil value when toggling is successful."
+  (declare (obsolete "use `org-hide-block-toggle' instead." "Org 9.4"))
+  (interactive)
+  (ignore-errors (org-hide-block-toggle)))
+
 (defmacro org-with-silent-modifications (&rest body)
   (declare (obsolete "use `with-silent-modifications' instead." "Org 9.2")
 	   (debug (body)))

+ 1 - 8
lisp/org.el

@@ -5960,13 +5960,6 @@ heading to appear."
 
 ;;;; Blocks visibility
 
-(defun org-hide-block-toggle-maybe ()
-  "Toggle visibility of block at point.
-Unlike to `org-hide-block-toggle', this function does not throw
-an error.  Return a non-nil value when toggling is successful."
-  (interactive)
-  (ignore-errors (org-hide-block-toggle)))
-
 (defun org-hide-block-toggle (&optional force no-error element)
   "Toggle the visibility of the current block.
 
@@ -6020,7 +6013,7 @@ Return a non-nil value when toggling is successful."
   "Fold all blocks in the current buffer."
   (interactive)
   (org-show-all '(blocks))
-  (org-block-map 'org-hide-block-toggle-maybe))
+  (org-block-map 'org-hide-block-toggle))
 
 ;;;; Drawers visibility