emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mark Edgington <edgimar@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Arbitrary lisp functions in column-attributes
Date: Wed, 6 Nov 2013 00:02:01 -0500	[thread overview]
Message-ID: <CAMsBe8qDKDqm+U7eb4zLewrSgSjqBPOYZgnQ=WDAjfLUVf2Uig@mail.gmail.com> (raw)
In-Reply-To: <87vc06a78z.fsf@bzg.ath.cx>

Hi Bastien,

On Tue, Nov 5, 2013 at 4:06 PM, Bastien <bzg@gnu.org> 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	other threads:[~2013-11-06  5:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 17:00 Arbitrary lisp functions in column-attributes Mark Edgington
2013-11-04 12:08 ` Bastien
2013-11-04 17:56   ` Mark Edgington
2013-11-05 21:06     ` Bastien
2013-11-06  5:02       ` Mark Edgington [this message]
2013-11-06  8:20         ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2013-10-31 16:41 Mark Edgington
2013-10-31 17:56 ` Aaron Ecay
2013-11-01 19:47   ` Mark Edgington
2013-11-03 22:38     ` Aaron Ecay
2013-11-04  3:09       ` Mark Edgington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMsBe8qDKDqm+U7eb4zLewrSgSjqBPOYZgnQ=WDAjfLUVf2Uig@mail.gmail.com' \
    --to=edgimar@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).