emacs-devel
[Top][All Lists]
Advanced

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

Re: Dealing with obsoletion warnings in non-core code


From: Stefan Monnier
Subject: Re: Dealing with obsoletion warnings in non-core code
Date: Tue, 29 Sep 2020 09:11:51 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> Here's a proposed solution:
>
> (defmacro call (fun &rest args) `(funcall (intern (symbol-name ,fun)) ,@args))
>
> (defun select-text (text)
>   (if (> emacs-major-version 25)
>       (call 'gui-select-text text)
>     (call 'x-select-text text)))

That's just obfuscating the code (which will prevent the compiler from
detecting some real errors such as when you have a typo in the
function's name or when you don't provide the right number of args), and
might be defeated by compiler optimizations.

I think the OP's question was how to "do it right", rather than how to
work around the problem.


        Stefan




reply via email to

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