From 64973830bb453ed45c96cdce0c2a0fd6a584e787 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 24 Nov 2020 18:54:57 +0100 Subject: [PATCH] Make XEmacs compat variable warning-level-aliases obsolete * lisp/emacs-lisp/warnings.el (warning-level-aliases): Make obsolete. (display-warning): Warn when using one of the warning levels defined in above obsolete variable. * lisp/url/url-proxy.el (url-find-proxy-for-url): Replace obsolete warning type 'critical with :error. --- lisp/emacs-lisp/warnings.el | 7 +++++-- lisp/url/url-proxy.el | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el index f525ea433a..1c1eb14a24 100644 --- a/lisp/emacs-lisp/warnings.el +++ b/lisp/emacs-lisp/warnings.el @@ -67,6 +67,7 @@ warning-level-aliases Each element looks like (ALIAS . LEVEL) and defines ALIAS as equivalent to LEVEL. LEVEL must be defined in `warning-levels'; it may not itself be an alias.") +(make-obsolete-variable 'warning-level-aliases 'warning-levels "28.1") (define-obsolete-variable-alias 'display-warning-minimum-level 'warning-minimum-level "28.1") @@ -256,8 +257,10 @@ display-warning (setq level :warning)) (unless buffer-name (setq buffer-name "*Warnings*")) - (if (assq level warning-level-aliases) - (setq level (cdr (assq level warning-level-aliases)))) + (with-suppressed-warnings ((obsolete warning-level-aliases)) + (when-let ((new (cdr-safe (assq level warning-level-aliases)))) + (warn "Warning level `%s' is obsolete; use `%s' instead" level new) + (setq level new))) (or (< (warning-numeric-level level) (warning-numeric-level warning-minimum-log-level)) (warning-suppress-p type warning-suppress-log-types) diff --git a/lisp/url/url-proxy.el b/lisp/url/url-proxy.el index 698a87098b..ad04a2d94a 100644 --- a/lisp/url/url-proxy.el +++ b/lisp/url/url-proxy.el @@ -59,7 +59,7 @@ url-find-proxy-for-url ((string-match "^socks +" proxy) (concat "socks://" (substring proxy (match-end 0)))) (t - (display-warning 'url (format "Unknown proxy directive: %s" proxy) 'critical) + (display-warning 'url (format "Unknown proxy directive: %s" proxy) :error) nil)))) (autoload 'url-http "url-http") -- 2.29.2