unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Kangas <stefan@marxist.se>
To: 44849@debbugs.gnu.org
Subject: bug#44849: [PATCH] Make XEmacs compat variable warning-level-aliases obsolete
Date: Tue, 24 Nov 2020 10:09:23 -0800	[thread overview]
Message-ID: <CADwFkm=AR5OCRcKZjfTBXwXoMt+Asf4==NqZbz==D0xdve7-mw@mail.gmail.com> (raw)

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

Severity: wishlist

The `warning-level-aliases' exists only to provide compatibility with
XEmacs warning levels.  I don't think this is very useful these days.

I propose to make it obsolete and warn when one of these levels are
used.  Please see the attached patch.

[-- Attachment #2: 0001-Make-XEmacs-compat-variable-warning-level-aliases-ob.patch --]
[-- Type: text/x-diff, Size: 2335 bytes --]

From 64973830bb453ed45c96cdce0c2a0fd6a584e787 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefan@marxist.se>
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")
 \f
 (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


             reply	other threads:[~2020-11-24 18:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 18:09 Stefan Kangas [this message]
2020-11-24 19:52 ` bug#44849: [PATCH] Make XEmacs compat variable warning-level-aliases obsolete Basil L. Contovounesios
2020-11-24 20:15   ` Stefan Kangas
2020-11-24 21:00     ` Basil L. Contovounesios
2020-11-24 21:40       ` Stefan Kangas
2020-11-25  7:19 ` Lars Ingebrigtsen
2020-12-10 17:24   ` Stefan Kangas
2020-12-14 13:20     ` Stefan Kangas

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='CADwFkm=AR5OCRcKZjfTBXwXoMt+Asf4==NqZbz==D0xdve7-mw@mail.gmail.com' \
    --to=stefan@marxist.se \
    --cc=44849@debbugs.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).