emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Hendrik Tews <hendrik@askra.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: Bug: right-alignment fails in column view [9.0.7 (release_9.0.7-439-g2906e5 @ /home/tews/src/org-mode/lisp/)]
Date: Mon, 22 May 2017 14:02:56 +0200	[thread overview]
Message-ID: <87pof1f6a7.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <87o9uljowp.fsf@cert.kernkonzept.com> (Hendrik Tews's message of "Mon, 22 May 2017 10:07:02 +0200")

Hello,

Hendrik Tews <hendrik@askra.de> writes:

> I am not sure I understand the check
>
> 	 (when (or (not (string-match-p "[0-9]" value))
> 		   (and (string-match-p "[1-9]" value)
> 			(= 0 (string-to-number value))))
>
> before the error message. Wouldn't it be good enough to apply the
> format on the result of string-to-number? This would permit to
> have markers "TODO" or "XXX" without getting an error.

The point is that format strings in summary operators are reserved for
numbers. There is no point to have a "TODO" or a "XXX" value in a column
that is summarized with {+;%.2f}.

The intent of the check is to warn the user that a columns contains
invalid values. Applying `string-to-number' unconditionally could give
strange results for example, with {mean,%.2f}.

> Moreover, the test is wrong for legitimate numbers such as "0e3"
> while it permits non-numbers such as "1XX".

I genuinely thought this would return "0". 

Anyway, the difficulty is to properly check we're applying the format
string on numbers. It may not be possible to do so in the general case,
so yes, we may fall-back to unconditional `string-to-number'.

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2017-05-22 12:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 13:28 Bug: right-alignment fails in column view [9.0.7 (release_9.0.7-439-g2906e5 @ /home/tews/src/org-mode/lisp/)] Hendrik Tews
2017-05-20 20:14 ` Nicolas Goaziou
2017-05-22  8:07   ` Hendrik Tews
2017-05-22 12:02     ` Nicolas Goaziou [this message]
2017-05-22 12:49       ` Hendrik Tews
2017-05-22 13:38         ` Nicolas Goaziou

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=87pof1f6a7.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=hendrik@askra.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).