[Top][All Lists]

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

Re: tramp-compat-funcall -> compat-funcall?

From: Michael Albinus
Subject: Re: tramp-compat-funcall -> compat-funcall?
Date: Sat, 24 Sep 2016 08:54:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> The use case, I think, is "to provide compatibility with older Emacsen,
>> I need a convenient way to call a function softly without compiler
>> warnings if it doesn't exist." I think, based on the two examples I gave
>> (`gnus-funcall-no-warning' was the other instance), that it's not an
>> uncommon need, and it's better to provide it in a core facility than ask
>> package maintainers to implement it.
> There's  (if (fboundp '<foo>) (<foo> <bar>))  already (which is much
> better than tramp-compat-funcall since it says explicitly what to do if
> the function doesn't exist).
> So the question is what to do for the use cases of
> tramp-compat-funcall not covered by this if/fboundp idiom.

Your code snippet misses the `with-no-warnings' umbrella.

The <bar> part is not part of the `tramp-compat-funcall' spec by
intention. It will be always compatibility code, which I don't want to
see in the mainstream code. All such compatibility code is collected in
tramp-compat.el, in the Tramp case. Furthermore, there's not only the
case that <foo> does not exist, but there might be abother argument list
now. Also handled in tramp-compat.el.

`tramp-compat-funcall' has its history, and it was more complex when it
had to support also XEmacs. It's simpler now, but I like to identify all
backward compatibility code in Tramp by searching "C-s tramp-compat".
That covers all objects declared in tramp-compat.el. This makes
maintenance much easier, for example back in January when I removed
XEmacs and Emacs 22 support.

It doesn't hurt, so I prefer to keep it in Tramp.

>         Stefan

Best regards, Michael.

reply via email to

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