[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: Formatting Lisp code from the command line (was: First impressions of the specification)

This page is part of the web mail archives of SRFI 110 from before July 7th, 2015. The new archives for SRFI 110 contain all messages, not just those from before July 7th, 2015.



On Sat, Mar 30, 2013 at 2:13 PM, John Cowan <cowan@xxxxxxxxxxxxxxxx> wrote:
Mark H Weaver scripsit:

> Those of us who use Emacs don't have to figure out what to line up,
> because it simply does it for us. ÂThis is how the vast majority of
> Schemers write code.

I don't, but I would like to be able to run my code through the Emacs
formatter for publication purposes. ÂDoes anyone know how to do this
from the command line? ÂI do have Emacs installed.

emacs --batch FOO.scm --eval '(indent-region (point-min) (point-max))' -f 'save-buffer'Â

Argument order is important.
See http://stackoverflow.com/a/9825272/239657 for multi-file version, or just use a bash loop.Â

One indentation quirk that might surprise you is comment-only lines indented to far right.
Emacs uses convention of:
Â; comment on right, even on comment-only line.
Â;; comment indented as code.
Â;;; comment in column 0, even in middle of code.