[Top][All Lists]

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

Re: Limiting init loading when running --batch

From: Emanuel Berg
Subject: Re: Limiting init loading when running --batch
Date: Thu, 05 Mar 2015 05:16:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) (Tory S. Anderson) writes:

> I use --batch as part of a shell script to export my
> orgmode agenda as an ICS file and upload it to a
> server where it is read by Google Calendar. But when
> I run batch, it loads my entire emacs (most of which
> is not necessary for this operation) and sometimes
> chokes on lines that are apparently incompatible. Is
> there a way to avoid loading the whole init file, or
> to prepend lines with something that would except
> them from batch runs?

Yes, check out the man page how to not load the init
file. It can be done with either -q or -Q. Then use -l
to load another file that you prefer for this
operation, if you need one. There are many things you
can do, but the man page is a good start.

Here is an example of a function that takes a file as
input, executes some Elisp commands on it, then sends
the result to another program. Something similar is
what you will do, only different :)

    justify () {
        local file=$1
        emacs --batch --eval "
            (find-file \"$file\")
            (setq fill-column 54)
            (fill-region (point-min) (point-max) 'full)
            (princ (buffer-string))
            (kill-buffer) )" 2> /dev/null \
                | pr --indent=8 -w 62 -l 68

underground experts united

reply via email to

[Prev in Thread] Current Thread [Next in Thread]