emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH 2/2] Allow org-collector to display heading indentation by pa


From: Nicolas Girard
Subject: [O] [PATCH 2/2] Allow org-collector to display heading indentation by passing ':indent t' to the propview block.
Date: Sun, 1 Apr 2012 01:59:27 +0200

---
 contrib/lisp/org-collector.el |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el
index da612e9..2f5e598 100644
--- a/contrib/lisp/org-collector.el
+++ b/contrib/lisp/org-collector.el
@@ -91,6 +91,7 @@
 
 ;;; Code:
 (require 'org)
+(require 'org-clock)
 (require 'org-table)
 
 (defvar org-propview-default-value 0
@@ -98,6 +99,11 @@
 value is calculated either through lack of required variables for
 a column, or through the generation of an error.")
 
+(defvar org-propview-indent-function 'org-clocktable-indent-string
+  "A function called with the heading level. Should return a
+string which will be concatenated to the ITEM property when
+':indent t' is passed to the propview block.")
+
 (defun and-rest (list)
   (if (listp list)
       (if (> (length list) 1)
@@ -121,6 +127,7 @@ preceeding the dblock, then update the contents of the 
dblock."
            (scope (plist-get params :scope))
            (noquote (plist-get params :noquote))
            (colnames (plist-get params :colnames))
+           (indent (plist-get params :indent))
            (content-lines (org-split-string (plist-get params :content) "\n"))
            id table line pos)
        (save-excursion
@@ -134,8 +141,8 @@ preceeding the dblock, then update the contents of the 
dblock."
          (org-narrow-to-subtree)
          (setq stringformat (if noquote "%s" "%S"))
          (setq table (org-propview-to-table
-                      (org-propview-collect cols stringformat conds match 
scope inherit 
-                                            (if colnames colnames cols)) 
stringformat))
+                      (org-propview-collect cols stringformat conds match 
scope inherit
+                                            (if colnames colnames cols) 
indent) stringformat))
          (widen))
        (setq pos (point))
        (when content-lines
@@ -171,14 +178,19 @@ variables and values specified in props"
                     (when p (cons n p))))
                 inherit))))
 
-(defun org-propview-collect (cols stringformat &optional conds match scope 
inherit colnames)
+(defun org-propview-collect (cols stringformat &optional conds match scope 
inherit colnames indent)
   (interactive)
   ;; collect the properties from every header
   (let* ((header-props
          (let ((org-trust-scanner-tags t) alst)
            (org-map-entries
-            (quote (cons (cons "ITEM" (org-get-heading t))
-                         (org-propview-get-with-inherited inherit)))
+            (quote
+             (cons (cons "ITEM"
+                         (let ((item (org-get-heading t))
+                               (level (org-current-level)))
+                           (concat
+                            (funcall org-propview-indent-function level) 
item)))
+              (org-propview-get-with-inherited inherit)))
             match scope)))
         ;; read property values
         (header-props
-- 
1.7.8.rc1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]