* Re: Limiting init loading when running --batch
[not found] <mailman.1357.1425526443.31049.help-gnu-emacs@gnu.org>
@ 2015-03-05 4:16 ` Emanuel Berg
0 siblings, 0 replies; 4+ messages in thread
From: Emanuel Berg @ 2015-03-05 4:16 UTC (permalink / raw)
To: help-gnu-emacs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Limiting init loading when running --batch
@ 2015-03-05 3:33 Tory S. Anderson
2015-03-05 3:59 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Tory S. Anderson @ 2015-03-05 3:33 UTC (permalink / raw)
To: Emacs Help List
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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Limiting init loading when running --batch
2015-03-05 3:33 Tory S. Anderson
@ 2015-03-05 3:59 ` Drew Adams
2015-03-05 4:00 ` Drew Adams
0 siblings, 1 reply; 4+ messages in thread
From: Drew Adams @ 2015-03-05 3:59 UTC (permalink / raw)
To: torys.anderson, Emacs Help List
> 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?
You can test the variable `noninteractive' in your init file, and
load or invoke code conditionally, depending on the value.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Limiting init loading when running --batch
2015-03-05 3:59 ` Drew Adams
@ 2015-03-05 4:00 ` Drew Adams
0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2015-03-05 4:00 UTC (permalink / raw)
To: torys.anderson, Emacs Help List
> > 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?
>
> You can test the variable `noninteractive' in your init file, and
> load or invoke code conditionally, depending on the value.
http://www.gnu.org/software/emacs/manual/html_node/elisp/Batch-Mode.html
Which you can find by using `i' in the Elisp manual and typing `batch TAB'.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-05 4:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.1357.1425526443.31049.help-gnu-emacs@gnu.org>
2015-03-05 4:16 ` Limiting init loading when running --batch Emanuel Berg
2015-03-05 3:33 Tory S. Anderson
2015-03-05 3:59 ` Drew Adams
2015-03-05 4:00 ` Drew Adams
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).