all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Federico Beffa <beffa@ieee.org>
To: Alex Kost <alezost@gmail.com>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
Date: Wed, 24 Jun 2015 18:13:56 +0200	[thread overview]
Message-ID: <CAKrPhPP93Ornm9+_Tv5+7X_ONKyRikDGJQ6ZDL8cCFubVEgAUw@mail.gmail.com> (raw)
In-Reply-To: <87vbeg6big.fsf@gmail.com>

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

Thanks.

On Sun, Jun 21, 2015 at 10:40 PM, Alex Kost <alezost@gmail.com> wrote:
> Federico Beffa (2015-06-21 11:29 +0300) wrote:
>
> [...]
>> +(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '()))
>> +  "Byte compile all files in DIR and its sub-directories.  Before compiling
>> +the files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'."
>> +  (let ((expr `(progn
>> +                (add-to-list 'load-path ,dir)
>> +                (unless (null ,(if (null? dependency-dirs)
>> +                                   'nil
>> +                                   dependency-dirs))
>> +                  (setq load-path (append load-path ,dependency-dirs)))
>> +                (byte-recompile-directory (file-name-as-directory ,dir) 0))))
>> +    (emacs-batch-eval expr)))
>> +
>>  (define-syntax emacs-substitute-sexps
>>    (syntax-rules ()
>>      "Substitute the S-expression immediately following the first occurrence of
>
> Shouldn't there be problems with unquoted 'dependency-dirs' list?  IIUC
> the following:
>
>   (emacs-byte-compile-directory "/tmp/foo" '("one" "two"))
>
> will produce the following elisp expression:
>
> (progn
>   (add-to-list (quote load-path) "/tmp/foo")
>   (unless (null ("one" "two"))
>     (setq load-path (append load-path ("one" "two"))))
>   (byte-recompile-directory (file-name-as-directory "/tmp/foo") 0))
>
> but that will raise an error ‘(invalid-function "one")’.  Or did I miss
> anything?
>
> Also I believe dependency-dirs should have a preference over other
> 'load-path' directories.
>
> So what about the following variant:
>
>
>
> --
> Alex
>

[-- Attachment #2: 0002-build-emacs-utils-Add-emacs-byte-compile-directory.patch --]
[-- Type: text/x-diff, Size: 1593 bytes --]

From ec5fbc02e09359bf64b69efed314471e5f409fa4 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Tue, 16 Jun 2015 21:09:57 +0200
Subject: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'.

* guix/build/emacs-utils.scm (emacs-byte-compile-directory): New procedure.
---
 guix/build/emacs-utils.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 0cff28b..fd06aad 100644
--- a/guix/build/emacs-utils.scm
+++ b/guix/build/emacs-utils.scm
@@ -22,6 +22,7 @@
             emacs-batch-eval
             emacs-batch-edit-file
             emacs-generate-autoloads
+            emacs-byte-compile-directory
             emacs-substitute-sexps
             emacs-substitute-variables))
 
@@ -57,6 +58,16 @@
                   (update-directory-autoloads ,directory))))
     (emacs-batch-eval expr)))
 
+(define* (emacs-byte-compile-directory dir #:optional (dependency-dirs '()))
+  "Byte compile all files in DIR and its sub-directories.  Before compiling
+the files, add DIR and all directories in DEPENDENCY-DIRS to 'load-path'."
+  (let ((expr `(progn
+                (add-to-list 'load-path ,dir)
+                (when ',dependency-dirs
+                  (setq load-path (append ',dependency-dirs load-path)))
+                (byte-recompile-directory (file-name-as-directory ,dir) 0))))
+    (emacs-batch-eval expr)))
+
 (define-syntax emacs-substitute-sexps
   (syntax-rules ()
     "Substitute the S-expression immediately following the first occurrence of
-- 
2.2.1


  reply	other threads:[~2015-06-24 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-21  8:29 [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory' Federico Beffa
2015-06-21 20:40 ` Alex Kost
2015-06-24 16:13   ` Federico Beffa [this message]
2015-06-24 21:07     ` Ludovic Courtès

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKrPhPP93Ornm9+_Tv5+7X_ONKyRikDGJQ6ZDL8cCFubVEgAUw@mail.gmail.com \
    --to=beffa@ieee.org \
    --cc=alezost@gmail.com \
    --cc=guix-devel@gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.