From 9309fd5d203769f5dbc0a844d352d6d714c811cc Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Mon, 10 Nov 2014 11:22:14 +0100 Subject: [PATCH] Add "ITEM" to special properties * lisp/org.el (org-special-properties): Add "ITEM". Tiny fix to docstring. (org-entry-properties): Compute "ITEM" property's value. (org-buffer-property-keys): Remove hack since "ITEM" now officially belongs to the special properties list. * doc/org.texi (Special properties): Document "ITEM" change. * testing/lisp/test-org.el (test-org/entry-properties): Add test. --- doc/org.texi | 2 +- lisp/org.el | 19 ++++++++++++++----- testing/lisp/test-org.el | 5 +++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index d657c0d14..b01db2cc8 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -5362,7 +5362,7 @@ CLOCKSUM_T @r{The sum of CLOCK intervals in the subtree for today.} CLOSED @r{When was this entry closed?} DEADLINE @r{The deadline time string, without the angular brackets.} FILE @r{The filename the entry is located in.} -ITEM @r{The headline of the entry.} +ITEM @r{The headline of the entry, with stars.} PRIORITY @r{The priority of the entry, a string with a single letter.} SCHEDULED @r{The scheduling timestamp, without the angular brackets.} TAGS @r{The tags defined directly in the headline.} diff --git a/lisp/org.el b/lisp/org.el index b6573344a..aa368af74 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -15379,9 +15379,9 @@ a *different* entry, you cannot use these techniques." ;;; Properties API (defconst org-special-properties - '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOSED" "PRIORITY" - "TIMESTAMP" "TIMESTAMP_IA" "BLOCKED" "FILE" "CLOCKSUM" "CLOCKSUM_T") - "The special properties valid in Org-mode. + '("ALLTAGS" "BLOCKED" "CLOCKSUM" "CLOCKSUM_T" "CLOSED" "DEADLINE" "FILE" + "ITEM" "PRIORITY" "SCHEDULED" "TAGS" "TIMESTAMP" "TIMESTAMP_IA" "TODO") + "The special properties valid in Org mode. These are properties that are not defined in the property drawer, but in some other way.") @@ -15560,6 +15560,16 @@ strings." (/ (float clocksumt) 60.) 'add_times)) props))) (when specific (throw 'exit props))) + (when (or (not specific) (string= specific "ITEM")) + (when (looking-at org-complex-heading-regexp) + (push (cons "ITEM" + (concat + (org-match-string-no-properties 1) + (let ((title (org-match-string-no-properties 4))) + (when (org-string-nw-p title) + (concat " " (org-remove-tabs title)))))) + props)) + (when specific (throw 'exit props))) (when (or (not specific) (string= specific "TODO")) (when (and (looking-at org-todo-line-regexp) (match-end 2)) (push (cons "TODO" (org-match-string-no-properties 2)) props)) @@ -16014,8 +16024,7 @@ COLUMN formats in the current buffer." (while (string-match "%[0-9]*\\(\\S-+\\)" value start) (setq start (match-end 0)) (let ((p (org-match-string-no-properties 1 value))) - (unless (member-ignore-case - p (cons "ITEM" org-special-properties)) + (unless (member-ignore-case p org-special-properties) (add-to-list 'props p)))))))))) (sort props (lambda (a b) (string< (upcase a) (upcase b)))))) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 9251ddb07..96e7a8551 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -2475,6 +2475,11 @@ Text. (ert-deftest test-org/entry-properties () "Test `org-entry-properties' specifications." + ;; Get "ITEM" property. + (should + (equal "* H" + (org-test-with-temp-text "* TODO H" + (cdr (assoc "ITEM" (org-entry-properties nil "ITEM")))))) ;; Get "TODO" property. (should (equal "TODO" -- 2.11.4.GIT