[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: |
Philip Kaludercic |
Subject: |
Re: feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing |
Date: |
Wed, 19 Oct 2022 07:05:29 +0000 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> 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.
I have removed this in the last changeset that makes use of the
information in 'elpa-packages'. I agree that this is preferable.
>
> Stefan