Selaa lähdekoodia

Fix archiving for MobileOrg

Carsten Dominik 15 vuotta sitten
vanhempi
commit
0fd5ebc3bc
3 muutettua tiedostoa jossa 27 lisäystä ja 0 poistoa
  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>
 
+	* 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
 	capture file.
 	(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" ())
 
+(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"
   "Name of the local archive sibling that is used to archive entries locally.
 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))
       (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)
 
 ;; 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.
 If BEG and END are given, only do this in that region."
   (interactive)
+  (require 'org-archive)
   (setq org-mobile-last-flagged-files nil)
   (setq beg (or beg (point-min)) end (or end (point-max)))
   (goto-char beg)