[Vimpulse] "Not enough arguments to format string"

Štěpán Němec stepnem at gmail.com
Fri Aug 20 21:08:30 CEST 2010


Tim Harper <timcharper at gmail.com> writes:

> On Fri, Aug 20, 2010 at 8:46 AM, Stephen Bach <sjbach at sjbach.com> wrote:
>> Hi,
>>
>> There's some code in vimpulse-range and a couple other functions to save
>> and restore the message stored in the echo area.  It's got a small bug
>> because of this behaviour of (current-message):
>>
>> (message "%%s message)
>> --> displays "%s message string"
>>
>> (progn
>>  (message "%%s message string")
>>  (current-message))
>> --> returns "%s message string"
>>
>> (progn
>>  (message "%%s message string")
>>  (message (current-message)))
>> --> (error "Not enough arguments for format string")
>>
>> Seems like the string returned by current-message should be escaped
>> for % before redisplay.
>>
>
> Stephen, I believe you're absolutely right.  That's a common mistake
> made in e-lisp to assume it takes a string to display.  The easiest
> work around would be to simply change it to this:
>
> (message "%s" (current-message))

Indeed, thank you both for catching that. As the docstring of `message'
mentions, one should always use (message "%s" SOMETHING) unless
SOMETHING is a plain string (i.e. one without formatting instructions).

Should be fixed by commit db9368fc.

Štěpán



More information about the implementations-list mailing list