[EMAIL PROTECTED] (Daniel Jensen) writes:
> Daniel Brockman <[EMAIL PROTECTED]> writes:
>
>> You should almost never use `interactive-p' for anything
>> other than deciding whether to display a message. In this
>> case, it is better to use `called-interactively-p'.
>
> The difference is that `interactive-p' also tests for
> `executing-kbd-macro' and `noninteractive'.
Exactly. There is no reason why the type of error that the
function throws given a particular argument should depend on
whether or not it was called from a keyboard macro.
The docstring for `interactive-p' says,
The only known proper use of `interactive-p' is in deciding
whether to display a helpful message, or how to display it.
If you're thinking of using it for any other purpose, it is
quite likely that you're making a mistake.
So whenever you see `interactive-p' used in any other way,
it looks like a bug. Even if it may not actually be a
problem in this case, you would have to stop to think about
why it is not really a problem every time you saw the code.
> And `called-interactively-p' is not in Emacs 21.
We are not trying to be compatible with Emacs 21 at this point.
I don't know how difficult that would be, as I'm not very
familiar with the differences. Do you think we should try?
If so, we need to stop using `called-interactively-p' in a
few other places as well.
> I think I need an explanation on precisely how it is better,
> in this case, to use `called-interactively-p'.
First, create some media files called `~/foo*' and
do `C-x ( i f ~/foo* RET C-x )' --- no problem there.
Now remove the `~/foo*' files and do `i f ~/foo* RET'.
That tells you there are no matching files.
But now do `C-x e'. Instead of telling you there are no
matching files, that gives you a wrong-type-argument error.
That's not a serious problem, but nonetheless a bug.
What we could do, however, is just replace this code
(cond ((and (called-interactively-p) (null file-name))
(error "No matching files found"))
by the following,
(cond ((null file-name)
(error "No matching files found"))
because nil is an invalid argument when the function is
called noninteractively so it doesn't really matter what we
do in that case.
Agreed?
--
Daniel Brockman <[EMAIL PROTECTED]>
_______________________________________________
bongo-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/bongo-devel