From mboxrd@z Thu Jan 1 00:00:00 1970 From: Federico Beffa Subject: Re: emacs packages Date: Thu, 18 Jun 2015 20:24:16 +0200 Message-ID: References: <87a8vzfwpr.fsf@netris.org> <87ioamdvmd.fsf@netris.org> <87wpz2rtpk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5eU6-0003I1-B8 for guix-devel@gnu.org; Thu, 18 Jun 2015 14:24:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5eU4-0006j7-Ti for guix-devel@gnu.org; Thu, 18 Jun 2015 14:24:18 -0400 Received: from mail-ig0-x22b.google.com ([2607:f8b0:4001:c05::22b]:34527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5eU4-0006i0-OY for guix-devel@gnu.org; Thu, 18 Jun 2015 14:24:16 -0400 Received: by igboe5 with SMTP id oe5so25425744igb.1 for ; Thu, 18 Jun 2015 11:24:16 -0700 (PDT) In-Reply-To: <87wpz2rtpk.fsf@gmail.com> 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: Alex Kost Cc: Guix-devel On Wed, Jun 17, 2015 at 10:00 PM, Alex Kost wrote: > Mark H Weaver (2015-06-17 21:42 +0300) wrote: > >> Federico Beffa writes: >> >>> What do you think about the attached implementation? >> >> [...] >> >>> +(define (emacs-byte-compile files) >>> + "Byte compile FILES, a list of file names." >>> + (if (pair? files) >>> + (for-each (lambda (f) >>> + (let ((expr `(let () >>> + (push ,(dirname f) load-path) >>> + (byte-compile-file ,f)))) >>> + (emacs-batch-eval expr))) >>> + files) >>> + (error "emacs-byte-compile failed: not a list of files!" files))) >>> + >> >> I would prefer to let an emacs expert (Alex?) comment on this, but here > > (I don't consider myself an expert, I'm definitely much less experienced > with Emacs than you or Ludovic.) > >> are some preliminary comments: >> >> * I wouldn't bother checking the type of 'files', since 'for-each' will >> do that. Also, () is a list but not a pair. >> >> * Maybe use 'progn' instead of 'let ()' ? >> >> * Instead of launching a separate emacs process for each file, how about >> passing the list of filenames into emacs and do the loop within emacs >> itself? > > I totally agree with these comments. However since the goal is to > compile all elisp files in some directory, perhaps we may just use > 'byte-recompile-directory' instead of looping 'byte-compile-file'. > > Also I think there is a problem. An emacs package can require other > packages, so for a successful compiling, 'load-path' should be augmented > not only with the directory of the original package, but with the > directories of the required packages as well. Thanks for all the good suggestions. I will try to address them. Regards, Fede