GNU bug report logs - #64985
29.1; [PATCH] Byte-compilation of packages via package-vc doesn't correctly handle .elpaignore wildcards

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Tue, 1 Aug 2023 06:21:02 UTC

Severity: normal

Tags: patch

Found in version 29.1

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 64985 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Philip Kaludercic <philipk <at> posteo.net>
Cc: 64985 <at> debbugs.gnu.org
Subject: Re: bug#64985: 29.1; [PATCH] Byte-compilation of packages via
 package-vc doesn't correctly handle .elpaignore wildcards
Date: Tue, 1 Aug 2023 09:10:38 -0700
On 8/1/2023 5:20 AM, Philip Kaludercic wrote:
> Jim Porter <jporterbugs <at> gmail.com> writes:
> 
>> When using the various package-vc installation functions, Emacs
>> byte-compiles the source (good). However, it doesn't ignore sources
>> that match wildcards in ".elpaignore" (bad). That's because, even
>> though 'byte-compile-ignore-files' is documented to be a list of
>> regexps, 'byte-recompile-directory' treats it as a list of strings.
> 
> I am a bit confused about this point.  Why do you think that
> `byte-recompile-directory' treads `byte-compile-ignore-files' as a list
> of non-regexp strings?

The docstring for 'regexp-opt' (which is what 'byte-recompile-directory' 
uses to combine 'byte-compile-ignore-files') says this:

  Return a regexp to match a string in the list STRINGS.
  Each member of STRINGS is treated as a fixed string, not as a regexp.

> Here also, instead of merging a list of regular expressions into a
> disjunctive one, you match each individually.  Am I missing something,
> or what does this change?
> 
> (string-match-p (regexp-opt '("foo" "bar" "baz")) "foo") ;=> 0
> (seq-some (lambda (ex) (string-match-p ex "foo")) '("foo" "bar" "baz")) ;=> 0

Consider this case:

  (string-match-p (regexp-opt '("fo+" "bar")) "foo") ;=> nil
  (seq-some (lambda (ex) (string-match-p ex "foo")) '("fo+" "bar")) ;=> 0

There might be another way to do this, e.g. so that we could optimize 
the regexp, but I'm not sure if Emacs has anything to optimize a list of 
*regexp* alternatives (rather than a list of *string* alternatives). I 
tested out 'rx' too, but no luck there either. This seemed like the best 
I could do without more extensive changes, which I wanted to avoid for 
the 29 branch.




This bug report was last modified 1 year and 286 days ago.

Previous Next


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