Function: org-archive-all-old

org-archive-all-old is a byte-compiled function defined in org-archive.el.gz.

Signature

(org-archive-all-old &optional TAG)

Documentation

Archive sublevels of the current tree with timestamps prior to today.

If the cursor is not on a headline, try all level 1 trees. If it is on a headline, try all direct children. When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-archive.el.gz
(defun org-archive-all-old (&optional tag)
  "Archive sublevels of the current tree with timestamps prior to today.
If the cursor is not on a headline, try all level 1 trees.  If
it is on a headline, try all direct children.
When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
  (org-archive-all-matches
   (lambda (_beg end)
     (let (ts)
       (and (re-search-forward org-ts-regexp end t)
	    (setq ts (match-string 0))
	    (< (org-timestamp-to-now ts) 0)
	    (if (not (looking-at
		    (concat "--\\(" org-ts-regexp "\\)")))
		(concat "old timestamp " ts)
	      (setq ts (concat "old timestamp " ts (match-string 0)))
	      (and (< (org-timestamp-to-now (match-string 1)) 0)
		   ts)))))
   tag))