GNU bug report logs - #31314
26.1; using % escapes in prompt for interactive

Previous Next

Package: emacs;

Reported by: "Roland Winkler" <winkler <at> gnu.org>

Date: Sun, 29 Apr 2018 23:36:02 UTC

Severity: minor

Tags: fixed

Found in version 26.1

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31314 in the body.
You can then email your comments to 31314 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#31314; Package emacs. (Sun, 29 Apr 2018 23:36:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Roland Winkler" <winkler <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 Apr 2018 23:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Roland Winkler" <winkler <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.1; using % escapes in prompt for interactive
Date: Sun, 29 Apr 2018 18:34:54 -0500
Running the following command interactively in emacs -Q

   (defun foo-num (n1 n2)
     "Display numbers N1 and N2."
     (interactive "nNumber 1: \nnNumber 1: %e, Number 2: ")
     (message "Number 1: %9.2e, Number 2: %e" n1 n2))

yields the error message

  Format specifier doesn?FFE2?FF80?FF99t match argument type

The problem is the `%e' apearing in the prompt for `interactive'.
If this is replaced by a generic `%s' everything works fine.

The docstring of `interactive' says that the % escapes can be used
as in calls of `format', which sugests to me that these escapes
should match the data types of the arguments that have already been
read.  Yet it seems that in this context the previously read
arguments are interpreted as strings.  So either the docstring of
`interactive' should say that one may use %s escapes for all types
of arguments or something else should be fixed to make this work
with any type of arguments.  In principle, one could match in the
docstring for `interactive' the code letters used by `interactive'
with "legal" % escapes that may refer to the respective argument
letters later on.  For example, a number read using the code letter
n could be printed using the %d, %e and / or %f escapes.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
 of 2018-04-11 built on regnitz
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.4 LTS




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#31314; Package emacs. (Sat, 13 Jul 2019 15:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 31314 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: "Roland Winkler" <winkler <at> gnu.org>
Cc: 31314 <at> debbugs.gnu.org
Subject: Re: bug#31314: 26.1; using % escapes in prompt for interactive
Date: Sat, 13 Jul 2019 17:19:40 +0200
"Roland Winkler" <winkler <at> gnu.org> writes:

> Running the following command interactively in emacs -Q
>
>    (defun foo-num (n1 n2)
>      "Display numbers N1 and N2."
>      (interactive "nNumber 1: \nnNumber 1: %e, Number 2: ")
>      (message "Number 1: %9.2e, Number 2: %e" n1 n2))
>
> yields the error message
>
>   Format specifier doesn?FFE2?FF80?FF99t match argument type
>
> The problem is the `%e' apearing in the prompt for `interactive'.
> If this is replaced by a generic `%s' everything works fine.
>
> The docstring of `interactive' says that the % escapes can be used
> as in calls of `format', which sugests to me that these escapes
> should match the data types of the arguments that have already been
> read.  Yet it seems that in this context the previously read
> arguments are interpreted as strings.  So either the docstring of
> `interactive' should say that one may use %s escapes for all types
> of arguments or something else should be fixed to make this work
> with any type of arguments.

I changed the doc string to say "%s", since that's apparently the only
thing allowed currently.  Extending `interactive' to allow
other types may be nice, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 15:20:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 27.1, send any further explanations to 31314 <at> debbugs.gnu.org and "Roland Winkler" <winkler <at> gnu.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 13 Jul 2019 15:20:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Aug 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.