From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: contovob@tcd.ie, 63260@debbugs.gnu.org, rpluim@gmail.com
Subject: bug#63260: 29.0.90; Regression installing/activating packages without autoloads
Date: Sun, 07 May 2023 19:37:26 +0000 [thread overview]
Message-ID: <87jzxkgcg9.fsf@posteo.net> (raw)
In-Reply-To: <83cz3ce0qq.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 May 2023 16:21:01 +0300")
[-- Attachment #1: Type: text/plain, Size: 2352 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: contovob@tcd.ie, 63260@debbugs.gnu.org, rpluim@gmail.com
>> Date: Sun, 07 May 2023 13:12:47 +0000
>>
>> One hack might just be to check if `loaddefs-generate' has generated
>> anything at all or not, and if that is not the case to do so manually in
>> package.el. The reason this doesn't seem nice, is that we'd have to
>> make the fact that `loaddefs-generate' does not generate a OUTPUT-FILE
>> if there is no file with autoloads explicit, and finding a justification
>> for that is difficult. Alternatively, this could be done inside of
>> `loaddefs-generate'? Something like
>
> Assuming it solves the issue and doesn't break anything, the latter
> sounds good to me, better than the alternatives.
>
>> + ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
>> + ;; passed, we still want to generate a file.
>
> The comment says "EXTRA-DATA was passed", but this added snipped will
> also run if EXTRA-DATA was NOT passed, but the OUTPUT-FILE doesn't
> exist, right?
Right, the code was not tested as I was in a hurry. I've changed it to
;; HACK: If no file with autoloads were found, but EXTRA-DATA was
;; passed, we still want to generate a file.
(when (and extra-data (not (file-exists-p output-file)))
and this file is generated when installing the SICP package:
--8<---------------cut here---------------start------------->8---
;;; sicp-autoloads.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.
;; This file is part of GNU Emacs.
;;; Code:
(add-to-list 'load-path (or (and load-file-name (file-name-directory load-file-name)) (car load-path)))
\f
;;; End of scraped data
(provide 'sicp-autoloads)
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; no-native-compile: t
;; coding: utf-8-emacs-unix
;; End:
;;; sicp-autoloads.el ends here
--8<---------------cut here---------------end--------------->8---
and this does not break anything when installing packages.
> And I would explain in the comment the real-life situations where this
> is needed, and why, rather than just explaining in English what the
> code does.
You are right. How does this patch look like:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Ensure-that-EXTRA-DATA-are-always-written-when-gener.patch --]
[-- Type: text/x-diff, Size: 1693 bytes --]
From 08c914abaa37bfb1f84ca7a357cc6e01ccfd254f Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Sun, 7 May 2023 21:37:01 +0200
Subject: [PATCH] Ensure that EXTRA-DATA are always written when generating
autoloads
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate): Handle
edge-case where no autoloads are found. (Bug#63260)
---
lisp/emacs-lisp/loaddefs-gen.el | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 2a46fb7a022..5db9af21508 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -656,7 +656,20 @@ loaddefs-generate
(write-region (point-min) (point-max) loaddefs-file nil 'silent)
(byte-compile-info
(file-relative-name loaddefs-file (car (ensure-list dir)))
- t "GEN")))))))
+ t "GEN")))))
+
+ ;; If processing files without any autoloads, the above loop will
+ ;; not generate any files. If the function was invoked with
+ ;; EXTRA-DATA, we want to ensure that even if no autoloads were
+ ;; found, that at least a file will have been generated containing
+ ;; the contents of EXTRA-DATA:
+ (when (and extra-data (not (file-exists-p output-file)))
+ (with-temp-buffer
+ (insert (loaddefs-generate--rubric output-file nil t))
+ (search-backward "\f")
+ (insert extra-data)
+ (ensure-empty-lines 1)
+ (write-region (point-min) (point-max) output-file nil 'silent)))))
(defun loaddefs-generate--print-form (def)
"Print DEF in a format that makes sense for version control."
--
2.39.2
[-- Attachment #3: Type: text/plain, Size: 11 bytes --]
> Thanks.
next prev parent reply other threads:[~2023-05-07 19:37 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-04 10:15 bug#63260: 29.0.90; Regression installing/activating packages without autoloads Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-04 15:15 ` Robert Pluim
2023-05-04 16:28 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-05 6:36 ` Robert Pluim
2023-05-06 9:01 ` Eli Zaretskii
2023-05-06 12:51 ` Robert Pluim
2023-05-06 13:12 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 13:28 ` Eli Zaretskii
2023-05-07 10:59 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 13:10 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-06 13:23 ` Eli Zaretskii
2023-05-07 9:46 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-07 10:50 ` Eli Zaretskii
2023-05-07 12:39 ` Philip Kaludercic
2023-05-07 12:54 ` Eli Zaretskii
2023-05-07 13:12 ` Philip Kaludercic
2023-05-07 13:21 ` Eli Zaretskii
2023-05-07 19:37 ` Philip Kaludercic [this message]
2023-05-08 11:16 ` Eli Zaretskii
2023-05-08 13:15 ` Robert Pluim
2023-05-08 13:18 ` Eli Zaretskii
2023-05-08 13:23 ` Robert Pluim
2023-05-10 13:12 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-05-10 14:22 ` Eli Zaretskii
2023-05-12 7:43 ` Philip Kaludercic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzxkgcg9.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=63260@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=eliz@gnu.org \
--cc=rpluim@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).