Ludovic Courtès (2015-12-09 16:58 +0300) wrote:

> Alex Kost <[email protected]> skribis:
>
>> Ludovic Courtès (2015-12-08 02:00 +0300) wrote:
>>> Otherwise there’s a risk of fooling the GC, as in
>>> <http://bugs.gnu.org/20765>.
>>
>> Hm, OK.  I don't fully understand the issue though.  So *.el files of
>> 'emacs-w3m-1.4.538+0.20141022' will be compressed, and some of these
>> *.el.gz files contain store file names.  Do these files fool GC?
>
> Yes.  When a derivation build completes, the daemon scans all the files
> in the derivation outputs for /gnu/store/… patterns, and then records
> those patterns in the ‘References’ table of /var/guix/db/db.sqlite.
>
> This is what makes sure that if /gnu/store/A refers to /gnu/store/B, and
> if /gnu/store/A is live, then /gnu/store/B will not be GC’.d

Thank you for the descriptive explanation!  I confess I'm almost
ignorant in these internals.

>> If so, I think 'emacs-w3m' should be configured with
>> '--without-compress-install', right?
>
> Sounds like it!

Great, I have updated and pushed 'emacs-w3m' patch.

Now since it is clear that it is potentially problematic to have
compressed *.el files, I have changed this patch to handle only compiled
autoloads as the compressed ones are unlikely to appear ever.  OK?

>From baa1950d823d0de07fa083f5f2770d3d6b681510 Mon Sep 17 00:00:00 2001
From: Alex Kost <[email protected]>
Date: Thu, 3 Dec 2015 13:03:19 +0300
Subject: [PATCH] emacs: Handle compiled autoloads.

* emacs/guix-emacs.el (guix-emacs-autoloads-regexp): New variable.
  (guix-emacs-find-autoloads-in-directory): Return a list of autoloads
  without extensions.
---
 emacs/guix-emacs.el | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/emacs/guix-emacs.el b/emacs/guix-emacs.el
index 6515b3d..2f809ed 100644
--- a/emacs/guix-emacs.el
+++ b/emacs/guix-emacs.el
@@ -37,6 +37,11 @@ they are successfully installed."
 (defvar guix-emacs-autoloads nil
   "List of the last loaded Emacs autoloads.")
 
+(defvar guix-emacs-autoloads-regexp
+  (rx (group (* any) "-autoloads")
+      ".el" (zero-or-one "c") string-end)
+  "Regexp to match Emacs 'autoloads' file.")
+
 (defun guix-emacs-directory (&optional profile)
   "Return directory with Emacs packages installed in PROFILE.
 If PROFILE is nil, use `guix-user-profile'."
@@ -44,8 +49,15 @@ If PROFILE is nil, use `guix-user-profile'."
                     (or profile guix-user-profile)))
 
 (defun guix-emacs-find-autoloads-in-directory (directory)
-  "Return list of Emacs 'autoloads' files in DIRECTORY."
-  (directory-files directory 'full-name "-autoloads\\.el\\'" 'no-sort))
+  "Return a list of Emacs 'autoloads' files in DIRECTORY.
+The files in the list do not have extensions (.el, .elc)."
+  (cl-remove-duplicates
+   (delq nil
+        (mapcar (lambda (file)
+                  (when (string-match guix-emacs-autoloads-regexp file)
+                    (match-string 1 file)))
+                (directory-files directory 'full-name nil 'no-sort)))
+   :test #'string=))
 
 (defun guix-emacs-subdirs (directory)
   "Return list of DIRECTORY subdirectories."
-- 
2.6.3

Reply via email to