GNU bug report logs - #57122
[PATCH] build-system: emacs: Use new function for autoloads generation

Previous Next

Package: guix-patches;

Reported by: Morgan.J.Smith <at> outlook.com

Date: Wed, 10 Aug 2022 18:06:01 UTC

Severity: normal

Tags: patch

Done: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57122 in the body.
You can then email your comments to 57122 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#57122; Package guix-patches. (Wed, 10 Aug 2022 18:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Morgan.J.Smith <at> outlook.com:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Wed, 10 Aug 2022 18:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Morgan.J.Smith <at> outlook.com
To: guix-patches <at> gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>, liliana.prikler <at> gmail.com
Subject: [PATCH] build-system: emacs: Use new function for autoloads generation
Date: Wed, 10 Aug 2022 13:37:09 -0400
From: Morgan Smith <Morgan.J.Smith <at> outlook.com>

* guix/build/emacs-utils.scm (emacs-generate-autoloads): Use
'loaddefs-generate' to create autoloads instead of
'update-directory-autoloads' if we are using a new enough Emacs
---

I'm not sure how long it takes to rebuild all the Emacs packages so I CC'd Liliana since they are going to change the Emacs build system soon anyways.

This change is to allow packages to be built with the latest commits of emacs (guix build emacs-crdt --with-input=emacs-minimal=emacs-next --with-latest=emacs-next)

Just last week the 'update-directory-autoloads' function got deprecated and replaced.  Since continuing to use the deprecated function would require changes anyways (adding a '(require 'autoloads)' would do it I think), I decided to just use the newer function.

Is this a bug in upstream Emacs where autoloaded functions like 'update-directory-autoloads' don't get autoloaded when they are in the obsolete directory?  Possibly.  Is this a bug related to our packaging of Emacs?  Possibly.  Is this the intended behaviour?  Possibly.  I'm not the guy to ask :P. I'm really not sure why this stopped working.  But we will have to switch to the 'loaddefs-generate' function eventually anyways so I think this patch is probably good to apply.


Thanks,

Morgan


 guix/build/emacs-utils.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 8ee547f2b3..180c3ae08c 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -105,7 +105,11 @@ (define (emacs-generate-autoloads name directory)
   (let* ((file (string-append directory "/" name "-autoloads.el"))
          (expr `(let ((backup-inhibited t)
                       (generated-autoload-file ,file))
-                  (update-directory-autoloads ,directory))))
+                  (if (not (require 'loaddefs-gen nil t))
+                      ;; Emacs <= 28
+                      (update-directory-autoloads ,directory)
+                    ;; Emacs >= 29
+                    (loaddefs-generate ,directory ,file)))))
     (emacs-batch-eval expr #:dynamic? #t)))
 
 (define* (emacs-byte-compile-directory dir)
-- 
2.37.1





Information forwarded to guix-patches <at> gnu.org:
bug#57122; Package guix-patches. (Wed, 10 Aug 2022 19:59:01 GMT) Full text and rfc822 format available.

Message #8 received at 57122 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan.J.Smith <at> outlook.com, 57122 <at> debbugs.gnu.org
Subject: Re: [PATCH] build-system: emacs: Use new function for autoloads
 generation
Date: Wed, 10 Aug 2022 21:57:51 +0200
Am Mittwoch, dem 10.08.2022 um 13:37 -0400 schrieb
Morgan.J.Smith <at> outlook.com:
> From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
> 
> * guix/build/emacs-utils.scm (emacs-generate-autoloads): Use
> 'loaddefs-generate' to create autoloads instead of
> 'update-directory-autoloads' if we are using a new enough Emacs
> ---
> 
> I'm not sure how long it takes to rebuild all the Emacs packages so I
> CC'd Liliana since they are going to change the Emacs build system
> soon anyways.
I can tack that onto native-comp no problem.  I can't recall the time
it took to rebuild everything for the last big upgrade, but it's
definitely something to do for fun and a little heat in winter.

> This change is to allow packages to be built with the latest commits
> of emacs (guix build emacs-crdt --with-input=emacs-minimal=emacs-next
> --with-latest=emacs-next)
> 
> Just last week the 'update-directory-autoloads' function got
> deprecated and replaced.  Since continuing to use the deprecated
> function would require changes anyways (adding a '(require
> 'autoloads)' would do it I think), I decided to just use the newer
> function.
> 
> Is this a bug in upstream Emacs where autoloaded functions like
> 'update-directory-autoloads' don't get autoloaded when they are in
> the obsolete directory?  Possibly.  Is this a bug related to our
> packaging of Emacs?  Possibly.  Is this the intended behaviour? 
> Possibly.  I'm not the guy to ask :P. I'm really not sure why this
> stopped working.  But we will have to switch to the 'loaddefs-
> generate' function eventually anyways so I think this patch is
> probably good to apply.
Can we instead use make-directory-autoloads or has that also been
deprecated in 29?  make-directory-autoloads exists since Emacs 28.1 and
seems to have the same signature as loaddefs-generate.  Any reason to
prefer the latter?


Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#57122; Package guix-patches. (Wed, 10 Aug 2022 23:13:02 GMT) Full text and rfc822 format available.

Message #11 received at 57122 <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: 57122 <at> debbugs.gnu.org
Subject: Re: [PATCH] build-system: emacs: Use new function for autoloads
 generation
Date: Wed, 10 Aug 2022 19:12:35 -0400
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> Can we instead use make-directory-autoloads or has that also been
> deprecated in 29?  make-directory-autoloads exists since Emacs 28.1 and
> seems to have the same signature as loaddefs-generate.  Any reason to
> prefer the latter?

make-directory-autoloads is in autoloads.el which has been moved to a
directory named "obsolete" but the function itself hasn't been marked
obsolete.  I'm not really sure what that means but it looks like all the
autoloads stuff is being deprecated in favor of the newer loaddef stuff




Information forwarded to guix-patches <at> gnu.org:
bug#57122; Package guix-patches. (Thu, 18 Aug 2022 12:45:02 GMT) Full text and rfc822 format available.

Message #14 received at 57122 <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: 57122 <at> debbugs.gnu.org
Subject: Re: bug#57122: [PATCH] build-system: emacs: Use new function for
 autoloads generation
Date: Thu, 18 Aug 2022 08:43:55 -0400
So the FreeBSD guys had the same issue but actually bothered to notify
upstream so the issue has been fixed:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57200

That doesn't mean we shouldn't look into using a non-deprecated function
though.  Earlier I did try to use 'package-generate-autoloads' as that
seems like the ideal function to use but it adds the following string to
the loaddefs file:

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

This line would probably work fine but for some reason when I tried it,
it didn't properly substitute '#$' with the file name.  I'm not really
sure how to fix that.




Information forwarded to guix-patches <at> gnu.org:
bug#57122; Package guix-patches. (Thu, 18 Aug 2022 18:38:02 GMT) Full text and rfc822 format available.

Message #17 received at 57122 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Cc: 57122 <at> debbugs.gnu.org
Subject: Re: bug#57122: [PATCH] build-system: emacs: Use new function for
 autoloads generation
Date: Thu, 18 Aug 2022 20:37:37 +0200
Am Donnerstag, dem 18.08.2022 um 08:43 -0400 schrieb Morgan Smith:
> 
> So the FreeBSD guys had the same issue but actually bothered to
> notify upstream so the issue has been fixed:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57200
> 
> That doesn't mean we shouldn't look into using a non-deprecated
> function though.  Earlier I did try to use 'package-generate-
> autoloads' as that seems like the ideal function to use but it adds
> the following string to the loaddefs file:
> 
> "(add-to-list 'load-path (directory-file-name
>                      (or (file-name-directory #$) (car load-path))))"
> 
> This line would probably work fine but for some reason when I tried
> it, it didn't properly substitute '#$' with the file name.  I'm not
> really sure how to fix that.
Is "#$" a literal string?  You might want to substitute* the correct
directory in there after running package-generate-autoloads.

As for make-directory-autoloads vs. loaddefs-generate, IIRC both have
the same signature, so you could make this work with both the non-
deprecated function in Emacs 28 and the new one added in Emacs 29.

Cheers




bug closed, send any further explanations to 57122 <at> debbugs.gnu.org and Morgan.J.Smith <at> outlook.com Request was from Morgan Smith <Morgan.J.Smith <at> outlook.com> to control <at> debbugs.gnu.org. (Mon, 13 May 2024 14:44:01 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 12 Jun 2024 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.