From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Kost Subject: Re: [PATCH 2/5] build: emacs-utils: Add 'emacs-byte-compile-directory' Date: Sun, 21 Jun 2015 23:40:23 +0300 Message-ID: <87vbeg6big.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40319) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6m2a-0004cw-LA for guix-devel@gnu.org; Sun, 21 Jun 2015 16:40:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z6m2V-0000l4-LS for guix-devel@gnu.org; Sun, 21 Jun 2015 16:40:32 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:34534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z6m2V-0000kn-D3 for guix-devel@gnu.org; Sun, 21 Jun 2015 16:40:27 -0400 Received: by lagx9 with SMTP id x9so11155616lag.1 for ; Sun, 21 Jun 2015 13:40:26 -0700 (PDT) In-Reply-To: (Federico Beffa's message of "Sun, 21 Jun 2015 10:29:25 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Federico Beffa Cc: Guix-devel --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 compil= ing > +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 occurre= nce 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 =E2=80=98(invalid-function "one")=E2=80=99. O= r did I miss anything? Also I believe dependency-dirs should have a preference over other 'load-path' directories. So what about the following variant: --=-=-= Content-Type: text/x-scheme Content-Disposition: inline; filename=emacs-byte-compile-directory.scm (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))) --=-=-= Content-Type: text/plain -- Alex --=-=-=--