org-archive.el 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. ;;; org-archive.el --- Archiving for Org-mode
  2. ;; Copyright (C) 2004-2014 Free Software Foundation, Inc.
  3. ;; Author: Carsten Dominik <carsten at orgmode dot org>
  4. ;; Keywords: outlines, hypermedia, calendar, wp
  5. ;; Homepage: http://orgmode.org
  6. ;;
  7. ;; This file is part of GNU Emacs.
  8. ;;
  9. ;; GNU Emacs is free software: you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation, either version 3 of the License, or
  12. ;; (at your option) any later version.
  13. ;; GNU Emacs is distributed in the hope that it will be useful,
  14. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. ;; GNU General Public License for more details.
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  19. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  20. ;;
  21. ;;; Commentary:
  22. ;; This file contains the face definitions for Org.
  23. ;;; Code:
  24. (require 'org)
  25. (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
  26. (declare-function org-datetree-find-date-create "org-datetree" (date &optional keep-restriction))
  27. (defcustom org-archive-default-command 'org-archive-subtree
  28. "The default archiving command."
  29. :group 'org-archive
  30. :type '(choice
  31. (const org-archive-subtree)
  32. (const org-archive-to-archive-sibling)
  33. (const org-archive-set-tag)))
  34. (defcustom org-archive-reversed-order nil
  35. "Non-nil means make the tree first child under the archive heading, not last."
  36. :group 'org-archive
  37. :version "24.1"
  38. :type 'boolean)
  39. (defcustom org-archive-sibling-heading "Archive"
  40. "Name of the local archive sibling that is used to archive entries locally.
  41. Locally means: in the tree, under a sibling.
  42. See `org-archive-to-archive-sibling' for more information."
  43. :group 'org-archive
  44. :type 'string)
  45. (defcustom org-archive-mark-done nil
  46. "Non-nil means mark entries as DONE when they are moved to the archive file.
  47. This can be a string to set the keyword to use. When t, Org-mode will
  48. use the first keyword in its list that means done."
  49. :group 'org-archive
  50. :type '(choice
  51. (const :tag "No" nil)
  52. (const :tag "Yes" t)
  53. (string :tag "Use this keyword")))
  54. (defcustom org-archive-stamp-time t
  55. "Non-nil means add a time stamp to entries moved to an archive file.
  56. This variable is obsolete and has no effect anymore, instead add or remove
  57. `time' from the variable `org-archive-save-context-info'."
  58. :group 'org-archive
  59. :type 'boolean)
  60. (defcustom org-archive-file-header-format "\nArchived entries from file %s\n\n"
  61. "The header format string for newly created archive files.
  62. When nil, no header will be inserted.
  63. When a string, a %s formatter will be replaced by the file name."
  64. :group 'org-archive
  65. :version "24.4"
  66. :package-version '(Org . "8.0")
  67. :type 'string)
  68. (defcustom org-archive-subtree-add-inherited-tags 'infile
  69. "Non-nil means append inherited tags when archiving a subtree."
  70. :group 'org-archive
  71. :version "24.1"
  72. :type '(choice
  73. (const :tag "Never" nil)
  74. (const :tag "When archiving a subtree to the same file" infile)
  75. (const :tag "Always" t)))
  76. (defcustom org-archive-save-context-info '(time file olpath category todo itags)
  77. "Parts of context info that should be stored as properties when archiving.
  78. When a subtree is moved to an archive file, it loses information given by
  79. context, like inherited tags, the category, and possibly also the TODO
  80. state (depending on the variable `org-archive-mark-done').
  81. This variable can be a list of any of the following symbols:
  82. time The time of archiving.
  83. file The file where the entry originates.
  84. ltags The local tags, in the headline of the subtree.
  85. itags The tags the subtree inherits from further up the hierarchy.
  86. todo The pre-archive TODO state.
  87. category The category, taken from file name or #+CATEGORY lines.
  88. olpath The outline path to the item. These are all headlines above
  89. the current item, separated by /, like a file path.
  90. For each symbol present in the list, a property will be created in
  91. the archived entry, with a prefix \"ARCHIVE_\", to remember this
  92. information."
  93. :group 'org-archive
  94. :type '(set :greedy t
  95. (const :tag "Time" time)
  96. (const :tag "File" file)
  97. (const :tag "Category" category)
  98. (const :tag "TODO state" todo)
  99. (const :tag "Priority" priority)
  100. (const :tag "Inherited tags" itags)
  101. (const :tag "Outline path" olpath)
  102. (const :tag "Local tags" ltags)))
  103. (defun org-get-local-archive-location ()
  104. "Get the archive location applicable at point."
  105. (let ((re "^#\\+ARCHIVE:[ \t]+\\(\\S-.*\\S-\\)[ \t]*$")
  106. prop)
  107. (save-excursion
  108. (save-restriction
  109. (widen)
  110. (setq prop (org-entry-get nil "ARCHIVE" 'inherit))
  111. (cond
  112. ((and prop (string-match "\\S-" prop))
  113. prop)
  114. ((or (re-search-backward re nil t)
  115. (re-search-forward re nil t))
  116. (match-string 1))
  117. (t org-archive-location))))))
  118. ;;;###autoload
  119. (defun org-add-archive-files (files)
  120. "Splice the archive files into the list of files.
  121. This implies visiting all these files and finding out what the
  122. archive file is."
  123. (org-uniquify
  124. (apply
  125. 'append
  126. (mapcar
  127. (lambda (f)
  128. (if (not (file-exists-p f))
  129. nil
  130. (with-current-buffer (org-get-agenda-file-buffer f)
  131. (cons f (org-all-archive-files)))))
  132. files))))
  133. (defun org-all-archive-files ()
  134. "Get a list of all archive files used in the current buffer."
  135. (let (file files)
  136. (save-excursion
  137. (save-restriction
  138. (goto-char (point-min))
  139. (while (re-search-forward
  140. "^\\(#\\+\\|[ \t]*:\\)ARCHIVE:[ \t]+\\(.*\\)"
  141. nil t)
  142. (setq file (org-extract-archive-file
  143. (org-match-string-no-properties 2)))
  144. (and file (> (length file) 0) (file-exists-p file)
  145. (add-to-list 'files file)))))
  146. (setq files (nreverse files))
  147. (setq file (org-extract-archive-file))
  148. (and file (> (length file) 0) (file-exists-p file)
  149. (add-to-list 'files file))
  150. files))
  151. (defun org-extract-archive-file (&optional location)
  152. "Extract and expand the file name from archive LOCATION.
  153. if LOCATION is not given, the value of `org-archive-location' is used."
  154. (setq location (or location org-archive-location))
  155. (if (string-match "\\(.*\\)::\\(.*\\)" location)
  156. (if (= (match-beginning 1) (match-end 1))
  157. (buffer-file-name (buffer-base-buffer))
  158. (expand-file-name
  159. (format (match-string 1 location)
  160. (file-name-nondirectory
  161. (buffer-file-name (buffer-base-buffer))))))))
  162. (defun org-extract-archive-heading (&optional location)
  163. "Extract the heading from archive LOCATION.
  164. if LOCATION is not given, the value of `org-archive-location' is used."
  165. (setq location (or location org-archive-location))
  166. (if (string-match "\\(.*\\)::\\(.*\\)" location)
  167. (format (match-string 2 location)
  168. (file-name-nondirectory
  169. (buffer-file-name (buffer-base-buffer))))))
  170. ;;;###autoload
  171. (defun org-archive-subtree (&optional find-done)
  172. "Move the current subtree to the archive.
  173. The archive can be a certain top-level heading in the current file, or in
  174. a different file. The tree will be moved to that location, the subtree
  175. heading be marked DONE, and the current time will be added.
  176. When called with prefix argument FIND-DONE, find whole trees without any
  177. open TODO items and archive them (after getting confirmation from the user).
  178. If the cursor is not at a headline when this command is called, try all level
  179. 1 trees. If the cursor is on a headline, only try the direct children of
  180. this heading."
  181. (interactive "P")
  182. (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
  183. (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
  184. 'region-start-level 'region))
  185. org-loop-over-headlines-in-active-region)
  186. (org-map-entries
  187. `(progn (setq org-map-continue-from (progn (org-back-to-heading) (point)))
  188. (org-archive-subtree ,find-done))
  189. org-loop-over-headlines-in-active-region
  190. cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
  191. (if find-done
  192. (org-archive-all-done)
  193. ;; Save all relevant TODO keyword-relatex variables
  194. (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
  195. (tr-org-todo-keywords-1 org-todo-keywords-1)
  196. (tr-org-todo-kwd-alist org-todo-kwd-alist)
  197. (tr-org-done-keywords org-done-keywords)
  198. (tr-org-todo-regexp org-todo-regexp)
  199. (tr-org-todo-line-regexp org-todo-line-regexp)
  200. (tr-org-odd-levels-only org-odd-levels-only)
  201. (this-buffer (current-buffer))
  202. ;; start of variables that will be used for saving context
  203. ;; The compiler complains about them - keep them anyway!
  204. (file (abbreviate-file-name
  205. (or (buffer-file-name (buffer-base-buffer))
  206. (error "No file associated to buffer"))))
  207. (olpath (mapconcat 'identity (org-get-outline-path) "/"))
  208. (time (format-time-string
  209. (substring (cdr org-time-stamp-formats) 1 -1)
  210. (current-time)))
  211. category todo priority ltags itags atags
  212. ;; end of variables that will be used for saving context
  213. location afile heading buffer level newfile-p infile-p visiting
  214. datetree-date datetree-subheading-p)
  215. ;; Find the local archive location
  216. (setq location (org-get-local-archive-location)
  217. afile (org-extract-archive-file location)
  218. heading (org-extract-archive-heading location)
  219. infile-p (equal file (abbreviate-file-name (or afile ""))))
  220. (unless afile
  221. (error "Invalid `org-archive-location'"))
  222. (if (> (length afile) 0)
  223. (setq newfile-p (not (file-exists-p afile))
  224. visiting (find-buffer-visiting afile)
  225. buffer (or visiting (find-file-noselect afile)))
  226. (setq buffer (current-buffer)))
  227. (unless buffer
  228. (error "Cannot access file \"%s\"" afile))
  229. (when (string-match "\\`datetree/" heading)
  230. ;; Replace with ***, to represent the 3 levels of headings the
  231. ;; datetree has.
  232. (setq heading (replace-regexp-in-string "\\`datetree/" "***" heading))
  233. (setq datetree-subheading-p (> (length heading) 3))
  234. (setq datetree-date (org-date-to-gregorian
  235. (or (org-entry-get nil "CLOSED" t) time))))
  236. (if (and (> (length heading) 0)
  237. (string-match "^\\*+" heading))
  238. (setq level (match-end 0))
  239. (setq heading nil level 0))
  240. (save-excursion
  241. (org-back-to-heading t)
  242. ;; Get context information that will be lost by moving the tree
  243. (setq category (org-get-category nil 'force-refresh)
  244. todo (and (looking-at org-todo-line-regexp)
  245. (match-string 2))
  246. priority (org-get-priority
  247. (if (match-end 3) (match-string 3) ""))
  248. ltags (org-get-tags)
  249. itags (org-delete-all ltags (org-get-tags-at))
  250. atags (org-get-tags-at))
  251. (setq ltags (mapconcat 'identity ltags " ")
  252. itags (mapconcat 'identity itags " "))
  253. ;; We first only copy, in case something goes wrong
  254. ;; we need to protect `this-command', to avoid kill-region sets it,
  255. ;; which would lead to duplication of subtrees
  256. (let (this-command) (org-copy-subtree 1 nil t))
  257. (set-buffer buffer)
  258. ;; Enforce org-mode for the archive buffer
  259. (if (not (derived-mode-p 'org-mode))
  260. ;; Force the mode for future visits.
  261. (let ((org-insert-mode-line-in-empty-file t)
  262. (org-inhibit-startup t))
  263. (call-interactively 'org-mode)))
  264. (when (and newfile-p org-archive-file-header-format)
  265. (goto-char (point-max))
  266. (insert (format org-archive-file-header-format
  267. (buffer-file-name this-buffer))))
  268. (when datetree-date
  269. (require 'org-datetree)
  270. (org-datetree-find-date-create datetree-date)
  271. (org-narrow-to-subtree))
  272. ;; Force the TODO keywords of the original buffer
  273. (let ((org-todo-line-regexp tr-org-todo-line-regexp)
  274. (org-todo-keywords-1 tr-org-todo-keywords-1)
  275. (org-todo-kwd-alist tr-org-todo-kwd-alist)
  276. (org-done-keywords tr-org-done-keywords)
  277. (org-todo-regexp tr-org-todo-regexp)
  278. (org-todo-line-regexp tr-org-todo-line-regexp)
  279. (org-odd-levels-only
  280. (if (local-variable-p 'org-odd-levels-only (current-buffer))
  281. org-odd-levels-only
  282. tr-org-odd-levels-only)))
  283. (goto-char (point-min))
  284. (show-all)
  285. (if (and heading (not (and datetree-date (not datetree-subheading-p))))
  286. (progn
  287. (if (re-search-forward
  288. (concat "^" (regexp-quote heading)
  289. (org-re "[ \t]*\\(:[[:alnum:]_@#%:]+:\\)?[ \t]*\\($\\|\r\\)"))
  290. nil t)
  291. (goto-char (match-end 0))
  292. ;; Heading not found, just insert it at the end
  293. (goto-char (point-max))
  294. (or (bolp) (insert "\n"))
  295. ;; datetrees don't need too much spacing
  296. (insert (if datetree-date "" "\n") heading "\n")
  297. (end-of-line 0))
  298. ;; Make the subtree visible
  299. (show-subtree)
  300. (if org-archive-reversed-order
  301. (progn
  302. (org-back-to-heading t)
  303. (outline-next-heading))
  304. (org-end-of-subtree t))
  305. (skip-chars-backward " \t\r\n")
  306. (and (looking-at "[ \t\r\n]*")
  307. ;; datetree archives don't need so much spacing.
  308. (replace-match (if datetree-date "\n" "\n\n"))))
  309. ;; No specific heading, just go to end of file.
  310. (goto-char (point-max)) (unless datetree-date (insert "\n")))
  311. ;; Paste
  312. (org-paste-subtree (org-get-valid-level level (and heading 1)))
  313. ;; Shall we append inherited tags?
  314. (and itags
  315. (or (and (eq org-archive-subtree-add-inherited-tags 'infile)
  316. infile-p)
  317. (eq org-archive-subtree-add-inherited-tags t))
  318. (org-set-tags-to atags))
  319. ;; Mark the entry as done
  320. (when (and org-archive-mark-done
  321. (looking-at org-todo-line-regexp)
  322. (or (not (match-end 2))
  323. (not (member (match-string 2) org-done-keywords))))
  324. (let (org-log-done org-todo-log-states)
  325. (org-todo
  326. (car (or (member org-archive-mark-done org-done-keywords)
  327. org-done-keywords)))))
  328. ;; Add the context info
  329. (when org-archive-save-context-info
  330. (let ((l org-archive-save-context-info) e n v)
  331. (while (setq e (pop l))
  332. (when (and (setq v (symbol-value e))
  333. (stringp v) (string-match "\\S-" v))
  334. (setq n (concat "ARCHIVE_" (upcase (symbol-name e))))
  335. (org-entry-put (point) n v)))))
  336. (widen)
  337. ;; Save and kill the buffer, if it is not the same buffer.
  338. (when (not (eq this-buffer buffer))
  339. (save-buffer))))
  340. ;; Here we are back in the original buffer. Everything seems to have
  341. ;; worked. So now cut the tree and finish up.
  342. (let (this-command) (org-cut-subtree))
  343. (when (featurep 'org-inlinetask)
  344. (org-inlinetask-remove-END-maybe))
  345. (setq org-markers-to-move nil)
  346. (message "Subtree archived %s"
  347. (if (eq this-buffer buffer)
  348. (concat "under heading: " heading)
  349. (concat "in file: " (abbreviate-file-name afile))))))
  350. (org-reveal)
  351. (if (looking-at "^[ \t]*$")
  352. (outline-next-visible-heading 1))))
  353. ;;;###autoload
  354. (defun org-archive-to-archive-sibling ()
  355. "Archive the current heading by moving it under the archive sibling.
  356. The archive sibling is a sibling of the heading with the heading name
  357. `org-archive-sibling-heading' and an `org-archive-tag' tag. If this
  358. sibling does not exist, it will be created at the end of the subtree."
  359. (interactive)
  360. (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
  361. (let ((cl (when (eq org-loop-over-headlines-in-active-region 'start-level)
  362. 'region-start-level 'region))
  363. org-loop-over-headlines-in-active-region)
  364. (org-map-entries
  365. '(progn (setq org-map-continue-from
  366. (progn (org-back-to-heading)
  367. (if (looking-at (concat "^.*:" org-archive-tag ":.*$"))
  368. (org-end-of-subtree t)
  369. (point))))
  370. (when (org-at-heading-p)
  371. (org-archive-to-archive-sibling)))
  372. org-loop-over-headlines-in-active-region
  373. cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
  374. (save-restriction
  375. (widen)
  376. (let (b e pos leader level)
  377. (org-back-to-heading t)
  378. (looking-at org-outline-regexp)
  379. (setq leader (match-string 0)
  380. level (funcall outline-level))
  381. (setq pos (point))
  382. (condition-case nil
  383. (outline-up-heading 1 t)
  384. (error (setq e (point-max)) (goto-char (point-min))))
  385. (setq b (point))
  386. (unless e
  387. (condition-case nil
  388. (org-end-of-subtree t t)
  389. (error (goto-char (point-max))))
  390. (setq e (point)))
  391. (goto-char b)
  392. (unless (re-search-forward
  393. (concat "^" (regexp-quote leader)
  394. "[ \t]*"
  395. org-archive-sibling-heading
  396. "[ \t]*:"
  397. org-archive-tag ":") e t)
  398. (goto-char e)
  399. (or (bolp) (newline))
  400. (insert leader org-archive-sibling-heading "\n")
  401. (beginning-of-line 0)
  402. (org-toggle-tag org-archive-tag 'on))
  403. (beginning-of-line 1)
  404. (if org-archive-reversed-order
  405. (outline-next-heading)
  406. (org-end-of-subtree t t))
  407. (save-excursion
  408. (goto-char pos)
  409. (let ((this-command this-command)) (org-cut-subtree)))
  410. (org-paste-subtree (org-get-valid-level level 1))
  411. (org-set-property
  412. "ARCHIVE_TIME"
  413. (format-time-string
  414. (substring (cdr org-time-stamp-formats) 1 -1)
  415. (current-time)))
  416. (outline-up-heading 1 t)
  417. (hide-subtree)
  418. (org-cycle-show-empty-lines 'folded)
  419. (goto-char pos)))
  420. (org-reveal)
  421. (if (looking-at "^[ \t]*$")
  422. (outline-next-visible-heading 1))))
  423. (defun org-archive-all-done (&optional tag)
  424. "Archive sublevels of the current tree without open TODO items.
  425. If the cursor is not on a headline, try all level 1 trees. If
  426. it is on a headline, try all direct children.
  427. When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
  428. (let ((re org-not-done-heading-regexp) re1
  429. (rea (concat ".*:" org-archive-tag ":"))
  430. (begm (make-marker))
  431. (endm (make-marker))
  432. (question (if tag "Set ARCHIVE tag (no open TODO items)? "
  433. "Move subtree to archive (no open TODO items)? "))
  434. beg end (cntarch 0))
  435. (if (org-at-heading-p)
  436. (progn
  437. (setq re1 (concat "^" (regexp-quote
  438. (make-string
  439. (+ (- (match-end 0) (match-beginning 0) 1)
  440. (if org-odd-levels-only 2 1))
  441. ?*))
  442. " "))
  443. (move-marker begm (point))
  444. (move-marker endm (org-end-of-subtree t)))
  445. (setq re1 "^* ")
  446. (move-marker begm (point-min))
  447. (move-marker endm (point-max)))
  448. (save-excursion
  449. (goto-char begm)
  450. (while (re-search-forward re1 endm t)
  451. (setq beg (match-beginning 0)
  452. end (save-excursion (org-end-of-subtree t) (point)))
  453. (goto-char beg)
  454. (if (re-search-forward re end t)
  455. (goto-char end)
  456. (goto-char beg)
  457. (if (and (or (not tag) (not (looking-at rea)))
  458. (y-or-n-p question))
  459. (progn
  460. (if tag
  461. (org-toggle-tag org-archive-tag 'on)
  462. (org-archive-subtree))
  463. (setq cntarch (1+ cntarch)))
  464. (goto-char end)))))
  465. (message "%d trees archived" cntarch)))
  466. ;;;###autoload
  467. (defun org-toggle-archive-tag (&optional find-done)
  468. "Toggle the archive tag for the current headline.
  469. With prefix ARG, check all children of current headline and offer tagging
  470. the children that do not contain any open TODO items."
  471. (interactive "P")
  472. (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
  473. (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
  474. 'region-start-level 'region))
  475. org-loop-over-headlines-in-active-region)
  476. (org-map-entries
  477. `(org-toggle-archive-tag ,find-done)
  478. org-loop-over-headlines-in-active-region
  479. cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
  480. (if find-done
  481. (org-archive-all-done 'tag)
  482. (let (set)
  483. (save-excursion
  484. (org-back-to-heading t)
  485. (setq set (org-toggle-tag org-archive-tag))
  486. (when set (hide-subtree)))
  487. (and set (beginning-of-line 1))
  488. (message "Subtree %s" (if set "archived" "unarchived"))))))
  489. (defun org-archive-set-tag ()
  490. "Set the ARCHIVE tag."
  491. (interactive)
  492. (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
  493. (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
  494. 'region-start-level 'region))
  495. org-loop-over-headlines-in-active-region)
  496. (org-map-entries
  497. 'org-archive-set-tag
  498. org-loop-over-headlines-in-active-region
  499. cl (if (outline-invisible-p) (org-end-of-subtree nil t))))
  500. (org-toggle-tag org-archive-tag 'on)))
  501. ;;;###autoload
  502. (defun org-archive-subtree-default ()
  503. "Archive the current subtree with the default command.
  504. This command is set with the variable `org-archive-default-command'."
  505. (interactive)
  506. (call-interactively org-archive-default-command))
  507. ;;;###autoload
  508. (defun org-archive-subtree-default-with-confirmation ()
  509. "Archive the current subtree with the default command.
  510. This command is set with the variable `org-archive-default-command'."
  511. (interactive)
  512. (if (y-or-n-p "Archive this subtree or entry? ")
  513. (call-interactively org-archive-default-command)
  514. (error "Abort")))
  515. (provide 'org-archive)
  516. ;; Local variables:
  517. ;; generated-autoload-file: "org-loaddefs.el"
  518. ;; End:
  519. ;;; org-archive.el ends here