emacs-devel
[Top][All Lists]
Advanced

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

Re: Fixing numerous `message' bugs..


From: David Kastrup
Subject: Re: Fixing numerous `message' bugs..
Date: Fri, 07 Dec 2007 18:37:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     +++ b/lisp/textmodes/artist.el
>     @@ -1151,14 +1151,14 @@ PREV-OP-ARG are used when invoked recursively 
> during the build-up."
>        (interactive)
>        (let ((next-op (cdr (cdr (assoc artist-curr-go 
> artist-prev-next-op-alist)))))
>        (artist-select-operation next-op)
>     -    (message next-op)))
>     +    (message (and next-op "%s") next-op)))
>
> I have a feeling that next-op is always supposed to be non-nil, and I
> think artist-select-operation will get en error if next-op is not nil.
> So I think the `and' is not needed.  How about asking the `artist.el'
> maintainer?

Well, I was going through this sort of defensively.  If I couldn't
figure out in 10 seconds whether the string could contain percent signs,
I went with "%s", and if I couldn't figure out in the same time frame
whether it could be nil, I added the "and".

It would probably be cleaner to omit the "and" when in doubt and let the
package maintainers clean up afterwards in the rare case where this was
mistaken.  It is also possible to write this as

(message "%s" (concat next-op))

which is more concise and avoids double evaluation of next-op.  It does
copy next-op, though.  So perhaps

(message "%s" (or next-op ""))

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

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