unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Vasilij Schneidermann <mail@vasilij.de>
To: emacs-devel@gnu.org
Subject: Dealing with obsoletion warnings in non-core code
Date: Mon, 28 Sep 2020 16:35:40 +0200	[thread overview]
Message-ID: <20200928143540.GB1002@odonien.localdomain> (raw)

[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2020-09-28 14:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 14:35 Vasilij Schneidermann [this message]
2020-09-28 17:32 ` Dealing with obsoletion warnings in non-core code Stefan Monnier
2020-09-28 18:16   ` Eli Zaretskii
2020-09-28 18:34     ` Vasilij Schneidermann
2020-09-28 19:00       ` Eli Zaretskii
2020-09-28 19:24     ` Stefan Monnier
2020-09-29 14:07       ` Eli Zaretskii
2020-09-29  8:21 ` Gregory Heytings via Emacs development discussions.
2020-09-29  8:28   ` Gregory Heytings via Emacs development discussions.
2020-09-29  9:33     ` Gregory Heytings via Emacs development discussions.
2020-09-29 13:11   ` Stefan Monnier
2020-09-29 14:11     ` Gregory Heytings via Emacs development discussions.
2020-09-29 14:46       ` Stefan Monnier
2020-09-29 15:36         ` Gregory Heytings via Emacs development discussions.
2020-09-29 14:55     ` T.V Raman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200928143540.GB1002@odonien.localdomain \
    --to=mail@vasilij.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).