emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Table formula and text properties


From: Willem Rein Oudshoorn
Subject: Re: [O] Table formula and text properties
Date: Thu, 08 Jan 2015 19:52:09 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin)

Michael Brand <address@hidden> writes:

> Hi Wim
>
> On Wed, Jan 7, 2015 at 6:11 PM, Willem Rein Oudshoorn
> <address@hidden> wrote:

>> ...
>> However org mode table formula code seems to strip the display property
>> from the string returned by the formula.  So this trick will not work.
>
> I think this is by design. If someone wants to change current behavior
> then there are other issues to be considered: An 80 by 8 pixel image
> that is inserted with
>
>     (insert-image
>      (sparkline-make-sparkline 80 8 '(1 20 12 13 141 13 24 90))
>      "SPARKLINE")
>
> with point in a table is first visible as an image but will change to
> the text "SPARKLINE" after e. g. table realignment. And determining
> column width around an image for table realignment would not be
> trivial.

Thank you for your thoughtful answer.

You mention two issues here

1.  After realignment the image will be replaced by text
2.  The difficulty of determining the width of an image

The first item should in theory not be a problem, text properties come
witht the string, so as long as org mode does not remove the text
properties the image should stay with the string, even after realigment.
(However this is spoken as someone with no experience with the org code,
so take this with some bucket loads of salt.)

The second problem is indeed much harder.  One way I can see this
working is if org mode would use the 'space :align-to specification to
align the table, and trust the underlying string to ensure enough space
is reserved for the image.  This would indeed be tricky.
Another potential hack is by querying the font width and use that in the
calculation of the width for the image when generating.

However, it seems not be possible at the moment, and I do not know how
much work changing org-mode is to deal with text properties.

If it is not too hard, it might be worth it anyway, formulas could attach
a face to the result and this might be useful.

> It would be nice if in your package someone could support one of
>
>     (sparkline-make-sparkline nil nil
>                               '(1 20 12 13 141 13 24 90)) => "▁▁▁▁█▁▂▅"
>     (sparkline-make-unicode 1 20 12 13 141 13 24 90) => "▁▁▁▁█▁▂▅"
>

That would not be too hard.  But I am not sure I am too interested.
At the moment I have a CSV mode that uses sparkline to generate graphs of
series with 100's of data points and I fear that the ASCII art version
will not give nearly the same information as the graphical version.

Unfortunately I do not have much time now, so looking into
this might not happen :-(.

> For completeness I would like to mention Thierry Banel's
> orgtbl-ascii-plot which has been added to Org core meanwhile:
> http://orgmode.org/worg/org-contrib/orgtbl-ascii-plot.html

A that looks nice too, thank you for mentioning this.

Kind regards,
Wim Oudshoorn.





reply via email to

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