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))
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)))
It avoids the needless repetition, and does not give warnings on older
Emacsen that do not know about gui-select-text, or on newer Emacsen
that have x-select-text marked as obsolete.