org-archive.el 20 KB

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