bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#65496: 30.0.50; Issue with the regexp used to auto-detect PBM image


From: David Ponce
Subject: bug#65496: 30.0.50; Issue with the regexp used to auto-detect PBM image data
Date: Wed, 6 Sep 2023 16:05:39 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 05/09/2023 13:08, Eli Zaretskii wrote:
[I presume you didn't intend to discuss this only with me in private.]

Hi Eli,

You are right, my mistake, I did reply instead of reply to all :-\
I am sorry.


Date: Mon, 4 Sep 2023 23:43:56 +0200
From: David Ponce <da_vid@orange.fr>

On 04/09/2023 19:36, Eli Zaretskii wrote:
Date: Mon, 4 Sep 2023 18:32:22 +0200
From: David Ponce <da_vid@orange.fr>

I wonder if it is expected that matching a regular expression
against a string object depends on the syntax-table setup in current
buffer?  Shouldn't (standard-syntax-table) implied when matching a
regexp against a string object, that is, regardless of any buffer
context?

Not necessarily, because you wouldn't expect, say, looking-at to
return a different result than (string-match-p (buffer-string)), would
you?

Sure, from this perspective you are right.  However, for other cases
where the string object is not related to a buffer value, it's not so
clear ;-)

This belongs to the gray areas of Emacs.  The same situation exists
with functions like downcase, which use the buffer-local value of
case-table.

I can understand that.  Many things are not only black or white ;-)

Maybe for the use case of auto-detecting image type from image data,
my proposed patch to replace character class by a list of unambiguous
explicit character values in the regexp could make sense?

Yes, it makes sense, but are you sure you mention there all the
characters that can happen in PBM images, and only those characters?

Yes, according to the specification of pbm available at
<https://netpbm.sourceforge.net/doc/pbm.html>:

  "Each PBM image consists of the following:

    * A "magic number" for identifying the file type.
      A pbm image's magic number is the two characters "P4".

==> * Whitespace (blanks, TABs, CRs, LFs). <==

    * The width in pixels of the image, formatted as ASCII characters in 
decimal.

    ..."

Thanks







reply via email to

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