[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Emacs script options
From: |
Bob Rogers |
Subject: |
Re: Emacs script options |
Date: |
Sat, 18 Nov 2023 21:04:11 -0800 |
From: Sebastian Miele <iota@whxvd.name>
Date: Sat, 18 Nov 2023 20:18:00 +0100
> From: Greg Minshall <minshall@umich.edu>
> Date: Fri, 2023-11-17 19:13 -0800
. . .
> the below patch to src/emacs.c (**) treats a "-x" (and its "partner"
> "-scripteval") like a "--" on the command line, and *seems* to allow
> arbitrary options on the command line. for example, with this patch
> installed:
>
> ----
> % ./foo.sh --eval
> command-line-args-left (--eval)
> ----
On Linux that can be achieved by defining a custom interpreter . . .
However, the workaround is not possible on at least some non-Linux
systems, because not all systems allow something interpreted as an
interpreter in a shebang, see
https://en.wikipedia.org/wiki/Shebang_(Unix)#Syntax.
A more portable option might be for emacs itself to change its startup
behavior if invoked under a special name. For example, if you used an
"emacscript" alias, emacs would assume "--batch --load" and defer the
rest of its argument processing to the script. That would make life
easy on Unix-like systems. And you could just do
emacscript script-name.el ...
on non-Unix systems.
================
From: Greg Minshall <minshall@umich.edu>
Date: Sat, 18 Nov 2023 11:36:52 -0800
. . .
i'd like the users (hah!) to be able to type
----
./random-script -d --base-dir ${PWD}/foo
----
rather than
----
./random-script -- -d --base-dir ${PWD}/foo
----
cheers, Greg
(truth in advertising: in addition to this *application*, i also -- for
this application, really -- wrote some emacs-getopt package that would
probably benefit from such a facility.)
I am reminded of the emacs-lisp email server I wrote 30 years ago
. . . it ran for about 8 years. "emacs --batch" on steroids. ;-}
-- Bob