unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
@ 2023-05-04 10:15 Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-05-04 15:15 ` Robert Pluim
  0 siblings, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-04 10:15 UTC (permalink / raw)
  To: 63260; +Cc: Philip Kaludercic


This change:

  Prevent generating empty autoload files
  dd21003878d 2023-04-30 18:42:58 +0200
  https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d

seems to have reintroduced the following issue:

  https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html

First start Emacs 29 (or 30) with a clean slate:

$ cd "$(mktemp --directory)"
$ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
$ emacs

Then try to install the sicp package (which lacks autoloads) from MELPA:

0. C-x b RET
1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
   C-x C-e
2. M-x package-install RET sicp RET
3. C-h e
4. C-M-S-v

Observe that *Messages* contains the line:

  Error loading autoloads:
  (file-missing
   Cannot open load file
   No such file or directory
   /tmp/tmp.5GvMpPatMo/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)

5. M-x toggle-debug-on-error RET
6. M-x package-quickstart-refresh RET

This fails with:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    insert-file-contents(nil)
    package-quickstart-refresh()
    funcall-interactively(package-quickstart-refresh)
    call-interactively(package-quickstart-refresh record nil)
    command-execute(package-quickstart-refresh record)
    execute-extended-command(nil "package-quickstart-refresh" "package-quick")
    funcall-interactively(execute-extended-command nil
                          "package-quickstart-refresh"
                          "package-quick")
    call-interactively(execute-extended-command nil nil)
    command-execute(execute-extended-command)
  
The file-missing error also appears on subsequent Emacs startup.

Thanks,

-- 
Basil

In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw3d scroll bars) of 2023-05-04 built on blc
Repository revision: dd21003878dadba1e0420269e63e10685d4670a9
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.2 LTS

Configured using:
 'configure CC=gcc-12 'CFLAGS=-Og -ggdb3' --prefix=/home/bic/.local
 --with-program-suffix=-29 --with-file-notification=yes --with-x
 --with-x-toolkit=lucid'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM
LUCID ZLIB

Important settings:
  value of $LC_MONETARY: en_IE.UTF-8
  value of $LC_NUMERIC: en_IE.UTF-8
  value of $LC_TIME: en_IE.UTF-8
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug help-fns cl-print debug backtrace
help-mode find-func compile comint ansi-osc ansi-color ring info
loaddefs-gen lisp-mnt radix-tree tar-mode arc-mode archive-mode cus-edit
pp cus-start cus-load icons wid-edit mm-archive message sendmail
yank-media dired dired-loaddefs rfc822 mml mml-sec epa derived gnus-util
text-property-search time-date mailabbrev gmm-utils mailheader mm-decode
mm-bodies mm-encode mail-utils gnutls network-stream url-cache url-http
url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm puny epg rfc6068 epg-config finder-inf package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs password-cache
json subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs
cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 282927 159473)
 (symbols 48 16620 1)
 (strings 32 98218 50117)
 (string-bytes 1 2278870)
 (vectors 16 25526)
 (vector-slots 8 346646 26540)
 (floats 8 46 357)
 (intervals 56 468 3)
 (buffers 984 15))





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2023-05-04 15:15 UTC (permalink / raw)
  To: 63260; +Cc: Basil Contovounesios, Philip Kaludercic

>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:

    Bug> This change:

    Basil>   Prevent generating empty autoload files
    Basil>   dd21003878d 2023-04-30 18:42:58 +0200
    Basil>   https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d

    Basil> seems to have reintroduced the following issue:

    Basil>   https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html

    Basil> First start Emacs 29 (or 30) with a clean slate:

    Basil> $ cd "$(mktemp --directory)"
    Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
    Basil> $ emacs

    Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:

    Basil> 0. C-x b RET
    Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
    Basil>    C-x C-e
    Basil> 2. M-x package-install RET sicp RET
    Basil> 3. C-h e
    Basil> 4. C-M-S-v

Only when `package-quickstart' is non-nil, right?

How about this:

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0919ce34448..42d47ed259c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4498,7 +4498,8 @@ package-quickstart-refresh
                (pfile (prin1-to-string file)))
           (insert "(let ((load-true-file-name " pfile ")\
 \(load-file-name " pfile "))\n")
-          (insert-file-contents file)
+          (when file
+            (insert-file-contents file))
           ;; Fixup the special #$ reader form and throw away comments.
           (while (re-search-forward "#\\$\\|^;\\(.*\n\\)" nil 'move)
             (unless (ppss-string-terminator (save-match-data (syntax-ppss)))

Robert
-- 





^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-04 16:28 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 63260, Philip Kaludercic

Robert Pluim [2023-05-04 17:15 +0200] wrote:

>>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:
>
>     Bug> This change:
>
>     Basil>   Prevent generating empty autoload files
>     Basil>   dd21003878d 2023-04-30 18:42:58 +0200
>     Basil>   https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d
>
>     Basil> seems to have reintroduced the following issue:
>
>     Basil>   https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html
>
>     Basil> First start Emacs 29 (or 30) with a clean slate:
>
>     Basil> $ cd "$(mktemp --directory)"
>     Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
>     Basil> $ emacs
>
>     Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:
>
>     Basil> 0. C-x b RET
>     Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
>     Basil>    C-x C-e
>     Basil> 2. M-x package-install RET sicp RET
>     Basil> 3. C-h e
>     Basil> 4. C-M-S-v
>
> Only when `package-quickstart' is non-nil, right?

No, this is in an empty user-emacs-directory, i.e. with the default
package-quickstart = nil.  Besides, package-quickstart does not come
into play during package-install AFAICT.

> How about this:
>
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..42d47ed259c 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4498,7 +4498,8 @@ package-quickstart-refresh
>                 (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
> -          (insert-file-contents file)
> +          (when file
> +            (insert-file-contents file))

This does not address the file-missing error during package activation,
but it allows a subsequent package-quickstart-refresh to complete
(albeit with a warning in a *Compile-Log*):

  Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
                 at Thu May  4 18:24:07 2023
  Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
  package-quickstart.el:4:2: Warning: Empty let body

due to the following generated contents of package-quickstart-file:

  (let ((load-true-file-name nil)(load-file-name nil))
  )

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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 13:10       ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 25+ messages in thread
From: Robert Pluim @ 2023-05-05  6:36 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 63260, Philip Kaludercic

>>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob@tcd.ie> said:

    Basil> Robert Pluim [2023-05-04 17:15 +0200] wrote:
    >>>>>>> On Thu, 04 May 2023 12:15:15 +0200, Basil Contovounesios via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org> said:
    >> 
    Bug> This change:
    >> 
    Basil> Prevent generating empty autoload files
    Basil> dd21003878d 2023-04-30 18:42:58 +0200
    Basil> https://git.sv.gnu.org/cgit/emacs.git/commit/?id=dd21003878d
    >> 
    Basil> seems to have reintroduced the following issue:
    >> 
    Basil> https://lists.gnu.org/r/emacs-devel/2022-06/msg00563.html
    >> 
    Basil> First start Emacs 29 (or 30) with a clean slate:
    >> 
    Basil> $ cd "$(mktemp --directory)"
    Basil> $ export HOME="${PWD}" XDG_CONFIG_HOME="${PWD}/.config"
    Basil> $ emacs
    >> 
    Basil> Then try to install the sicp package (which lacks autoloads) from MELPA:
    >> 
    Basil> 0. C-x b RET
    Basil> 1. (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
    Basil> C-x C-e
    Basil> 2. M-x package-install RET sicp RET
    Basil> 3. C-h e
    Basil> 4. C-M-S-v
    >> 
    >> Only when `package-quickstart' is non-nil, right?

    Basil> No, this is in an empty user-emacs-directory, i.e. with the default
    Basil> package-quickstart = nil.  Besides, package-quickstart does not come
    Basil> into play during package-install AFAICT.

Right. My testing was faulty

    Basil> This does not address the file-missing error during package activation,
    Basil> but it allows a subsequent package-quickstart-refresh to complete
    Basil> (albeit with a warning in a *Compile-Log*):

The file-missing error is expected, no? Thatʼs why the autoloads
loading is wrapped in `with-demoted-errors'. Although if the message bothers
you, I guess we could check `file-exists-p' for it.

    Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
    Basil>                  at Thu May  4 18:24:07 2023
    Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
    Basil>   package-quickstart.el:4:2: Warning: Empty let body

    Basil> due to the following generated contents of package-quickstart-file:

    Basil>   (let ((load-true-file-name nil)(load-file-name nil))
    Basil>   )

Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 0919ce34448..4b488281b78 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -4491,11 +4491,11 @@ package-quickstart-refresh
       (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
       (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
       (dolist (pkg package--quickstart-pkgs)
-        (let* ((file
-                ;; Prefer uncompiled files (and don't accept .so files).
-                (let ((load-suffixes '(".el" ".elc")))
-                  (locate-library (package--autoloads-file-name pkg))))
-               (pfile (prin1-to-string file)))
+        (when-let* ((file
+                     ;; Prefer uncompiled files (and don't accept .so files).
+                     (let ((load-suffixes '(".el" ".elc")))
+                       (locate-library (package--autoloads-file-name pkg))))
+                    (pfile (prin1-to-string file)))
           (insert "(let ((load-true-file-name " pfile ")\
 \(load-file-name " pfile "))\n")
           (insert-file-contents file)


Robert
-- 





^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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:10       ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 2 replies; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-06  9:01 UTC (permalink / raw)
  To: Robert Pluim; +Cc: contovob, 63260, philipk

> Cc: 63260@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
> From: Robert Pluim <rpluim@gmail.com>
> Date: Fri, 05 May 2023 08:36:51 +0200
> 
> >>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob@tcd.ie> said:
> 
>     Basil> This does not address the file-missing error during package activation,
>     Basil> but it allows a subsequent package-quickstart-refresh to complete
>     Basil> (albeit with a warning in a *Compile-Log*):
> 
> The file-missing error is expected, no? Thatʼs why the autoloads
> loading is wrapped in `with-demoted-errors'. Although if the message bothers
> you, I guess we could check `file-exists-p' for it.
> 
>     Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
>     Basil>                  at Thu May  4 18:24:07 2023
>     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
>     Basil>   package-quickstart.el:4:2: Warning: Empty let body
> 
>     Basil> due to the following generated contents of package-quickstart-file:
> 
>     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
>     Basil>   )
> 
> Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)
> 
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..4b488281b78 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>        (dolist (pkg package--quickstart-pkgs)
> -        (let* ((file
> -                ;; Prefer uncompiled files (and don't accept .so files).
> -                (let ((load-suffixes '(".el" ".elc")))
> -                  (locate-library (package--autoloads-file-name pkg))))
> -               (pfile (prin1-to-string file)))
> +        (when-let* ((file
> +                     ;; Prefer uncompiled files (and don't accept .so files).
> +                     (let ((load-suffixes '(".el" ".elc")))
> +                       (locate-library (package--autoloads-file-name pkg))))
> +                    (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
>            (insert-file-contents file)
> 

Philip, Basil: is the above okay with you?  I'd like this issue
resolved before making the next pretest of Emacs 29.1.

Thanks.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  1 sibling, 0 replies; 25+ messages in thread
From: Robert Pluim @ 2023-05-06 12:51 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Basil L. Contovounesios, 63260, Philip K.

[-- Attachment #1: Type: text/plain, Size: 2879 bytes --]

Please push if it's ok with you, I'm afk until tomorrow

Thanks

Robert

On Sat, May 6, 2023, 11:00 Eli Zaretskii <eliz@gnu.org> wrote:

> > Cc: 63260@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
> > From: Robert Pluim <rpluim@gmail.com>
> > Date: Fri, 05 May 2023 08:36:51 +0200
> >
> > >>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <
> contovob@tcd.ie> said:
> >
> >     Basil> This does not address the file-missing error during package
> activation,
> >     Basil> but it allows a subsequent package-quickstart-refresh to
> complete
> >     Basil> (albeit with a warning in a *Compile-Log*):
> >
> > The file-missing error is expected, no? Thatʼs why the autoloads
> > loading is wrapped in `with-demoted-errors'. Although if the message
> bothers
> > you, I guess we could check `file-exists-p' for it.
> >
> >     Basil>   Compiling file
> /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
> >     Basil>                  at Thu May  4 18:24:07 2023
> >     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
> >     Basil>   package-quickstart.el:4:2: Warning: Empty let body
> >
> >     Basil> due to the following generated contents of
> package-quickstart-file:
> >
> >     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
> >     Basil>   )
> >
> > Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)
> >
> > diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> > index 0919ce34448..4b488281b78 100644
> > --- a/lisp/emacs-lisp/package.el
> > +++ b/lisp/emacs-lisp/package.el
> > @@ -4491,11 +4491,11 @@ package-quickstart-refresh
> >        (insert ";;; Quickstart file to activate all packages at startup
> -*- lexical-binding:t -*-\n")
> >        (insert ";; ¡¡ This file is autogenerated by
> `package-quickstart-refresh', DO NOT EDIT !!\n\n")
> >        (dolist (pkg package--quickstart-pkgs)
> > -        (let* ((file
> > -                ;; Prefer uncompiled files (and don't accept .so files).
> > -                (let ((load-suffixes '(".el" ".elc")))
> > -                  (locate-library (package--autoloads-file-name pkg))))
> > -               (pfile (prin1-to-string file)))
> > +        (when-let* ((file
> > +                     ;; Prefer uncompiled files (and don't accept .so
> files).
> > +                     (let ((load-suffixes '(".el" ".elc")))
> > +                       (locate-library (package--autoloads-file-name
> pkg))))
> > +                    (pfile (prin1-to-string file)))
> >            (insert "(let ((load-true-file-name " pfile ")\
> >  \(load-file-name " pfile "))\n")
> >            (insert-file-contents file)
> >
>
> Philip, Basil: is the above okay with you?  I'd like this issue
> resolved before making the next pretest of Emacs 29.1.
>
> Thanks.
>

[-- Attachment #2: Type: text/html, Size: 4090 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-05  6:36     ` Robert Pluim
  2023-05-06  9:01       ` Eli Zaretskii
@ 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
  1 sibling, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-06 13:10 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 63260, Philip Kaludercic

Robert Pluim [2023-05-05 08:36 +0200] wrote:

>>>>>> On Thu, 04 May 2023 18:28:47 +0200, Basil Contovounesios <contovob@tcd.ie> said:
>
>     Basil> This does not address the file-missing error during package activation,
>     Basil> but it allows a subsequent package-quickstart-refresh to complete
>     Basil> (albeit with a warning in a *Compile-Log*):
>
> The file-missing error is expected, no? Thatʼs why the autoloads
> loading is wrapped in `with-demoted-errors'. Although if the message bothers
> you, I guess we could check `file-exists-p' for it.

I think it's problematic to emit even a demoted error for supported
circumstances, such as a 'library' package that defines no autoload
cookies.

Besides, shouldn't the autoloads file be generated unconditionally?
https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html

While the error logged to *Messages* is relatively silent, its subequent
repetition on Emacs startup is not:

$ emacs-29
Error loading autoloads: (file-missing Cannot open load file
No such file or directory
/tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)

This does not seem like TRT to me.

>     Basil>   Compiling file /tmp/tmp.6cdF8paE0K/.emacs.d/package-quickstart.el
>     Basil>                  at Thu May  4 18:24:07 2023
>     Basil>   Entering directory ‘/tmp/tmp.6cdF8paE0K/.emacs.d/’
>     Basil>   package-quickstart.el:4:2: Warning: Empty let body
>
>     Basil> due to the following generated contents of package-quickstart-file:
>
>     Basil>   (let ((load-true-file-name nil)(load-file-name nil))
>     Basil>   )
>
> Iʼd claim ENOCOFFEE for the last patch, but it was not the morning :-)

If only POSIX made it clear to expect ENOCOFFEE when it's least
expected ;).

> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index 0919ce34448..4b488281b78 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>        (dolist (pkg package--quickstart-pkgs)
> -        (let* ((file
> -                ;; Prefer uncompiled files (and don't accept .so files).
> -                (let ((load-suffixes '(".el" ".elc")))
> -                  (locate-library (package--autoloads-file-name pkg))))
> -               (pfile (prin1-to-string file)))
> +        (when-let* ((file
> +                     ;; Prefer uncompiled files (and don't accept .so files).
> +                     (let ((load-suffixes '(".el" ".elc")))
> +                       (locate-library (package--autoloads-file-name pkg))))
> +                    (pfile (prin1-to-string file)))
>            (insert "(let ((load-true-file-name " pfile ")\
>  \(load-file-name " pfile "))\n")
>            (insert-file-contents file)

This indeed avoids the problem in package-quickstart, thanks.

The issue with the missing autoload file during package
installation/activation remains, however.

Sorry for not being more helpful, but I'm travelling until next week.

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  1 sibling, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-06 13:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63260, Robert Pluim, philipk

Eli Zaretskii [2023-05-06 05:00 -0400] wrote:

>> Cc: 63260@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
>> From: Robert Pluim <rpluim@gmail.com>
>> Date: Fri, 05 May 2023 08:36:51 +0200
>> 
>> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
>> index 0919ce34448..4b488281b78 100644
>> --- a/lisp/emacs-lisp/package.el
>> +++ b/lisp/emacs-lisp/package.el
>> @@ -4491,11 +4491,11 @@ package-quickstart-refresh
>>        (insert ";;; Quickstart file to activate all packages at startup  -*- lexical-binding:t -*-\n")
>>        (insert ";; ¡¡ This file is autogenerated by `package-quickstart-refresh', DO NOT EDIT !!\n\n")
>>        (dolist (pkg package--quickstart-pkgs)
>> -        (let* ((file
>> -                ;; Prefer uncompiled files (and don't accept .so files).
>> -                (let ((load-suffixes '(".el" ".elc")))
>> -                  (locate-library (package--autoloads-file-name pkg))))
>> -               (pfile (prin1-to-string file)))
>> +        (when-let* ((file
>> +                     ;; Prefer uncompiled files (and don't accept .so files).
>> +                     (let ((load-suffixes '(".el" ".elc")))
>> +                       (locate-library (package--autoloads-file-name pkg))))
>> +                    (pfile (prin1-to-string file)))
>>            (insert "(let ((load-true-file-name " pfile ")\
>>  \(load-file-name " pfile "))\n")
>>            (insert-file-contents file)
>
> Philip, Basil: is the above okay with you?  I'd like this issue
> resolved before making the next pretest of Emacs 29.1.

As I said in my other message, AFAICT this fixes a symptom specific to
package-quickstart of the more general autoload file problem
reintroduced by dd21003878d.

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-06 13:23 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 63260, rpluim, philipk

> Cc: 63260@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
> Date: Sat, 06 May 2023 15:10:23 +0200
> From:  Basil Contovounesios via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> Robert Pluim [2023-05-05 08:36 +0200] wrote:
> 
> > The file-missing error is expected, no? Thatʼs why the autoloads
> > loading is wrapped in `with-demoted-errors'. Although if the message bothers
> > you, I guess we could check `file-exists-p' for it.
> 
> I think it's problematic to emit even a demoted error for supported
> circumstances, such as a 'library' package that defines no autoload
> cookies.
> 
> Besides, shouldn't the autoloads file be generated unconditionally?
> https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html
> 
> While the error logged to *Messages* is relatively silent, its subequent
> repetition on Emacs startup is not:
> 
> $ emacs-29
> Error loading autoloads: (file-missing Cannot open load file
> No such file or directory
> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
> 
> This does not seem like TRT to me.

What happened in Emacs 28 in the same situation?





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-06 13:28 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 63260, rpluim, philipk

> From: Basil Contovounesios <contovob@tcd.ie>
> Cc: Robert Pluim <rpluim@gmail.com>,  63260@debbugs.gnu.org,
>   philipk@posteo.net
> Date: Sat, 06 May 2023 15:12:31 +0200
> 
> > Philip, Basil: is the above okay with you?  I'd like this issue
> > resolved before making the next pretest of Emacs 29.1.
> 
> As I said in my other message, AFAICT this fixes a symptom specific to
> package-quickstart of the more general autoload file problem
> reintroduced by dd21003878d.

I'm trying to find a solution that is less drastic than reverting
commit dd21003878d.  Please help me.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-07  9:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63260, rpluim, philipk

[-- Attachment #1: Type: text/plain, Size: 1412 bytes --]

Eli Zaretskii [2023-05-06 16:23 +0300] wrote:

>> Cc: 63260@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
>> Date: Sat, 06 May 2023 15:10:23 +0200
>> From:  Basil Contovounesios via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> Robert Pluim [2023-05-05 08:36 +0200] wrote:
>> 
>> > The file-missing error is expected, no? Thatʼs why the autoloads
>> > loading is wrapped in `with-demoted-errors'. Although if the message bothers
>> > you, I guess we could check `file-exists-p' for it.
>> 
>> I think it's problematic to emit even a demoted error for supported
>> circumstances, such as a 'library' package that defines no autoload
>> cookies.
>> 
>> Besides, shouldn't the autoloads file be generated unconditionally?
>> https://lists.gnu.org/r/emacs-devel/2022-06/msg00570.html
>> 
>> While the error logged to *Messages* is relatively silent, its subequent
>> repetition on Emacs startup is not:
>> 
>> $ emacs-29
>> Error loading autoloads: (file-missing Cannot open load file
>> No such file or directory
>> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
>> 
>> This does not seem like TRT to me.
>
> What happened in Emacs 28 in the same situation?

Emacs 28.2 installs and activates the sicp package without complaints,
and generates the following -autoloads.el file, as expected:


[-- Attachment #2: sicp-autoloads.el --]
[-- Type: application/emacs-lisp, Size: 389 bytes --]

;;; sicp-autoloads.el --- automatically extracted autoloads  -*- lexical-binding: t -*-
;;
;;; Code:

(add-to-list 'load-path (directory-file-name
                         (or (file-name-directory #$) (car load-path))))

\f
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; sicp-autoloads.el ends here

[-- Attachment #3: Type: text/plain, Size: 351 bytes --]


The current emacs-29 generates no such autoloads file, because the sicp
package defines no autoloads.  But in general the -autoloads.el file is
nevertheless needed, at least for its load-path logic.

Contrast this with a package that defines even a single autoload cookie,
such as the bluetooth package on GNU ELPA.  In this case emacs-29 does
TRT:


[-- Attachment #4: bluetooth-autoloads.el --]
[-- Type: application/emacs-lisp, Size: 962 bytes --]

[-- Attachment #5: Type: text/plain, Size: 11 bytes --]


-- 
Basil

^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-07 10:50 UTC (permalink / raw)
  To: Basil Contovounesios, philipk; +Cc: 63260, rpluim

> From: Basil Contovounesios <contovob@tcd.ie>
> Cc: 63260@debbugs.gnu.org,  rpluim@gmail.com,  philipk@posteo.net
> Date: Sun, 07 May 2023 11:46:29 +0200
> 
> >> While the error logged to *Messages* is relatively silent, its subequent
> >> repetition on Emacs startup is not:
> >> 
> >> $ emacs-29
> >> Error loading autoloads: (file-missing Cannot open load file
> >> No such file or directory
> >> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
> >> 
> >> This does not seem like TRT to me.
> >
> > What happened in Emacs 28 in the same situation?
> 
> Emacs 28.2 installs and activates the sicp package without complaints,
> and generates the following -autoloads.el file, as expected:
> 
> 
> The current emacs-29 generates no such autoloads file, because the sicp
> package defines no autoloads.  But in general the -autoloads.el file is
> nevertheless needed, at least for its load-path logic.

AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
Philip what would happen in this case, and he replied that the changes
he proposed did TRT in that case?  So what is different here?  Philip?





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 0 replies; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-07 10:59 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63260, rpluim, philipk

Eli Zaretskii [2023-05-06 09:28 -0400] wrote:

>> From: Basil Contovounesios <contovob@tcd.ie>
>> Cc: Robert Pluim <rpluim@gmail.com>,  63260@debbugs.gnu.org,
>>   philipk@posteo.net
>> Date: Sat, 06 May 2023 15:12:31 +0200
>> 
>> > Philip, Basil: is the above okay with you?  I'd like this issue
>> > resolved before making the next pretest of Emacs 29.1.
>> 
>> As I said in my other message, AFAICT this fixes a symptom specific to
>> package-quickstart of the more general autoload file problem
>> reintroduced by dd21003878d.
>
> I'm trying to find a solution that is less drastic than reverting
> commit dd21003878d.  Please help me.

I would like to, but I'm unfamiliar with loaddefs-gen and what Philip's
change was addressing.  I'll need some time to understand and test
what's going on.  Unfortunately I'm only very sporadically at a keyboard
until at least tomorrow evening.  Hopefully Philip or Robert can beat me
to it, otherwise I hope to have a look in the coming days.

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 10:50             ` Eli Zaretskii
@ 2023-05-07 12:39               ` Philip Kaludercic
  2023-05-07 12:54                 ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Philip Kaludercic @ 2023-05-07 12:39 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Basil Contovounesios, 63260, rpluim

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Basil Contovounesios <contovob@tcd.ie>
>> Cc: 63260@debbugs.gnu.org,  rpluim@gmail.com,  philipk@posteo.net
>> Date: Sun, 07 May 2023 11:46:29 +0200
>> 
>> >> While the error logged to *Messages* is relatively silent, its subequent
>> >> repetition on Emacs startup is not:
>> >> 
>> >> $ emacs-29
>> >> Error loading autoloads: (file-missing Cannot open load file
>> >> No such file or directory
>> >> /tmp/tmp.QQvQfBZ384/.emacs.d/elpa/sicp-20200512.1137/sicp-autoloads)
>> >> 
>> >> This does not seem like TRT to me.
>> >
>> > What happened in Emacs 28 in the same situation?
>> 
>> Emacs 28.2 installs and activates the sicp package without complaints,
>> and generates the following -autoloads.el file, as expected:
>> 
>> 
>> The current emacs-29 generates no such autoloads file, because the sicp
>> package defines no autoloads.  But in general the -autoloads.el file is
>> nevertheless needed, at least for its load-path logic.
>
> AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
> Philip what would happen in this case, and he replied that the changes
> he proposed did TRT in that case?  So what is different here?  Philip?

No, that appears to have been my mistake.  The issue is that
`loaddefs-generate' generates the autoload file while looping over all
definitions to autoload, but if there are no files, Basil is right that
nothing happens.  This is fine in general, but `loaddefs-generate' has
the extra task of modifying load-path (which has been the root of the
issue in bug#62734).  Perhaps it is best to revert the commit, and come
up with a alternative solution.  I have an idea, but I'll have to test
it again before I forget something like this.

-- 
Philip Kaludercic





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 12:39               ` Philip Kaludercic
@ 2023-05-07 12:54                 ` Eli Zaretskii
  2023-05-07 13:12                   ` Philip Kaludercic
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-07 12:54 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: contovob, 63260, rpluim

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: Basil Contovounesios <contovob@tcd.ie>,  63260@debbugs.gnu.org,
>   rpluim@gmail.com
> Date: Sun, 07 May 2023 12:39:48 +0000
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
> > Philip what would happen in this case, and he replied that the changes
> > he proposed did TRT in that case?  So what is different here?  Philip?
> 
> No, that appears to have been my mistake.  The issue is that
> `loaddefs-generate' generates the autoload file while looping over all
> definitions to autoload, but if there are no files, Basil is right that
> nothing happens.  This is fine in general, but `loaddefs-generate' has
> the extra task of modifying load-path (which has been the root of the
> issue in bug#62734).  Perhaps it is best to revert the commit, and come
> up with a alternative solution.  I have an idea, but I'll have to test
> it again before I forget something like this.

If we revert that commit, we will bring back bug#62734, which to me
sounds like a similarly serious, perhaps even more serious, issue,
don't you agree?  So I think maybe we need to amend that commit with
something that takes care of the particular situation reported here.
Specifically, it seems we need to detect the situation where a package
has no autoloads at all, and then produce the minimal autoloads file
that such packages expect.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 12:54                 ` Eli Zaretskii
@ 2023-05-07 13:12                   ` Philip Kaludercic
  2023-05-07 13:21                     ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Philip Kaludercic @ 2023-05-07 13:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: contovob, 63260, rpluim

[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: Basil Contovounesios <contovob@tcd.ie>,  63260@debbugs.gnu.org,
>>   rpluim@gmail.com
>> Date: Sun, 07 May 2023 12:39:48 +0000
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> > AFAIU, in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62734 I asked
>> > Philip what would happen in this case, and he replied that the changes
>> > he proposed did TRT in that case?  So what is different here?  Philip?
>> 
>> No, that appears to have been my mistake.  The issue is that
>> `loaddefs-generate' generates the autoload file while looping over all
>> definitions to autoload, but if there are no files, Basil is right that
>> nothing happens.  This is fine in general, but `loaddefs-generate' has
>> the extra task of modifying load-path (which has been the root of the
>> issue in bug#62734).  Perhaps it is best to revert the commit, and come
>> up with a alternative solution.  I have an idea, but I'll have to test
>> it again before I forget something like this.
>
> If we revert that commit, we will bring back bug#62734, which to me
> sounds like a similarly serious, perhaps even more serious, issue,
> don't you agree?  

My idea was that we could revert the commit, and then install a smaller
change, basically just replacing the condition

  (and (not defs) extra-data)

with

  (not defs)

but thinking about it for a bit, I noticed that you are right that this
would just re-introduce the same issue.

>                   So I think maybe we need to amend that commit with
> something that takes care of the particular situation reported here.
> Specifically, it seems we need to detect the situation where a package
> has no autoloads at all, and then produce the minimal autoloads file
> that such packages expect.

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


[-- Attachment #2: Type: text/plain, Size: 1021 bytes --]

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 2a46fb7a022..c23f21553d5 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -656,7 +656,17 @@ 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")))))
+
+    ;; HACK: If no file with autoloads were found, but EXTRA-DATA was
+    ;; passed, we still want to generate a file.
+    (unless (and extra-data (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."

[-- Attachment #3: Type: text/plain, Size: 23 bytes --]


-- 
Philip Kaludercic

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 13:12                   ` Philip Kaludercic
@ 2023-05-07 13:21                     ` Eli Zaretskii
  2023-05-07 19:37                       ` Philip Kaludercic
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-07 13:21 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: contovob, 63260, rpluim

> 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?

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.

Thanks.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 13:21                     ` Eli Zaretskii
@ 2023-05-07 19:37                       ` Philip Kaludercic
  2023-05-08 11:16                         ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Philip Kaludercic @ 2023-05-07 19:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: contovob, 63260, rpluim

[-- 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.

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-07 19:37                       ` Philip Kaludercic
@ 2023-05-08 11:16                         ` Eli Zaretskii
  2023-05-08 13:15                           ` Robert Pluim
  2023-05-10 13:12                           ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-08 11:16 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: contovob, 63260, rpluim

> From: Philip Kaludercic <philipk@posteo.net>
> Cc: contovob@tcd.ie,  63260@debbugs.gnu.org,  rpluim@gmail.com
> Date: Sun, 07 May 2023 19:37:26 +0000
> 
> 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:

LGTM, thanks.  Is Robert's use case also taken care of?






^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-08 11:16                         ` Eli Zaretskii
@ 2023-05-08 13:15                           ` Robert Pluim
  2023-05-08 13:18                             ` Eli Zaretskii
  2023-05-10 13:12                           ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2023-05-08 13:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: contovob, 63260, Philip Kaludercic

>>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz@gnu.org> said:
    >> You are right.  How does this patch look like:

    Eli> LGTM, thanks.  Is Robert's use case also taken care of?

I wasnʼt aware I had one, Basil reported the bug.

Robert
-- 





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-08 13:15                           ` Robert Pluim
@ 2023-05-08 13:18                             ` Eli Zaretskii
  2023-05-08 13:23                               ` Robert Pluim
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-08 13:18 UTC (permalink / raw)
  To: Robert Pluim; +Cc: contovob, 63260, philipk

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Philip Kaludercic <philipk@posteo.net>,  contovob@tcd.ie,
>   63260@debbugs.gnu.org
> Date: Mon, 08 May 2023 15:15:32 +0200
> 
> >>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz@gnu.org> said:
>     >> You are right.  How does this patch look like:
> 
>     Eli> LGTM, thanks.  Is Robert's use case also taken care of?
> 
> I wasnʼt aware I had one, Basil reported the bug.

Sorry, I thought you two reported 2 separate issues.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-08 13:18                             ` Eli Zaretskii
@ 2023-05-08 13:23                               ` Robert Pluim
  0 siblings, 0 replies; 25+ messages in thread
From: Robert Pluim @ 2023-05-08 13:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: contovob, 63260, philipk

>>>>> On Mon, 08 May 2023 16:18:47 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Cc: Philip Kaludercic <philipk@posteo.net>,  contovob@tcd.ie,
    >> 63260@debbugs.gnu.org
    >> Date: Mon, 08 May 2023 15:15:32 +0200
    >> 
    >> >>>>> On Mon, 08 May 2023 14:16:49 +0300, Eli Zaretskii <eliz@gnu.org> said:
    >> >> You are right.  How does this patch look like:
    >> 
    Eli> LGTM, thanks.  Is Robert's use case also taken care of?
    >> 
    >> I wasnʼt aware I had one, Basil reported the bug.

    Eli> Sorry, I thought you two reported 2 separate issues.

There were two separate reports for this issue, plus I reported
Bug#63236, but that oneʼs fixed.

Robert
-- 





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-08 11:16                         ` Eli Zaretskii
  2023-05-08 13:15                           ` 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
  1 sibling, 1 reply; 25+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-05-10 13:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 63260, Philip Kaludercic, rpluim

Eli Zaretskii [2023-05-08 07:15 -0400] wrote:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: contovob@tcd.ie,  63260@debbugs.gnu.org,  rpluim@gmail.com
>> Date: Sun, 07 May 2023 19:37:26 +0000
>> 
>> You are right.  How does this patch look like:
>
> LGTM, thanks.  Is Robert's use case also taken care of?

Both the package-install and package-quickstart-refresh issues I listed
are fixed by the patch.  I also checked that loaddefs-generate continues
to work in an external package, AFAICT:

https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  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
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2023-05-10 14:22 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 63260, philipk, rpluim

> From: Basil Contovounesios <contovob@tcd.ie>
> Cc: Philip Kaludercic <philipk@posteo.net>,  63260@debbugs.gnu.org,
>   rpluim@gmail.com
> Date: Wed, 10 May 2023 14:12:44 +0100
> 
> Eli Zaretskii [2023-05-08 07:15 -0400] wrote:
> 
> >> From: Philip Kaludercic <philipk@posteo.net>
> >> Cc: contovob@tcd.ie,  63260@debbugs.gnu.org,  rpluim@gmail.com
> >> Date: Sun, 07 May 2023 19:37:26 +0000
> >> 
> >> You are right.  How does this patch look like:
> >
> > LGTM, thanks.  Is Robert's use case also taken care of?
> 
> Both the package-install and package-quickstart-refresh issues I listed
> are fixed by the patch.  I also checked that loaddefs-generate continues
> to work in an external package, AFAICT:
> 
> https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28

Thanks.





^ permalink raw reply	[flat|nested] 25+ messages in thread

* bug#63260: 29.0.90; Regression installing/activating packages without autoloads
  2023-05-10 14:22                             ` Eli Zaretskii
@ 2023-05-12  7:43                               ` Philip Kaludercic
  0 siblings, 0 replies; 25+ messages in thread
From: Philip Kaludercic @ 2023-05-12  7:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Basil Contovounesios, 63260-done, rpluim

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Basil Contovounesios <contovob@tcd.ie>
>> Cc: Philip Kaludercic <philipk@posteo.net>,  63260@debbugs.gnu.org,
>>   rpluim@gmail.com
>> Date: Wed, 10 May 2023 14:12:44 +0100
>> 
>> Eli Zaretskii [2023-05-08 07:15 -0400] wrote:
>> 
>> >> From: Philip Kaludercic <philipk@posteo.net>
>> >> Cc: contovob@tcd.ie,  63260@debbugs.gnu.org,  rpluim@gmail.com
>> >> Date: Sun, 07 May 2023 19:37:26 +0000
>> >> 
>> >> You are right.  How does this patch look like:
>> >
>> > LGTM, thanks.  Is Robert's use case also taken care of?
>> 
>> Both the package-install and package-quickstart-refresh issues I listed
>> are fixed by the patch.  I also checked that loaddefs-generate continues
>> to work in an external package, AFAICT:
>> 
>> https://github.com/kyleam/bog/blob/8fc7ff7d926ddb7291df9706b92e09cc8addcfad/Makefile#L20-L28
>
> Thanks.

I've pushed the changes.





^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-05-12  7:43 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).