bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31220: 25.3; emacs --script breaks command-line arguments handling


From: Eli Zaretskii
Subject: 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@orcon.net.nz>
> Cc: 31220@debbugs.gnu.org,
>       bug-gnu-emacs <bug-gnu-emacs-bounces+psainty=orcon.net.nz@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]