GNU bug report logs - #36167
[PATCH] Replace manually crafted hex regexes with [[:xdigit:]]

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <hi-angel <at> yandex.ru>

Date: Tue, 11 Jun 2019 12:00:02 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattiase <at> acm.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 36167 <at> debbugs.gnu.org, Konstantin Kharlamov <hi-angel <at> yandex.ru>
Subject: bug#36167: [PATCH] Replace manually crafted hex regexes with [[:xdigit:]]
Date: Tue, 11 Jun 2019 18:31:38 +0200
[Message part 1 (text/plain, inline)]
11 juni 2019 kl. 17.37 skrev Paul Eggert <eggert <at> cs.ucla.edu>:
> 
> No, it's basically the same thing; we're looking for any place that [:xdigit:] would be useful in clarifying patterns intended to max hexadecimal digits (and perhaps some other things). Also, the skip-chars arguments are also the same thing. Let's do all these.

Since you asked, I've attached a relint run with xr modified to find parts of character alternatives and skip-sets that could be replaced with [:xdigit:], on Emacs .el files in master; it was quick work.

However, I'm not really convinced that the risks of making mistakes in the translation would outweigh the benefits. We could make an automatic verification, but [0-9A-Fa-f] still has one advantage: the reader, and the writer, know exactly which characters are included without looking it up. For example:

- whether upper case, lower case, or both are accepted
- whether non-ascii digits are accepted (included in [:digit:] on many platforms)

But it's not up to me; should your judgement tell you otherwise, go ahead! I don't mind the use of [:xdigit:] at all, it's just the wholesale replacement.

[xdigit.log (application/octet-stream, attachment)]

This bug report was last modified 5 years and 321 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.