[Vimpulse] "Not enough arguments to format string"
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.
On Fri, Aug 20, 2010 at 8:46 AM, Stephen Bach <[email protected]> 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)) Would you like to submit a patch? Or can you just point out where it's broken? Tim
Tim Harper <[email protected]> writes:
On Fri, Aug 20, 2010 at 8:46 AM, Stephen Bach <[email protected]> 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
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).
I believe you mean should always use (message "%s" SOMETHING) if SOMETHING is a plain string (i.e. one without formatting instructions).
Should be fixed by commit db9368fc.
You're a star.
Štěpán
Tim Harper <[email protected]> writes:
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).
I believe you mean should always use (message "%s" SOMETHING) if SOMETHING is a plain string (i.e. one without formatting instructions).
No, I mean what I wrote. :-) Maybe my explanation sucks. I'll try differently: If you *know* SOMETHING is a string without formatting instructions (i.e., not containing %-sequences), (message SOMETHING) will do. In yet another words, there is no point in doing (message "%s" "just an innocuous string") Štěpán
participants (3)
-
Stephen Bach -
Tim Harper -
Štěpán Němec