emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Robert Klein <roklein@roklein.de>
Cc: emacs-orgmode@gnu.org, Nicolas Goaziou <mail@nicolasgoaziou.fr>
Subject: Re: BUG: org-table: table option “:missing” not working (in ob-gnuplot.el)
Date: Thu, 30 Sep 2021 21:03:17 +0800	[thread overview]
Message-ID: <87lf3erzai.fsf@localhost> (raw)
In-Reply-To: <20210617211347.59e4de56@happy.intern.roklein.de>

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

Robert Klein <roklein@roklein.de> writes:

> When trying to run a table with missing values with ob-gnuplot.el
> there's a “:missing value” option.  ob-gnuplot is supposed to put the
> “value” into the place of empty cell values before calling on gnuplot.
> It doesn't do this currently.

Confirmed

The problem is partially because of the way `org-table--to-generic-cell'
works. It disallows custom processing of empty table cells unless both
:raw and :backend arguments are supplied to `orgtbl-to-generic'.

The attached patch should fix the issue, though it may be more
reasonable to fix orgtbl-to-generic logic.

Nicolas,

Is there a rationale behind bypassing :fmt and :hfmt for empty table
cells in `org-table--to-generic-cell'? In this patch, I have to work
around this using :raw parameter in `orgtbl-to-generic' call. I do not
feel like such workaround should be needed.

Best,
Ihor


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-gnuplot-Honour-missing-argument.patch --]
[-- Type: text/x-diff, Size: 1268 bytes --]

From 7033289d7e717eb841d550fbdbc0cc878b96cd32 Mon Sep 17 00:00:00 2001
Message-Id: <7033289d7e717eb841d550fbdbc0cc878b96cd32.1633005978.git.yantar92@gmail.com>
From: Ihor Radchenko <yantar92@gmail.com>
Date: Thu, 30 Sep 2021 20:40:37 +0800
Subject: [PATCH] ob-gnuplot: Honour :missing argument

* lisp/ob-gnuplot.el (org-babel-gnuplot-table-to-data): Force applying
`org-babel-gnuplot-quote-tsv-field' to empty table cells when
converting org tables to gnuplot input.  By default,
`orgtbl-to-generic' ignores :fmt for empty table cells.  We need to
set :raw to non-nil AND :backend to non-nil to force custom formatting
of empty table cells.

Fixes https://orgmode.org/list/20210617211347.59e4de56@happy.intern.roklein.de
---
 lisp/ob-gnuplot.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-gnuplot.el b/lisp/ob-gnuplot.el
index 6489c23f5..120aaa18e 100644
--- a/lisp/ob-gnuplot.el
+++ b/lisp/ob-gnuplot.el
@@ -272,7 +272,7 @@ (defun org-babel-gnuplot-table-to-data (table data-file params)
 	      (orgtbl-to-generic
 	       table
 	       (org-combine-plists
-		'(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field)
+		'(:sep "\t" :fmt org-babel-gnuplot-quote-tsv-field :raw t :backend ascii)
 		params)))))
   data-file)
 
-- 
2.32.0


  reply	other threads:[~2021-09-30 13:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 19:13 BUG: org-table: table option “:missing” not working (in ob-gnuplot.el) Robert Klein
2021-09-30 13:03 ` Ihor Radchenko [this message]
2021-09-30 23:48   ` Nicolas Goaziou
2021-10-01  3:56     ` Ihor Radchenko
2021-10-01  7:47       ` Nicolas Goaziou
2021-10-01  9:15         ` Ihor Radchenko
2021-10-01  3:50   ` Ihor Radchenko

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=87lf3erzai.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=roklein@roklein.de \
    /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).