all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Vincent Belaïche" <vincent.belaiche@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: "Vincent Belaïche" <vincentb1@users.sourceforge.net>,
	"Kevin Ryde" <user42_kevin@yahoo.com.au>,
	26169@debbugs.gnu.org
Subject: bug#26169: 25.1; ses.el string cell recalculate message
Date: Mon, 24 Aug 2020 16:20:17 +0200	[thread overview]
Message-ID: <CAPAOBV_QT7_6hNnx00eXGdkG4683cNXW8_0KQhDfiss62Gkrqw@mail.gmail.com> (raw)
In-Reply-To: <87ft8hqocs.fsf@gnus.org>

Hello Lars,

The root cause is that the default printer is "%.7g". This printer
being a string it is equivalent for (lambda (x) (format xxxx x)),
where xxxx is the concerned string, ie "%.7g".

That default printer comes from the const ses-initial-file-contents,
which hard wires the default printer to "%.7g".

So you can just change your spreadsheet not to get the error by
setting "%s" as a printer to cell A1 (just press p, then "%s", and
then RET). You can also change the default column printer with M-p, or
the default spreadsheet printer with C-c C-p.

A better fix would certainly to accept a new printer format that
instead of a string would be some sort of expression structure that
would map a format string to some predicate, where the predicates
could only be one of stringp , numberp. It could be something

'(printers (stringp . "%s") (numberp . "%.7g"))

So the code would check it for being safe (not to allow viruses on
load) this way

(mapc (lambda (x) (or (and (memq (car x) '(stringp numberp)) (stringp
(cdr x)) (errror "Unsafe printer %S" x))
   yyyy)

where yyyy would be the desired value '(printers (stringp . "%s")
(numberp . "%.7g")).

Well, probably what sort of structure we want to accommodate needs
some more thinking.

  Vincent.

PS : I cannot make the fix straight away, my personal PC ethernet card
has been broken by the latest storm overvoltage, and the other PC
having my credentials is also under repair after overheating damaged
the connectors (well, nothing surprising as this was a MACbook pro, a
notable unreliable sort of machine wrt to thermal extreme conditions).

Le jeu. 20 août 2020 à 18:22, Lars Ingebrigtsen <larsi@gnus.org> a écrit :
>
> Kevin Ryde <user42_kevin@yahoo.com.au> writes:
>
> > In debian packaged emacs 25.1.1, starting "emacs -Q /tmp/foo.ses"
> >
> >    " Ret            # create a cell with a string
> >    hello Ret        # the string content
> >    C-p              # move point to that cell
> >    c                # ses-recalculate-cell
> >    =>
> >    Format specifier doesn't match argument type: A1
> >
> > I expected recalc on a string cell to leave it unchanged.
> > The message looks like a caught error, but I don't know if it's
> > something bad or merely unsightly.  The same happens in emacs 24.
> >
> > Occasionally I've had c on a string cell clear it to nil.  I'll see if I
> > can make something reproducable for that, if it could be related.
>
> I had a peek at ses.el (a package I don't use regularly), and something
> like the following fixes the problem, but is probably totally the wrong
> solution.
>
> I've Cc'd the maintainer on this -- Vincent?
>
> diff --git a/lisp/ses.el b/lisp/ses.el
> index 96b219fc60..e396cc72ac 100644
> --- a/lisp/ses.el
> +++ b/lisp/ses.el
> @@ -1231,7 +1231,9 @@ ses-print-cell
>                      (ses--col col))
>                  (ses-call-printer (or printer
>                                        (ses-col-printer col)
> -                                      ses--default-printer)
> +                                      (if (stringp value)
> +                                          "%7s"
> +                                        ses--default-printer))
>                                    value)))
>         (if (consp ses-call-printer-return)
>             ;; Printer returned an error.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-08-24 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-19  5:02 bug#26169: 25.1; ses.el string cell recalculate message Kevin Ryde
2020-08-20 16:22 ` Lars Ingebrigtsen
2020-08-24 14:20   ` Vincent Belaïche [this message]
2020-08-24 14:50     ` Vincent Belaïche
2020-08-25 20:27       ` Lars Ingebrigtsen
2020-08-26 11:54         ` Vincent Belaïche
2020-08-27 13:33           ` Lars Ingebrigtsen

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

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

  git send-email \
    --in-reply-to=CAPAOBV_QT7_6hNnx00eXGdkG4683cNXW8_0KQhDfiss62Gkrqw@mail.gmail.com \
    --to=vincent.belaiche@gmail.com \
    --cc=26169@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    --cc=user42_kevin@yahoo.com.au \
    --cc=vincentb1@users.sourceforge.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.