Function: org-toggle-archive-tag
org-toggle-archive-tag is an autoloaded, interactive and byte-compiled
function defined in org-archive.el.gz.
Signature
(org-toggle-archive-tag &optional FIND-DONE)
Documentation
Toggle the archive tag for the current headline.
With prefix argument FIND-DONE, check all children of current headline and offer tagging the children that do not contain any open TODO items.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-archive.el.gz
;;;###autoload
(defun org-toggle-archive-tag (&optional find-done)
"Toggle the archive tag for the current headline.
With prefix argument FIND-DONE, check all children of current headline
and offer tagging the children that do not contain any open TODO
items."
(interactive "P")
(if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
(let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
'region-start-level 'region))
org-loop-over-headlines-in-active-region)
(org-map-entries
`(org-toggle-archive-tag ,find-done)
org-loop-over-headlines-in-active-region
cl (if (org-invisible-p) (org-end-of-subtree nil t))))
(if find-done
(org-archive-all-done 'tag)
(let (set)
(save-excursion
(org-back-to-heading t)
(setq set (org-toggle-tag org-archive-tag))
(when set (org-fold-subtree t)))
(and set (forward-line 0))
(message "Subtree %s" (if set "archived" "unarchived"))))))