emacs-devel
[Top][All Lists]
Advanced

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

Re: feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subj


From: Stefan Monnier
Subject: Re: feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing
Date: Tue, 18 Oct 2022 17:26:34 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Philip Kaludercic [2022-10-18 16:35:47] wrote:
> +(defun package-vc-main-file (pkg-desc)
> +  "Return the main file of the package PKG-DESC.
> +If no file can be found that appends \".el\" to the end of the
> +package name, the file with the closest file name is chosen."
> +  (let* ((default-directory (package-desc-dir pkg-desc))
> +         (best (format "%s.el" (package-desc-name pkg-desc)))
> +         (distance most-positive-fixnum) next-best)
> +    (if (file-exists-p best)
> +        (expand-file-name best)
> +      (dolist (file (directory-files default-directory nil "\\.el\\'"))
> +        (let ((distance* (string-distance best file)))
> +          (when (< distance* distance)
> +            (setq distance distance* next-best file))))
> +      next-best)))

FWIW, I think the ELPA format/protocol is sufficiently well-established
by now that trying to DWIM-guess things this way at this point is more
harmful than helpful.


        Stefan




reply via email to

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