GNU bug report logs - #31220
25.3; emacs --script breaks command-line arguments handling

Previous Next

Package: emacs;

Reported by: Thibault Polge <thibault <at> thb.lt>

Date: Thu, 19 Apr 2018 20:03:02 UTC

Severity: minor

Found in version 25.3

Done: Thibault Polge <thibault <at> thb.lt>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: thibault <at> thb.lt, 31220 <at> debbugs.gnu.org,
 bug-gnu-emacs-bounces+psainty=orcon.net.nz <at> gnu.org
Subject: Re: bug#31220: 25.3;
 emacs --script breaks command-line arguments handling
Date: Fri, 20 Apr 2018 09:42:32 +0300
> Date: Fri, 20 Apr 2018 11:26:04 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: 31220 <at> debbugs.gnu.org,
> 	bug-gnu-emacs <bug-gnu-emacs-bounces+psainty=orcon.net.nz <at> gnu.org>
> 
> As with many programs, you can use the argument '--' to tell Emacs not
> to process further arguments as if they were options. e.g.:
> 
> $ emacs --script -- --help
> 
> Which will pass '--' and '--help' to the script.
> 
> 
> Some boiler-plate for an elisp script is:
> 
> #!/bin/sh
> ":"; exec emacs -Q --script "$0" -- "$@" # -*-emacs-lisp-*-
> (pop argv) # Remove the "--" argument
> # ...
> # Always exit explicitly. This returns the desired exit
> # status, and also avoids the need to (setq argv nil).
> (kill-emacs 0)
> 
> 
> For more information see:
> 
> * https://stackoverflow.com/a/6259330/324105
> * https://swsnr.de/posts/emacs-script-pitfalls

See also bug#25670.




This bug report was last modified 7 years and 93 days ago.

Previous Next


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