emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Willem Rein Oudshoorn <woudshoo@xs4all.nl>
To: emacs-orgmode@gnu.org
Subject: Re: Table formula and text properties
Date: Thu, 08 Jan 2015 19:52:09 +0100	[thread overview]
Message-ID: <m1lhldw1eu.fsf@Wims-MBP.fritz.box> (raw)
In-Reply-To: CALn3zoicim1Sj6mCdG96c+y-arxyH8NdnR_Zukh4a8ODQxCprg@mail.gmail.com

Michael Brand <michael.ch.brand@gmail.com> writes:

> Hi Wim
>
> On Wed, Jan 7, 2015 at 6:11 PM, Willem Rein Oudshoorn
> <woudshoo@xs4all.nl> 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	other threads:[~2015-01-08 18:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07 17:11 Table formula and text properties Willem Rein Oudshoorn
2015-01-08 17:26 ` Michael Brand
2015-01-08 18:52   ` Willem Rein Oudshoorn [this message]

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=m1lhldw1eu.fsf@Wims-MBP.fritz.box \
    --to=woudshoo@xs4all.nl \
    --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).