* [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
@ 2015-06-21 8:29 Federico Beffa
2015-06-21 20:40 ` Alex Kost
0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2015-06-21 8:29 UTC (permalink / raw)
To: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 39 bytes --]
A new general utility for Emacs.
Fede
[-- Attachment #2: 0002-build-emacs-utils-Add-emacs-byte-compile-directory.patch --]
[-- Type: text/x-diff, Size: 1708 bytes --]
From d036941639ecffe8fb29dd9cc7ee9b5fe0e6b10c 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 | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/guix/build/emacs-utils.scm b/guix/build/emacs-utils.scm
index 0cff28b..3ecccd9 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,18 @@
(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)
+ (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
--
2.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
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
0 siblings, 1 reply; 4+ messages in thread
From: Alex Kost @ 2015-06-21 20:40 UTC (permalink / raw)
To: Federico Beffa; +Cc: Guix-devel
[-- Attachment #1: Type: text/plain, Size: 1524 bytes --]
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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: emacs-byte-compile-directory.scm --]
[-- Type: text/x-scheme, Size: 521 bytes --]
(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)))
[-- Attachment #3: Type: text/plain, Size: 10 bytes --]
--
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
2015-06-21 20:40 ` Alex Kost
@ 2015-06-24 16:13 ` Federico Beffa
2015-06-24 21:07 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2015-06-24 16:13 UTC (permalink / raw)
To: Alex Kost; +Cc: Guix-devel
[-- 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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
2015-06-24 16:13 ` Federico Beffa
@ 2015-06-24 21:07 ` Ludovic Courtès
0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-06-24 21:07 UTC (permalink / raw)
To: Federico Beffa; +Cc: Guix-devel, Alex Kost
Federico Beffa <beffa@ieee.org> skribis:
> 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.
LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-24 21:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-06-24 21:07 ` Ludovic Courtès
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.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).