Function: org-agenda-archive-with

org-agenda-archive-with is an interactive and byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-archive-with CMD &optional CONFIRM)

Documentation

Move the entry to the archive sibling.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-archive-with (cmd &optional confirm)
  "Move the entry to the archive sibling."
  (interactive)
  (or (eq major-mode 'org-agenda-mode) (user-error "Not in agenda"))
  (org-agenda-maybe-loop
   #'org-agenda-archive-with cmd nil t
   (let* ((bufname-orig (buffer-name))
	  (marker (or (org-get-at-bol 'org-marker)
		      (org-agenda-error)))
	  (buffer (marker-buffer marker))
	  (pos (marker-position marker)))
     (org-with-remote-undo buffer
       (with-current-buffer buffer
	 (if (derived-mode-p 'org-mode)
	     (if (and confirm
		      (not (y-or-n-p "Archive this subtree or entry? ")))
		 (error "Abort")
	       (save-window-excursion
		 (goto-char pos)
		 (let ((org-agenda-buffer-name bufname-orig))
		   (org-remove-subtree-entries-from-agenda))
		 (org-back-to-heading t)
		 (let ((org-archive-from-agenda t))
		   (funcall cmd))))
	   (error "Archiving works only in Org files")))))))