* bug#60318: 29.0.60; loaddefs: missing results with relative output file
@ 2022-12-25 20:38 Kyle Meyer
2022-12-26 12:57 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Kyle Meyer @ 2022-12-25 20:38 UTC (permalink / raw)
To: 60318
[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]
loaddefs-generate misses some autoloads in the following case:
* output-file argument is a relative path
* some (but not all) of the Lisp files contains a
generated-autoload-file pointing to the same path as output-file
Here's a concrete example.
--8<---------------cut here---------------start------------->8---
;;; foo-bar.el --- foo bar -*- lexical-binding: t; -*-
;;;###autoload
(defun foo-bar ())
(provide 'foo-bar)
;; Local variables:
;; generated-autoload-file: "foo-loaddefs.el"
;; End:
;;; foo-bar.el ends here
--8<---------------cut here---------------end--------------->8---
--8<---------------cut here---------------start------------->8---
;;; foo-baz.el --- foo baz -*- lexical-binding: t; -*-
;;;###autoload
(defun foo-baz ())
(provide 'foo-baz)
;;; foo-baz.el ends here
--8<---------------cut here---------------end--------------->8---
With these files in default-directory, calling
(loaddefs-generate default-directory "foo-loaddefs.el")
will generate output that is missing the autoload for foo-baz:
--8<---------------cut here---------------start------------->8---
;;; foo-loaddefs.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.
;; This file is part of GNU Emacs.
;;; Code:
\f
;;; Generated autoloads from foo-bar.el
(autoload 'foo-bar "foo-bar")
\f
;;; End of scraped data
(provide 'foo-loaddefs)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:
;;; foo-loaddefs.el ends here
--8<---------------cut here---------------end--------------->8---
I've attached a suggested fix.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-loaddefs-gen-Group-results-by-absolute-file-name.patch --]
[-- Type: text/x-diff, Size: 1610 bytes --]
From b3ea1cc80675a60dc4291cc14cf6a015a8570244 Mon Sep 17 00:00:00 2001
From: Kyle Meyer <kyle@kyleam.com>
Date: Sun, 25 Dec 2022 15:31:33 -0500
Subject: [PATCH] loaddefs-gen: Group results by absolute file name
loaddefs-generate produces an incomplete output file if 1) it's called
with a relative file name and 2) that same file is specified via a
generated-autoload-file cookie in a subset of the input files. In
this case, autoload entries are lost because loaddefs-generate writes
the same output file twice: once for the relative name specified by
the caller and once for the absolute name that
loaddefs-generate--parse-file returns for the generated-autoload-file
value.
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Expand file
names when grouping loaddef files.
---
lisp/emacs-lisp/loaddefs-gen.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 2dd04174f54..460d8eca586 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -608,7 +608,8 @@ loaddefs-generate
(write-region (point-min) (point-max) output-file nil 'silent))
;; We have some data, so generate the loaddef files. First
;; group per output file.
- (dolist (fdefs (seq-group-by #'car defs))
+ (dolist (fdefs (seq-group-by (lambda (x) (expand-file-name (car x)))
+ defs))
(let ((loaddefs-file (car fdefs))
hash)
(with-temp-buffer
base-commit: 1073e96170b7362ecb74fb0997e2ec4b5e34c010
--
2.38.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#60318: 29.0.60; loaddefs: missing results with relative output file
2022-12-25 20:38 bug#60318: 29.0.60; loaddefs: missing results with relative output file Kyle Meyer
@ 2022-12-26 12:57 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2022-12-26 12:57 UTC (permalink / raw)
To: Kyle Meyer; +Cc: 60318-done
> From: Kyle Meyer <kyle@kyleam.com>
> Date: Sun, 25 Dec 2022 15:38:40 -0500
>
> loaddefs-generate misses some autoloads in the following case:
>
> * output-file argument is a relative path
>
> * some (but not all) of the Lisp files contains a
> generated-autoload-file pointing to the same path as output-file
Thanks, I installed your changes on the emacs-29 branch, and I'm
therefore closing the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-26 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-25 20:38 bug#60318: 29.0.60; loaddefs: missing results with relative output file Kyle Meyer
2022-12-26 12:57 ` Eli Zaretskii
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).