From 13353f1fa34f6f085ffbf142b380af7308f02981 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 19 Oct 2023 12:32:49 +0300 Subject: [PATCH] org-fold-hide-drawer-all: Make interactive * lisp/org-fold.el (org-fold-hide-drawer-all): Convert into interactive command. Accept two optional arguments - region boundaries. * etc/ORG-NEWS (~org-fold-hide-drawer-all~ is now interactive): Document the change. Link: https://orgmode.org/list/CAFmwT7WEMvGVyQhP8NcZY5vZMzz4NcvBjchd4jBqgHCPwjOgFA@mail.gmail.com --- etc/ORG-NEWS | 5 +++++ lisp/org-fold.el | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 14f98d2b9..78b75b578 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -626,6 +626,11 @@ Maxima's graphics packages (~draw~ or ~plot~); the default remains of the file-name set in the ~:file~ header argument. ** New functions and changes in function arguments +*** ~org-fold-hide-drawer-all~ is now interactive + +~org-fold-hide-drawer-all~ is now a command, accepting two optional +arguments - region to act on. + *** =TYPES= argument in ~org-element-lineage~ can now be a symbol When =TYPES= is symbol, only check syntax nodes of that type. diff --git a/lisp/org-fold.el b/lisp/org-fold.el index 18ccbf0bb..d1a270df6 100644 --- a/lisp/org-fold.el +++ b/lisp/org-fold.el @@ -593,10 +593,11 @@ Return a non-nil value when toggling is successful." (interactive) (org-block-map (apply-partially #'org-fold-hide-block-toggle 'hide))) -(defun org-fold-hide-drawer-all () - "Fold all drawers in the current buffer." - (let ((begin (point-min)) - (end (point-max))) +(defun org-fold-hide-drawer-all (&optional begin end) + "Fold all drawers in the current buffer or active region BEGIN..END." + (interactive "r") + (let ((begin (or begin (point-min))) + (end (or end (point-max)))) (org-fold--hide-drawers begin end))) (defun org-fold--hide-drawers (begin end)