unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Limiting init loading when running --batch
Date: Thu, 05 Mar 2015 05:16:16 +0100	[thread overview]
Message-ID: <877fuw6pv3.fsf@debian.uxu> (raw)
In-Reply-To: mailman.1357.1425526443.31049.help-gnu-emacs@gnu.org

torys.anderson@gmail.com (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 "
          (progn
            (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	other threads:[~2015-03-05  4:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1357.1425526443.31049.help-gnu-emacs@gnu.org>
2015-03-05  4:16 ` Emanuel Berg [this message]
2015-03-05  3:33 Limiting init loading when running --batch Tory S. Anderson
2015-03-05  3:59 ` Drew Adams
2015-03-05  4:00   ` Drew Adams

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=877fuw6pv3.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).