emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Derek Feichtinger <dfeich@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: property drawer created within other drawers
Date: Mon, 6 Jan 2014 14:56:12 +0100	[thread overview]
Message-ID: <CALGTQTZieBGBDr2sSTrBp-t0xOLb=qCCxWdmJDjS=V1ADitDsw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 2440 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 3926 bytes --]

             reply	other threads:[~2014-01-06 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 13:56 Derek Feichtinger [this message]
2014-01-06 16:48 ` Bug: property drawer created within other drawers Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALGTQTZieBGBDr2sSTrBp-t0xOLb=qCCxWdmJDjS=V1ADitDsw@mail.gmail.com' \
    --to=dfeich@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).