emacs-devel
[Top][All Lists]
Advanced

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

Dealing with obsoletion warnings in non-core code


From: Vasilij Schneidermann
Subject: Dealing with obsoletion warnings in non-core code
Date: Mon, 28 Sep 2020 16:35:40 +0200

Here's something that keeps irking me when maintaining community
packages written back when Emacs 24.3 was a reasonable version to
support: With every new Emacs release I receive more and more
byte-compiler warnings that are tricky to silence.  One pattern that
keeps showing up is that of functions/variables the byte-compiler
doesn't know about (for example because these are only available in a
future Emacs release), for those it's possible to use a conditional
testing for the function/variable existence:

    (if (fboundp 'new-and-exciting-function)
        (new-and-exciting-function)
      (boring-function))

The same trick however cannot be used for functions/variables declared
obsoleted, the only construct I've found to work in this case is the
following:

    (with-suppressed-warnings ((obsolete old-but-useful-function))
      (if (fboundp 'recommended-function)
          (recommended-function)
        (old-but-useful-function)))

Ideally I'd like to be able to write the following instead to avoid the
needless repetition:

    (if (fboundp 'recommended-function)
        (recommended-function)
      (old-but-useful-function))

Is there something I'm overlooking here?  I've looked at core code and
it seems to mostly ignore this kind of compatibility issue and instead
drops all obsolete usage.  This is not always an option as community
package author.  Many authors and users just ignore warnings, especially
if they can't do anything about them.  This leads to fatigue and might
let them overlook actually important warnings.

Attachment: signature.asc
Description: PGP signature


reply via email to

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