all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Alex Kost <alezost@gmail.com>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: indent with emacs batch mode
Date: Thu, 12 Jan 2017 15:01:38 +0100	[thread overview]
Message-ID: <8760lk5qd9.fsf@gnu.org> (raw)
In-Reply-To: <87zij11xue.fsf@gmail.com> (Alex Kost's message of "Sun, 08 Jan 2017 16:32:25 +0300")

Alex Kost <alezost@gmail.com> 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 “.dir-locals.el” that specifies the indentation
>> rules, doesn’t 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’ve pushed it as 7bb2b10cd01a076d7d5e964ed433e62846042859 along with
some doc.

Thanks!

Ludo’.

  reply	other threads:[~2017-01-12 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-06 15:29 indent with emacs batch mode Ricardo Wurmus
2017-01-07  5:59 ` Alex Kost
2017-01-07  7:25   ` Ricardo Wurmus
2017-01-08 13:32     ` Alex Kost
2017-01-12 14:01       ` Ludovic Courtès [this message]
2017-05-28 16:54         ` Andreas Enge
2017-01-07 21:17   ` Ludovic Courtès
2017-01-07 21:21     ` Ricardo Wurmus
2017-01-08 13:48       ` Alex Kost

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

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

  git send-email \
    --in-reply-to=8760lk5qd9.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=alezost@gmail.com \
    --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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.