Re: [O] Fwd: property drawer search -- org-element-headline-parser

2013-12-26 Thread Nicolas Goaziou
Hello,

Keith David Bershatsky  writes:

> Between the version 7.9.3f and 8.2.3a, the org team changed the
> property drawer from lowercase to capital letters for the
> org-element-headline-parser

Indeed. That was changed before 8.0 release.

> -- this resulted in several hours of lost time tracking down the
> issue. The issue is now resolved -- I hope there was a good reason for
> changing it.

Yes, there was.

Consider the conflict introduced in the following case, if we cannot
distinguish a hard-coded property and a property coming from a property
drawer.

  * Headline
:PROPERTIES:
:BEGIN: something
:END:


Regards,

-- 
Nicolas Goaziou



[O] Fwd: property drawer search -- org-element-headline-parser

2013-12-24 Thread Keith David Bershatsky
Between the version 7.9.3f and 8.2.3a, the org team changed the property drawer 
from lowercase to capital letters for the org-element-headline-parser -- this 
resulted in several hours of lost time tracking down the issue.  The issue is 
now resolved -- I hope there was a good reason for changing it.

Keith

---

Begin forwarded message:

> From: Keith David Bershatsky 
> Date: December 23, 2013 6:46:57 PM PST
> To: emacs-orgmode@gnu.org
> Subject: property drawer search -- org-element-headline-parser
> 
> The property drawer search (which was working with Org version 7.9.3f) is no 
> longer working with Org version 8.2.3a.  The following 'example' function 
> works correctly when using the prior version of org-element-headline-parser.  
> Emacs Trunk (built today) comes with Org version 8.2.3a.
> 
> (require 'org)
> 
> (require 'org-element)
> 
> (defun example ()
>  "For this example to work, it will need to create a file -- 
> 'org-agenda-files'
> You may adjust the location of the file.  The file will not be deleted 
> automatically."
> (interactive)
>   (let ((sample-todo (concat
>"** Active [#A] smith @ drawer-one (fishing) | drawer-two (tennis). 
> :lawlist:\n"
>"   DEADLINE: <2013-12-21 Sat 17:00>  SCHEDULED: <2013-12-21 Sat>\n"
>"   :PROPERTIES:\n"
>"   :DRAWER-ONE:  fishing\n"
>"   :DRAWER-TWO:  tennis\n"
>"   :END:\n\n"
>"** Next-Action [#B] doe @ drawer-one (football) | drawer-two 
> (bowling). :fred:\n"
>"   DEADLINE: <2013-12-22 Sun 08:30>  SCHEDULED: <2013-12-22 Sun>\n"
>"   :PROPERTIES:\n"
>"   :DRAWER-ONE:  football\n"
>"   :DRAWER-TWO:  bowling\n"
>"   :END:\n\n"
>"** Reference [#C] john @ drawer-one (fishing) | drawer-two 
> (sky-diving). :george:\n"
>"   DEADLINE: <2013-12-23 Mon 10:15>  SCHEDULED: <2013-12-23 Mon>\n"
>"   :PROPERTIES:\n"
>"   :DRAWER-ONE:  fishing\n"
>"   :DRAWER-TWO:  sky-diving\n"
>"   :END:\n\n"
>"** Someday [#D] jane @ drawer-one (basket-ball) | drawer-two 
> (bowling). :sam:\n"
>"   DEADLINE: <2013-12-24 Tues 12:00>  SCHEDULED: <2013-12-24 Tues>\n"
>"   :PROPERTIES:\n"
>"   :DRAWER-ONE:  basket-ball\n"
>"   :DRAWER-TWO:  bowling\n"
>"   :END:")))
>  (if (get-buffer "foo.org")
>(progn
>  (switch-to-buffer "foo.org")
>  (erase-buffer)
>  (delete-other-windows))
>(switch-to-buffer (get-buffer-create "foo.org")))
>  (org-mode)
>  (insert sample-todo)
>  (goto-char (point-min))
>  (or (y-or-n-p (format "For this example work, you must save this buffer 
> as a file.  Proceed with example?"))
>  (error "Canceled."))
>  (write-file "~/Desktop/foo.org" t)
>  (let* (
>  (display-buffer-alist nil) ;; lawlist custom setting
>  (filename (buffer-file-name))
>  (org-agenda-files (list filename))
>  (org-agenda-only-exact-dates t)
>  (org-agenda-show-all-dates nil)
>  (org-deadline-warning-days 0)
>  (org-agenda-time-grid nil)
>  (org-agenda-span 'month)
>  (org-agenda-entry-types '(:deadline))
>  (month "12")
>  (year "2013")
>  (org-agenda-start-day (concat year "-" month "-" "01"))
>  (drawer-content (read-string "basket-ball | bowling | fishing | 
> football | sky-diving | tennis:  " nil))
>  (org-agenda-skip-function (lambda ()
>(org-back-to-heading t)
>(let* (
>(element (org-element-at-point))
>(drawer-one (org-element-property :drawer-one element))
>(drawer-two (org-element-property :drawer-two element)))
>  (cond
>((not (or
>  (equal drawer-one drawer-content)
>  (equal drawer-two drawer-content)))
>  (message "drawer-one:  %s" drawer-one)
>  (message "drawer-two:  %s" drawer-two)
>  (org-end-of-subtree t))
>(t nil) )) )))
>  (org-agenda-list)) ))
> 
> (defalias 'org-element-headline-parser 'lawlist-org-element-headline-parser)
> (defun lawlist-org-element-headline-parser (limit &optional raw-secondary-p)
>  "Parse an headline.
> 
> Return a list whose CAR is `headline' and CDR is a plist
> containing `:raw-value', `:title', `:begin', `:end',
> `:pre-blank', `:hiddenp', `:contents-begin' and `:contents-end',
> `:level', `:priority', `:tags', `:todo-keyword',`:todo-type',
> `:scheduled', `:deadline', `:timestamp', `:clock', `:category',
> `:quotedp', `:archivedp', `:commentedp' and `:footnote-section-p'
> keywords.
> 
> The plist also contains any property set in the property drawer,
> with its name in lowercase, the underscores replaced with hyphens
> and colons at the beginning (i.e. `:custom-id').
> 
> When RAW-SECONDARY-P is non-nil, headline's title will