From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Limiting init loading when running --batch Date: Thu, 05 Mar 2015 05:16:16 +0100 Organization: Aioe.org NNTP Server Message-ID: <877fuw6pv3.fsf@debian.uxu> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1425528921 18899 80.91.229.3 (5 Mar 2015 04:15:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Mar 2015 04:15:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 05 05:15:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YTNBu-0004e5-SL for geh-help-gnu-emacs@m.gmane.org; Thu, 05 Mar 2015 05:15:19 +0100 Original-Received: from localhost ([::1]:48047 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTNBt-00045s-RQ for geh-help-gnu-emacs@m.gmane.org; Wed, 04 Mar 2015 23:15:17 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:ggdpdPeKceKeUbdcEysIuCcRJf0= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:210751 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103029 Archived-At: 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