unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bob Rogers <rogers@rgrjr.com>
To: Sebastian Miele <iota@whxvd.name>, Greg Minshall <minshall@umich.edu>
Cc: emacs-devel@gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: Re: Emacs script options
Date: Sat, 18 Nov 2023 21:04:11 -0800	[thread overview]
Message-ID: <25945.38731.648751.897766@orion.rgrjr.com> (raw)
In-Reply-To: <8734x2zwnc.fsf@whxvd.name>, <7094.1700336212@archlinux>

   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



  parent reply	other threads:[~2023-11-19  5:04 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18  3:13 (unknown) Greg Minshall
2023-11-18  7:05 ` (unknown) Jim Porter
2023-11-18 14:10   ` (unknown) -x behavior change Greg Minshall
2023-11-18  7:36 ` Emacs script options Eli Zaretskii
2023-11-18 14:38   ` Greg Minshall
2023-11-18 16:20     ` Eli Zaretskii
2023-11-18 19:36       ` Greg Minshall
2023-11-19  5:55         ` Eli Zaretskii
2023-11-27  3:29   ` Greg Minshall
2023-11-27 12:59     ` Eli Zaretskii
2023-11-27 19:32       ` Greg Minshall
2023-11-18 19:18 ` Sebastian Miele
2023-11-18 19:49   ` Greg Minshall
2023-11-19 21:39     ` Jens Schmidt
2023-11-19 21:47       ` Jens Schmidt
2023-11-20  1:19         ` Greg Minshall
2023-11-21 21:13           ` Jens Schmidt
2023-11-22 18:17             ` Sebastian Miele
2023-11-22 20:18               ` Jens Schmidt
2023-11-24  4:22             ` Greg Minshall
2023-11-26 18:07               ` Jens Schmidt
2023-11-20  6:10         ` Sebastian Miele
2023-11-20 20:10           ` Jens Schmidt
2023-11-21  8:51             ` Sebastian Miele
2023-11-19  5:04   ` Bob Rogers [this message]
2023-11-19  6:21     ` Eli Zaretskii

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=25945.38731.648751.897766@orion.rgrjr.com \
    --to=rogers@rgrjr.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=iota@whxvd.name \
    --cc=minshall@umich.edu \
    /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.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).