emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Percent sign in message


From: Whitfield Diffie
Subject: Percent sign in message
Date: Sun, 10 Sep 2006 23:15:08 -0700

                                Sunday  10 September 2006  at 23:03

    I am sending this message to emacs-devel rather than bug-gnu-emacs
because, although I think this is arguable a bug, it could be fixed by
changing the documentation but the fix I propose is more substantial.

    The command
                               (message "%")

produces the error

             (error "Not enough arguments for format string")

because message hands its arguments directly to format and format makes
special use of percent signs.  A reasonably careful look at the
documentation of format finds the warning that if you want a percent
in the format string, you should double it.  That isn't so bad because
there is no reason to use format if you don't want the special way it
processes its string.

    Message is another thing.  It is perfectly reasonable to call message
to print a fixed string or, as produced the trouble, a string that is not
under the program's control.  In my case, I have a function called
`describe-last-kbd-macro' that constructs a definition and calls message to
present it and my macro operated on comments in TeX.  Clearly I could
pre-process the message to double the percent signs but it doesn't seem
that should be necessary.

    What I propose is changing format so that it specially interprets as
many percent signs as it has arguments for and just passes the rest
verbatum, with a possible warning in the *Messages* buffer.

                                        Whit





reply via email to

[Prev in Thread] Current Thread [Next in Thread]