From mboxrd@z Thu Jan 1 00:00:00 1970 From: Derek Feichtinger Subject: Bug: property drawer created within other drawers Date: Mon, 6 Jan 2014 14:56:12 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c2fafe5f9b7704ef4d9fec Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Af9-0001Kr-TJ for emacs-orgmode@gnu.org; Mon, 06 Jan 2014 08:56:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0Af7-0003nr-LQ for emacs-orgmode@gnu.org; Mon, 06 Jan 2014 08:56:15 -0500 Received: from mail-ig0-x232.google.com ([2607:f8b0:4001:c05::232]:41024) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0Af7-0003nc-BF for emacs-orgmode@gnu.org; Mon, 06 Jan 2014 08:56:13 -0500 Received: by mail-ig0-f178.google.com with SMTP id ut6so7254923igb.5 for ; Mon, 06 Jan 2014 05:56:12 -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 --001a11c2fafe5f9b7704ef4d9fec Content-Type: text/plain; charset=ISO-8859-1 Dear developers Property drawers for certain items end up getting created within an already existing LOGBOOK drawer. The problem is that the first while loop in org-insert-property-drawer is also matching CLOCK lines within the drawer, so it reads into the drawer instead of stopping before it. I discovered a matching report that was already submitted by Sebastien Vauban (http://article.gmane.org/gmane.emacs.orgmode/78881). Problematic code in org.el: (defun org-insert-property-drawer () ;... (let ((indent (if org-adapt-indentation (- (match-end 0) (match-beginning 0)) 0)) (beg (point)) (re (concat "^[ \t]*" org-keyword-time-regexp)) end hiddenp) (outline-next-heading) (setq end (point)) (goto-char beg) (while (re-search-forward re end t)) ; <=== problem I did a quick fix using the following construct: (let ((indent (if org-adapt-indentation (- (match-end 0) (match-beginning 0)) 0)) (beg (point)) (re (concat "^[ \t]*" org-keyword-time-regexp)) end hiddenp) (outline-next-heading) (setq end (point)) (goto-char beg) (next-line) (while (looking-at re) (next-line)) (setq hiddenp (outline-invisible-p)) ; comment-out: (end-of-line 1) ; comment-out: (and (equal (char-after) ?\n) (forward-char 1)) Here's a typical task, where the original code will fail and place the property drawer just before the end of the LOGBOOK drawer. *** DONE some task CLOSED: [2013-07-10 Wed 14:11] DEADLINE: <2013-06-03 Mon> SCHEDULED: <2013-07-08 Mon> :LOGBOOK: - State "DONE" from "WAIT" [2013-07-10 Wed 14:11] CLOCK: [2013-05-17 Fri 17:07]--[2013-05-17 Fri 17:16] => 0:09 CLOCK: [2013-05-08 Wed 14:30]--[2013-05-08 Wed 15:30] => 1:00 CLOCK: [2013-05-06 Mon 14:55]--[2013-05-06 Mon 15:30] => 0:35 - State "WAIT" from "TODO" [2013-04-03 Wed 14:31] \\ sent mail - State "TODO" from "DONE" [2013-03-20 Wed 11:25] - State "DONE" from "TODO" [2012-11-22 Thu 15:05] CLOCK: [2012-11-22 Thu 14:40]--[2012-11-22 Thu 15:04] => 0:24 - State "TODO" from "" [2012-11-20 Tue 16:14] :END: - bla - some more bla Emacs : GNU Emacs 24.3.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of 2014-01-03 on akhlut, modified by Debian Package: Org-mode version 8.2.4 (8.2.4-18-g4ee7e6-elpaplus @ /home/dfeich/.emacs.d/elpa/org-plus-contrib-20131230/) Best regards, Derek --001a11c2fafe5f9b7704ef4d9fec Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Dear developers

Property dra= wers for certain items end up getting created within an
already e= xisting LOGBOOK drawer.

The problem is that the fi= rst while loop in org-insert-property-drawer
is also matching CLOCK lines within the drawer, so it reads into the
drawer instead of stopping before it. I discovered a matching repo= rt
that was already submitted by Sebastien Vauban

Problematic code in org.el:
(defun org-insert= -property-drawer ()
;...
=A0 (let ((indent (if org-adap= t-indentation
=A0 =A0(- (match-end 0) (match-beginning 0))
=A00))
= (beg (point))
= (re (concat "^[ \t]= *" org-keyword-time-regexp))
end hiddenp)
<= div>=A0 =A0 (outline-next-heading)
=A0 =A0 (setq end (point))
=A0 =A0 (goto-char beg)
=A0 =A0 (while (re-search-forward = re end t)) =A0 ; <=3D=3D=3D problem

I did a quick fix using the following construct:
<= div>
=A0 (let ((indent (if org-adapt-indentation
=A0 =A0(- (match-end 0) = (match-beginning 0))
=A00))
= (beg (point))
= (re (concat "^[ \t]= *" org-keyword-time-regexp))
end hiddenp)
<= div>=A0 =A0 (outline-next-heading)
=A0 =A0 (setq end (point))
=A0 =A0 (goto-char beg)
=A0 =A0 (next-line)
=A0 = =A0 (while (looking-at re) (next-line))
=A0 =A0 (setq hiddenp (outline-invisible-p))
=A0 =A0 ; comme= nt-out: (end-of-line 1)
=A0 =A0 ; comment-out: (and (equal (char-= after) ?\n) (forward-char 1))

Here's a typical= task, where the original code will fail and place the
property drawer just before the end of the LOGBOOK drawer.
<= br>
*** DONE some task
=A0 =A0 CLOSED: [2013-07-10 Wed = 14:11] DEADLINE: <2013-06-03 Mon> SCHEDULED: <2013-07-08 Mon>
=A0 =A0 :LOGBOOK:
=A0 =A0 - State "DONE" =A0 =A0 = =A0 from "WAIT" =A0 =A0 =A0 [2013-07-10 Wed 14:11]
=A0 = =A0 CLOCK: [2013-05-17 Fri 17:07]--[2013-05-17 Fri 17:16] =3D> =A00:09
=A0 =A0 CLOCK: [2013-05-08 Wed 14:30]--[2013-05-08 Wed 15:30] =3D&= gt; =A01:00
=A0 =A0 CLOCK: [2013-05-06 Mon 14:55]--[2013-05-06 Mon 15:30] =3D> = =A00:35
=A0 =A0 - State "WAIT" =A0 =A0 =A0 from "T= ODO" =A0 =A0 =A0 [2013-04-03 Wed 14:31] \\
=A0 =A0 =A0 sent = mail
=A0 =A0 - State "TODO" =A0 =A0 =A0 from "DONE= " =A0 =A0 =A0 [2013-03-20 Wed 11:25]
=A0 =A0 - State "DONE" =A0 =A0 =A0 from "TODO" =A0= =A0 =A0 [2012-11-22 Thu 15:05]
=A0 =A0 CLOCK: [2012-11-22 Thu 14= :40]--[2012-11-22 Thu 15:04] =3D> =A00:24
=A0 =A0 - State &quo= t;TODO" =A0 =A0 =A0 from "" =A0 =A0 =A0 =A0 =A0 [2012-11-20 = Tue 16:14]
=A0 =A0 :END:
=A0 =A0 - bla
=A0 =A0 - some more bl= a


Emacs =A0: GNU Emacs 24.3.1 (i686= -pc-linux-gnu, GTK+ Version 3.4.2)
=A0of 2014-01-03 on akhlut, mo= dified by Debian
Package: Org-mode version 8.2.4 (8.2.4-18-g4ee7e6-elpaplus @ /home/dfe= ich/.emacs.d/elpa/org-plus-contrib-20131230/)

Best= regards,
Derek

--001a11c2fafe5f9b7704ef4d9fec--