From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: indent with emacs batch mode Date: Thu, 12 Jan 2017 15:01:38 +0100 Message-ID: <8760lk5qd9.fsf@gnu.org> References: <87y3yocil2.fsf@elephly.net> <87inpr8l6y.fsf@gmail.com> <87shovcowr.fsf@elephly.net> <87zij11xue.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cRfwo-0002fg-TF for guix-devel@gnu.org; Thu, 12 Jan 2017 09:01:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cRfwk-0000kl-24 for guix-devel@gnu.org; Thu, 12 Jan 2017 09:01:46 -0500 In-Reply-To: <87zij11xue.fsf@gmail.com> (Alex Kost's message of "Sun, 08 Jan 2017 16:32:25 +0300") 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" To: Alex Kost Cc: guix-devel Alex Kost skribis: > Ricardo Wurmus (2017-01-07 08:25 +0100) wrote: > >> Alex Kost wrote: >> >>> All that stuff can work without 'emacs-guix' (if the line with >>> 'guix-devel-mode' scheme hook will be removed), but in this case the >>> package may not be indented properly. >> >> Guix still comes with a =E2=80=9C.dir-locals.el=E2=80=9D that specifies = the indentation >> rules, doesn=E2=80=99t it? Can we use that? > > Oof, it took me some time to figure it out :-) > > So here is the version that requires only emacs and ".dir-locals.el" > file from the git repo: > > ;; Load Scheme indentation rules from "~/src/guix/.dir-locals.el". > (with-temp-buffer > (scheme-mode) > (let ((default-directory (file-name-as-directory "~/src/guix")) > (enable-local-variables :all)) > (hack-dir-local-variables) > (hack-local-variables-apply))) > > (pcase command-line-args-left > (`(,file-name ,package-name) > (find-file file-name) > (goto-char (point-min)) > (if (re-search-forward (concat "^(define\\(-public\\) +" > package-name) > nil t) > (progn > (beginning-of-defun) > (indent-sexp) > (save-buffer) > (message "Done!")) > (error "Package '%s' not found in '%s'" > package-name file-name)))) > > > Emacs can be run like this: > > emacs -Q --batch -l indent-package-expr.el package-file.scm package-name I=E2=80=99ve pushed it as 7bb2b10cd01a076d7d5e964ed433e62846042859 along wi= th some doc. Thanks! Ludo=E2=80=99.