From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Edgington Subject: [PATCH] org-collector: enable specifying a default table-value as a parameter Date: Tue, 12 Nov 2013 22:02:12 -0500 Message-ID: <5282EBB4.8010108@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52547) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgQik-0005DM-7Z for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 22:02:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgQib-00067f-L6 for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 22:02:22 -0500 Received: from mail-ie0-x231.google.com ([2607:f8b0:4001:c03::231]:47566) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgQib-000661-FQ for emacs-orgmode@gnu.org; Tue, 12 Nov 2013 22:02:13 -0500 Received: by mail-ie0-f177.google.com with SMTP id qd12so2976217ieb.22 for ; Tue, 12 Nov 2013 19:02:12 -0800 (PST) Received: from [192.168.2.107] (c-24-11-115-178.hsd1.mi.comcast.net. [24.11.115.178]) by mx.google.com with ESMTPSA id q6sm761575igi.0.2013.11.12.19.02.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Nov 2013 19:02:11 -0800 (PST) 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 Currently there isn't an easy way to have default cell values which differ from one propview block to another. This patch enables one to specify what a cell's default value for a block should be. For example, with this patch applied, you can do something like: #+BEGIN: propview :id " mytable" :defaultval "" :cols (PROP1 PROP2 PROP3) in order to make the default value for this block to be "" instead of 0. * contrib/lisp/org-collector.el (org-dblock-write:propview): if a 'defaultval' property has been set, then use this in place of org-propview-default-value. TINYCHANGE --- contrib/lisp/org-collector.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contrib/lisp/org-collector.el b/contrib/lisp/org-collector.el index 60b9069..d62a462 100644 --- a/contrib/lisp/org-collector.el +++ b/contrib/lisp/org-collector.el @@ -121,6 +121,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)) + (defaultval (plist-get params :defaultval)) (content-lines (org-split-string (plist-get params :content) "\n")) id table line pos) (save-excursion @@ -133,9 +134,10 @@ preceeding the dblock, then update the contents of the dblock." (t (error "Cannot find entry with :ID: %s" id)))) (unless (eq id 'global) (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)) + (let ((org-propview-default-value (if defaultval defaultval org-propview-default-value))) + (setq table (org-propview-to-table + (org-propview-collect cols stringformat conds match scope inherit + (if colnames colnames cols)) stringformat))) (widen)) (setq pos (point)) (when content-lines