Browse Source

Fix archiving for MobileOrg

Carsten Dominik 16 years ago
parent
commit
0fd5ebc3bc
3 changed files with 27 additions and 0 deletions
  1. 5 0
      lisp/ChangeLog
  2. 21 0
      lisp/org-archive.el
  3. 1 0
      lisp/org-mobile.el

+ 5 - 0
lisp/ChangeLog

@@ -1,5 +1,10 @@
 2009-09-17  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-09-17  Carsten Dominik  <carsten.dominik@gmail.com>
 
 
+	* org-mobile.el (org-mobile-apply-flags): Require `org-archive'.
+
+	* org-archive.el (org-archive-set-tag)
+	(org-archive-subtree-default): New commands.
+
 	* org-mobile.el (org-mobile-create-index-file): Fix link to
 	* org-mobile.el (org-mobile-create-index-file): Fix link to
 	capture file.
 	capture file.
 	(org-mobile-copy-agenda-files): Create the capture file if it does
 	(org-mobile-copy-agenda-files): Create the capture file if it does

+ 21 - 0
lisp/org-archive.el

@@ -34,6 +34,15 @@
 
 
 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
 
 
+(defcustom org-archive-default-command 'org-archive-subtree
+  "The default archiving command.
+Currently this is only used by org-mobile.el."
+  :group 'org-archive
+  :type '(choice
+	  (const org-archive-subtree)
+	  (const org-archive-to-archive-sibling)
+	  (const org-archive-set-tag)))  
+
 (defcustom org-archive-sibling-heading "Archive"
 (defcustom org-archive-sibling-heading "Archive"
   "Name of the local archive sibling that is used to archive entries locally.
   "Name of the local archive sibling that is used to archive entries locally.
 Locally means: in the tree, under a sibling.
 Locally means: in the tree, under a sibling.
@@ -428,6 +437,18 @@ the children that do not contain any open TODO items."
       (and set (beginning-of-line 1))
       (and set (beginning-of-line 1))
       (message "Subtree %s" (if set "archived" "unarchived")))))
       (message "Subtree %s" (if set "archived" "unarchived")))))
 
 
+(defun org-archive-set-tag ()
+  "Set the ARCHIVE tag."
+  (interactive)
+  (org-toggle-tag org-archive-tag 'on))
+
+;;;###autoload
+(defun org-archive-subtree-default ()
+  "Archive the current subtree with the default command.
+This command is set with the variable `org-archive-default-command'."
+  (interactive)
+  (call-interactively 'org-archive-default-command))
+
 (provide 'org-archive)
 (provide 'org-archive)
 
 
 ;; arch-tag: 0837f601-9699-43c3-8b90-631572ae6c85
 ;; arch-tag: 0837f601-9699-43c3-8b90-631572ae6c85

+ 1 - 0
lisp/org-mobile.el

@@ -319,6 +319,7 @@ If nothing new has beed added, return nil."
   "Apply all flags in the current buffer.
   "Apply all flags in the current buffer.
 If BEG and END are given, only do this in that region."
 If BEG and END are given, only do this in that region."
   (interactive)
   (interactive)
+  (require 'org-archive)
   (setq org-mobile-last-flagged-files nil)
   (setq org-mobile-last-flagged-files nil)
   (setq beg (or beg (point-min)) end (or end (point-max)))
   (setq beg (or beg (point-min)) end (or end (point-max)))
   (goto-char beg)
   (goto-char beg)