From mboxrd@z Thu Jan 1 00:00:00 1970 From: bala subramaniyam Subject: Possibly Bug in function org-scan-tags Date: Thu, 15 Dec 2011 03:18:51 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001636c5b21766913e04b41744f4 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:60517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RazyJ-00065v-6U for emacs-orgmode@gnu.org; Wed, 14 Dec 2011 20:18:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RazyH-0001sa-CA for emacs-orgmode@gnu.org; Wed, 14 Dec 2011 20:18:55 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:34004) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RazyG-0001sQ-VS for emacs-orgmode@gnu.org; Wed, 14 Dec 2011 20:18:53 -0500 Received: by wgbdt11 with SMTP id dt11so2345767wgb.30 for ; Wed, 14 Dec 2011 17:18:51 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --001636c5b21766913e04b41744f4 Content-Type: text/plain; charset=ISO-8859-1 Hi, The variable "org-map-continue-from" is not reset to nil after the funcall to action in function "org-scan-tags". Heres the patch which works diff --git a/lisp/org.el b/lisp/org.el index 8a1fbd3..54ab5fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -12848,7 +12848,8 @@ only lines with a TODO keyword are included in the output." (setq org-map-continue-from nil) (save-excursion (setq rtn1 (funcall action)) - (push rtn1 rtn))) + (push rtn1 rtn)) + (setq org-map-continue-from nil)) (t (error "Invalid action"))) ;; if we are to skip sublevels, jump to end of subtree To see the error in action assume that we want to archive all the "DONE" states in the file /tmp/test.org which contains the following lines. * s1 ** DONE ss1 ** NEXT ss2 (defun my-org-archive-subtree () (setq org-map-continue-from (point-at-bol)) (org-archive-subtree)) (org-map-entries 'my-org-archive-subtree "/DONE" (list "/tmp/test.org")) While the org-scan-tags funciton parses the first subheading(**DONE ss1) the match is successful and the function "my-org-archive-subtree" is called which sets the variable "org-map-continue-from" value to *beginning of line* and this variable is not set back to nil after the function call ends, which leads to infinite loop while parsing the subsequent headlines which does not match the "DONE" state(**NEXT ss2). Regards, Balamayam --001636c5b21766913e04b41744f4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 The variable "org-map-cont= inue-from" is not reset to nil after the funcall to action in function= "org-scan-tags".

Heres the patch which works

diff = --git a/lisp/org.el b/lisp/org.el
index 8a1fbd3..54ab5fb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
= @@ -12848,7 +12848,8 @@ only lines with a TODO keyword are included in the = output."
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (setq org-map-cont= inue-from nil)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (save-excursion =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (setq rtn1 (funcall action))<= br>-=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (push rtn1 rtn)))
+=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (push rtn1 rtn))
+=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 (setq org-map-continue-from nil))
=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0 (t (error "Invalid action")))
=A0
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ;; if we are to skip sublevels, ju= mp to end of subtree

To see the error in action assume that we want = to archive all the "DONE" states in the file
/tmp/test.org which contains the following lines.
* s1
** DONE ss1
** NEXT ss2


(defun my-org-archive-subtree= ()
=A0 (setq org-map-continue-from (point-at-bol))
=A0 (org-archive-= subtree))

=A0(org-map-entries 'my-org-archive-subtree "/DON= E" (list "/tmp/test.org"))
While the org-scan-tags funciton parses the first subheading(**DONE ss1= ) the match is
successful and the function "my-org-archive-subtree&= quot; is called which sets the variable
"org-map-continue-from"= ; value to *beginning of line* and this variable is not set back to nil aft= er the function call ends, which leads to infinite loop while parsing the s= ubsequent headlines which does not match the "DONE" state(**NEXT = ss2).

Regards,
Balamayam
--001636c5b21766913e04b41744f4--