unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31314: 26.1; using % escapes in prompt for interactive
@ 2018-04-29 23:34 Roland Winkler
  2019-07-13 15:19 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Winkler @ 2018-04-29 23:34 UTC (permalink / raw)
  To: 31314


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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#31314: 26.1; using % escapes in prompt for interactive
  2018-04-29 23:34 bug#31314: 26.1; using % escapes in prompt for interactive Roland Winkler
@ 2019-07-13 15:19 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2019-07-13 15:19 UTC (permalink / raw)
  To: Roland Winkler; +Cc: 31314

"Roland Winkler" <winkler@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-07-13 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-29 23:34 bug#31314: 26.1; using % escapes in prompt for interactive Roland Winkler
2019-07-13 15:19 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).