* Re: feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing
[not found] ` <20221018203548.C9FB4C00AB0@vcs2.savannah.gnu.org>
@ 2022-10-18 21:26 ` Stefan Monnier
2022-10-19 7:05 ` Philip Kaludercic
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2022-10-18 21:26 UTC (permalink / raw)
To: emacs-devel; +Cc: Philip Kaludercic
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing
2022-10-18 21:26 ` feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing Stefan Monnier
@ 2022-10-19 7:05 ` Philip Kaludercic
0 siblings, 0 replies; 2+ messages in thread
From: Philip Kaludercic @ 2022-10-19 7:05 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-19 7:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <166612534636.19094.9473407136412492280@vcs2.savannah.gnu.org>
[not found] ` <20221018203548.C9FB4C00AB0@vcs2.savannah.gnu.org>
2022-10-18 21:26 ` feature/package+vc b4e833b2f8 1/6: Attempt to infer the package subject if missing Stefan Monnier
2022-10-19 7:05 ` Philip Kaludercic
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).