emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Arbitrary lisp functions in column-attributes


From: Mark Edgington
Subject: Re: [O] Arbitrary lisp functions in column-attributes
Date: Wed, 6 Nov 2013 00:02:01 -0500

Hi Bastien,

On Tue, Nov 5, 2013 at 4:06 PM, Bastien <address@hidden> 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



reply via email to

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