3

I want to archive all the DONE todo states in a file, The below code extends the function specified in the link (please look at the comment in the link to see why the answer provided does not work) How to archive all the DONE tasks using a single command as below

(defun my-org-archive-subtree ()
  (if (string-match "^\*.* DONE" (buffer-substring-no-properties (point-at-bol) (point-at-eol)))
  (setq org-map-continue-from (point-at-bol))
  (setq org-map-continue-from nil))

(org-archive-subtree))

(defun my-org-archive-done-tasks ()
  (interactive)
  (org-map-entries 'my-org-archive-subtree "/DONE" (list "/home/myhome/org/office.org")))

which seems to get in to infinite loop for the below contents in the file office.org while execting the s2 heading

* s1

** DONE ss1

* s2

** NEXT ss2

** sss3

Why does it goes in to infinite loop and how to solve the problem.

Update:- This was due to the bug in the org-scan-tags function which was called by org-map-entries fn. The bug has been reported and fixed. To view the discussions on the mailing list click here

Community
  • 1
  • 1
Talespin_Kit
  • 20,830
  • 29
  • 89
  • 135
  • 1
    I looked into this a little. I used [this code](https://gist.github.com/1981472) and the problem seems to happen after the work has been done (in my example) in the 2nd call to org-archive-subtree. I couldn't debug any further than that because of some wierd edebug error. I'll try and find it for you though. – nic ferrier Mar 05 '12 at 22:03
  • @nicferrier thanks for being generous. Actually i have found the bug and reported and it's been fixed(http://lists.gnu.org/archive/html/emacs-orgmode/2011-12/msg00464.html). I forgot to update about this. – Talespin_Kit Mar 06 '12 at 09:20
  • 1
    Please, write your update as an answer and accept it. So the question is marked as answered in the overview. – Tobias Apr 09 '14 at 10:02

0 Answers0