From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Edgington Subject: Re: Arbitrary lisp functions in column-attributes Date: Wed, 6 Nov 2013 00:02:01 -0500 Message-ID: References: <87ppqgxtc2.fsf@bzg.ath.cx> <87vc06a78z.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdvGE-0002lR-Ba for emacs-orgmode@gnu.org; Wed, 06 Nov 2013 00:02:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdvGD-0007cK-Ak for emacs-orgmode@gnu.org; Wed, 06 Nov 2013 00:02:34 -0500 Received: from mail-ob0-x22c.google.com ([2607:f8b0:4003:c01::22c]:62519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdvGD-0007c9-6W for emacs-orgmode@gnu.org; Wed, 06 Nov 2013 00:02:33 -0500 Received: by mail-ob0-f172.google.com with SMTP id gq1so9594745obb.17 for ; Tue, 05 Nov 2013 21:02:32 -0800 (PST) In-Reply-To: <87vc06a78z.fsf@bzg.ath.cx> 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 Hi Bastien, On Tue, Nov 5, 2013 at 4:06 PM, Bastien wrote: > One possible negative effect I can see is that users have to be extra > careful what type of output such functions will produce, so that this > output can be used by a summary type. Wouldn't the output of a function be something mutually exclusive with summary types? In other words, a column can be defined to use a summary type, or it could be defined (with the proposed idea) as the output of a function, but not both at the same time. > ... we should try every other ways (like Babel, org-collector, etc.) > before going down this road -- and someone will have to implement this > anyway... but that's just not me :) (I don't want to close a door.) After playing around some more with org-collector, I found that it can in fact do some of the things I had previously thought it couldn't do, like specifying custom values for column headers. The documentation on worg for org-collector seems a bit lacking, in that it doesn't cover all of the available properties you can use on a "#+BEGIN: propview ..." line. I had to read through the code to identify some additional properties I could use. Nonetheless, it seems that org-collector doesn't make the level of a headline available as a property, so there isn't a good way to achieve an equivalent to column-view's :maxlevel property in org-collector. If this were made possible in org-collector, it would be able to do (at least) most of what column-view can do. But, there are also the :hlines, :vlines, and :skip-empty-rows properties for column-view, each which don't appear to have an equivalent with org-collector. One other difference has to do with the "default value" when a property isn't defined -- org-collector sets the default value to 0, while for column-view it seems to be an empty string. I therefore modified org-collector to make it easier to set this default value when defining a dynamic block: --- org-collector.el +++ org-coll-new.el @@ -121,6 +121,7 @@ (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 @@ (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 + (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)) + (if colnames colnames cols)) stringformat))) (widen)) (setq pos (point)) (when content-lines Regards, Mark