Subject: bug#26802: Single source file emacs packages get a ".el.el" extension

From: Arun Isaac <[email-masked]>
Date: Sat, 13 May 2017 22:06:05 +0530

I've pushed the other uncontroversial patches.

> It would be a linter only for *.el files, is that what you mean?  AFAIK
> we do not have such specific linters, but yeah, why not, I think it's a
> good idea.

No, it will be a linter for all packages, not just emacs packages.

The following is the current linter for checking source file names. I
have a couple of issues with it, in addition to the new linter feature I
am suggesting. Let me explain.

> (define (check-source-file-name package)
>   "Emit a warning if PACKAGE's origin has no meaningful file name."
>   (define (origin-file-name-valid? origin)
>     ;; Return #t if the source file name contains only a version or is #f;
>     ;; indicates that the origin needs a 'file-name' field.

Isn't this logic somehow backward? Should'nt a predicate called
`file-name-valid?' return #t if the file name is valid, and #f
otherwise?  This seems to be doing the opposite of that, returning #f if
the file name is valid, and #t otherwise.

>     (let ((file-name (origin-actual-file-name origin))
>           (version (package-version package)))
>       (and file-name
>            (not (or (string-prefix? version file-name)
>                     ;; Common in many projects is for the filename to start
>                     ;; with a "v" followed by the version,
>                     ;; e.g. "v3.2.0.tar.gz".
>                     (string-prefix? (string-append "v" version) file-name))))))

I think this check can be done by matching against a single regexp like
so:

(string-match (string-append "^v?" version) file-name)

In addition to this logic, we add an extra condition that makes sure the
version is some substring of the source file name, like so:

(string-match version file-name)

With this new check, single source file packages like
emacs-transpose-frame, etc. which did not have file-name fields would
have raised a lint warning.

>   (let ((origin (package-source package)))
>     (unless (or (not origin) (origin-file-name-valid? origin))
>       (emit-warning package
>                     (G_ "the source file name should contain the package name")
>                     'source))))

> P.S.  Could you please keep my email in Cc?  It would be easier to
> follow the discussion for me, thanks.

Sorry, I thought debbugs does some magic to send out mails to everybody
involved in a specific bug. Didn't realize it was only using Cc. Will
keep you in Cc for this and future mails.