unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alex Kost <alezost@gmail.com>
To: Federico Beffa <beffa@ieee.org>
Cc: Guix-devel <guix-devel@gnu.org>
Subject: Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory'
Date: Sun, 21 Jun 2015 23:40:23 +0300	[thread overview]
Message-ID: <87vbeg6big.fsf@gmail.com> (raw)
In-Reply-To: <CAKrPhPM69Hany3X4DW4ueq5mi40K6sNbPLYs0+No4wxt5nb=tg@mail.gmail.com> (Federico Beffa's message of "Sun, 21 Jun 2015 10:29:25 +0200")

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

  reply	other threads:[~2015-06-21 20:40 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 [this message]
2015-06-24 16:13   ` Federico Beffa
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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87vbeg6big.fsf@gmail.com \
    --to=alezost@gmail.com \
    --cc=beffa@ieee.org \
    --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 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).