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