org-fold-hide-drawer-all: Do not use point and mark when no region is active

* lisp/org-fold.el (org-fold-hide-drawer-all): Do not unconditionally
use point and mark.  Only use region boundaries when the region is
active.
This commit is contained in:
Ihor Radchenko 2024-02-18 11:48:50 +01:00
parent 388ba5b5c4
commit ea487bffb5
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 1 deletions

View File

@ -595,7 +595,8 @@ Return a non-nil value when toggling is successful."
(defun org-fold-hide-drawer-all (&optional begin end)
"Fold all drawers in the current buffer or active region BEGIN..END."
(interactive "r")
(interactive (list (and (use-region-p) (region-beginning))
(and (use-region-p) (region-end))))
(let ((begin (or begin (point-min)))
(end (or end (point-max))))
(org-fold--hide-drawers begin end)))