From: Thorsten Jolitz <tjolitz@googlemail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Batch execution and --script
Date: Wed, 29 Aug 2012 20:59:18 +0200 [thread overview]
Message-ID: <87d329sewp.fsf@googlemail.com> (raw)
In-Reply-To: CACHMzOGCPE0rtozs+oxXRdfvibrc-Sw4M9cigEq9PcL17iJnuA@mail.gmail.com
Marcelo de Moraes Serpa <celoserpa@gmail.com> writes:
Hi Marcelo,
> This is a subject that should be explored more. I see a lot of
> potential in having CLI .el scripts (i.e taking the emacs GUI out of
> the equation).
I once asked a related question on stackoverflow, and recieved this
answer that shows how to
- become more independent of the location of the emacs executable
- pass more than one argument on the shebang line
at the same time:
,-----------------------------------------------------------------------------
| Many unix variants only allow a single argument to the program on
| the shebang line. Sad, but true. If you use #!/usr/bin/env emacs so
| as not to depend on the location of the emacs executable, you can't
| pass an argument at all.
|
| Chaining scripts is a possibility on some systems, but that too is
| not supported everywhere.
|
| You can go the time-honored route of writing a script that is both
| a shell script and an Emacs Lisp script (like Perl's if
| $running_under_some_shell, for example). It sure looks hackish, but
| it works.
|
| Elisp comments begin with ;, which in the shell separates two
| up commands. So we can use a ; followed by a shell instruction to
| vote switch over to Emacs, with the actual Lisp code beginning on the
| 21 next line. Shells don't like an empty command though, so we need to
| down find something that both the shell and Emacs treat as a no-op, so
| vote put before the ;. The shell no-op command is :; you can write it
| ":" as far as the shell is concerned, and Emacs parses that as a
| constant at top level which is also a no-op.
|
| #! /bin/sh
| ":"; exec emacs --no-site-file --script "$0" -- "$@" # -*-emacs-lisp-*-
| (print (+ 2 2))
`-----------------------------------------------------------------------------
Maybe thats interesting for you. The full question is here:
http://stackoverflow.com/questions/6238331/emacs-shell-scripts-how-to-put-initial-options-into-the-script
--
cheers,
Thorsten
next prev parent reply other threads:[~2012-08-29 18:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 15:47 Batch execution and --script Marcelo de Moraes Serpa
2012-08-29 16:42 ` Nick Daly
2012-08-29 17:50 ` Marcelo de Moraes Serpa
2012-08-30 5:34 ` Bastien
2012-11-28 2:18 ` Bernt Hansen
2012-12-04 14:25 ` Bastien
2012-08-29 18:29 ` Nick Dokos
2012-08-29 18:35 ` Marcelo de Moraes Serpa
2012-08-29 18:59 ` Thorsten Jolitz [this message]
2012-08-29 19:13 ` Nick Dokos
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d329sewp.fsf@googlemail.com \
--to=tjolitz@googlemail.com \
--cc=emacs-orgmode@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.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).