From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Girard Subject: [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 Message-ID: <1333238367-27755-2-git-send-email-girard.nicolas@gmail.com> References: <80k421mf5q.fsf@somewhere.org> <1333238367-27755-1-git-send-email-girard.nicolas@gmail.com> Return-path: Received: from eggs.gnu.org ([208.118.235.92]:32809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE8Dz-0005BM-El for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 20:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SE8Dx-000793-Jn for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 20:00:51 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:51197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE8Dx-00078o-Ap for emacs-orgmode@gnu.org; Sat, 31 Mar 2012 20:00:49 -0400 Received: by wgbdr1 with SMTP id dr1so1198449wgb.30 for ; Sat, 31 Mar 2012 17:00:47 -0700 (PDT) In-Reply-To: <1333238367-27755-1-git-send-email-girard.nicolas@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Nicolas Girard --- 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