GNU bug report logs - #25671
Feature request: emacs -Q --script as a single binary

Previous Next

Package: emacs;

Reported by: Clément Pit--Claudel <clement.pitclaudel <at> live.com>

Date: Thu, 9 Feb 2017 21:16:01 UTC

Severity: wishlist

Merged with 20682

Found in version 25.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Feature request: emacs -Q --script as a single binary
Date: Thu, 9 Feb 2017 16:14:41 -0500
[Message part 1 (text/plain, inline)]
Hi bug-gnu-emacs,

Since version 22 Emacs lets scripts begin with a shebang line:

  #!/usr/bin/emacs --script
  ;; Some ELisp code here

This breaks if Emacs isn't installed in /usr/bin, though.  Thus, one would want to write this:

  #!/usr/bin/env emacs --script
  ;; Some ELisp code here

But this doesn't work (env doesn't split its arguments), and it also breaks even if one is happy with hardcoding /usr/bin/emacs but tries to pass more than one argument (think -Q and --script).  Thus one writes this:

  #!/bin/sh
  ":"; exec emacs -Q --script "$0" "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-

(See http://stackoverflow.com/questions/6238331/emacs-shell-scripts-how-to-put-initial-options-into-the-script/6259330#6259330)

This isn't pretty.  Could we set up emacs to assume --script and possibly -Q when started as "elisp", or "emacs-script", or some other name (that is, could we make it so that invoking emacs with argv[0] = ".../elisp" starts emacs -Q --script)? (And ideally Emacs would ignore all options after the script's name, to let the script itself process them).

Thanks!
Clément.

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 3 years and 19 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.