فهرست منبع

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.
Nicolas Goaziou 10 سال پیش
والد
کامیت
9309fd5d20
3فایلهای تغییر یافته به همراه20 افزوده شده و 6 حذف شده
  1. 1 1
      doc/org.texi
  2. 14 5
      lisp/org.el
  3. 5 0
      testing/lisp/test-org.el

+ 1 - 1
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?}
 CLOSED       @r{When was this entry closed?}
 DEADLINE     @r{The deadline time string, without the angular brackets.}
 DEADLINE     @r{The deadline time string, without the angular brackets.}
 FILE         @r{The filename the entry is located in.}
 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.}
 PRIORITY     @r{The priority of the entry, a string with a single letter.}
 SCHEDULED    @r{The scheduling timestamp, without the angular brackets.}
 SCHEDULED    @r{The scheduling timestamp, without the angular brackets.}
 TAGS         @r{The tags defined directly in the headline.}
 TAGS         @r{The tags defined directly in the headline.}

+ 14 - 5
lisp/org.el

@@ -15379,9 +15379,9 @@ a *different* entry, you cannot use these techniques."
 ;;; Properties API
 ;;; Properties API
 
 
 (defconst org-special-properties
 (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,
 These are properties that are not defined in the property drawer,
 but in some other way.")
 but in some other way.")
 
 
@@ -15560,6 +15560,16 @@ strings."
 			       (/ (float clocksumt) 60.) 'add_times))
 			       (/ (float clocksumt) 60.) 'add_times))
 			props)))
 			props)))
 	      (when specific (throw 'exit 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 (or (not specific) (string= specific "TODO"))
 	      (when (and (looking-at org-todo-line-regexp) (match-end 2))
 	      (when (and (looking-at org-todo-line-regexp) (match-end 2))
 		(push (cons "TODO" (org-match-string-no-properties 2)) props))
 		(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)
 	       (while (string-match "%[0-9]*\\(\\S-+\\)" value start)
 		 (setq start (match-end 0))
 		 (setq start (match-end 0))
 		 (let ((p (org-match-string-no-properties 1 value)))
 		 (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))))))))))
 		     (add-to-list 'props p))))))))))
     (sort props (lambda (a b) (string< (upcase a) (upcase b))))))
     (sort props (lambda (a b) (string< (upcase a) (upcase b))))))
 
 

+ 5 - 0
testing/lisp/test-org.el

@@ -2475,6 +2475,11 @@ Text.
 
 
 (ert-deftest test-org/entry-properties ()
 (ert-deftest test-org/entry-properties ()
   "Test `org-entry-properties' specifications."
   "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.
   ;; Get "TODO" property.
   (should
   (should
    (equal "TODO"
    (equal "TODO"