GNU bug report logs -
#25670
Feature request: ignore --help in --script mode
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25670 in the body.
You can then email your comments to 25670 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Thu, 09 Feb 2017 21:02:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Clément Pit--Claudel <clement.pitclaudel <at> live.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 09 Feb 2017 21:02:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi bug-gnu-emacs,
Event with --script, Emacs still displays its help when passed --help. This is confusing for users (they might write emacs --script some-script.el --help expecting to get help on the script, but instead they get Emacs' help), and it force ELisp scripts to use --usage or some other harder-to-guess synonym.
Could this be changed so that emacs --script a.el --help does not show Emacs' help?
More generally, could we guarantee that options that appear *after* "--script" aren't processed by Emacs itself (and instead left to the script)? Or would that break things?
Thanks!
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Fri, 10 Feb 2017 04:41:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 25670 <at> debbugs.gnu.org (full text, mbox):
AFAICS a simple shell-script wrapper removes the need for --script
altogether, so it's hard to get motivated to improve it. Eg
#!/bin/sh
... --help parsing goes here ...
exec emacs -batch -l script.el
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Fri, 10 Feb 2017 15:06:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 25670 <at> debbugs.gnu.org (full text, mbox):
On Thu, 9 Feb 2017 16:00:59 -0500 Clément Pit--Claudel <clement.pitclaudel <at> live.com> wrote:
CP> More generally, could we guarantee that options that appear *after* "--script" aren't processed by Emacs itself (and instead left to the script)? Or would that break things?
Typically I've seen "--" used to indicate the end of parseable options.
Would it help?
If so, I think it makes sense to support that in Emacs. There may be
other future uses of it besides scripting.
Ted
Reply sent
to
Clément Pit--Claudel <clement.pitclaudel <at> live.com>
:
You have taken responsibility.
(Fri, 10 Feb 2017 16:54:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Clément Pit--Claudel <clement.pitclaudel <at> live.com>
:
bug acknowledged by developer.
(Fri, 10 Feb 2017 16:54:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 25670-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2017-02-10 10:05, Ted Zlatanov wrote:
> On Thu, 9 Feb 2017 16:00:59 -0500 Clément Pit--Claudel <clement.pitclaudel <at> live.com> wrote:
>
> CP> More generally, could we guarantee that options that appear *after* "--script" aren't processed by Emacs itself (and instead left to the script)? Or would that break things?
>
> Typically I've seen "--" used to indicate the end of parseable options.
> Would it help?
Yes! And in fact it seems to work :) Neat.
$ emacs -Q --batch --eval '(print argv)' -- --help
("--" "--help")
I see now that it was mentioned in http://www.lunaryorn.com/posts/emacs-script-pitfalls.html. Not sure how I missed it.
Thanks Ted!
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Fri, 10 Feb 2017 17:37:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 25670 <at> debbugs.gnu.org (full text, mbox):
Clément Pit--Claudel wrote:
> $ emacs -Q --batch --eval '(print argv)' -- --help
> ("--" "--help")
If you can train your users to insert -- before --help, you could get
them to use any other flag for help. And if you are inserting the -- for
them, you are already using a wrapper.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Fri, 10 Feb 2017 20:25:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 25670 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2017-02-10 12:36, Glenn Morris wrote:
> Clément Pit--Claudel wrote:
>
>> $ emacs -Q --batch --eval '(print argv)' -- --help
>> ("--" "--help")
>
> If you can train your users to insert -- before --help, you could get
> them to use any other flag for help. And if you are inserting the -- for
> them, you are already using a wrapper.
I'm using this as my header:
#!/bin/sh
":"; exec emacs -Q --script "$0" -- "$@" # -*- mode: emacs-lisp; lexical-binding: t; -*-
I don't understand the wrapper point: I want to do the argument parsing in ELisp, not in bash. Did I misunderstand your suggestion?
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Sat, 18 Feb 2017 09:59:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 25670 <at> debbugs.gnu.org (full text, mbox):
> From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
> Date: Thu, 9 Feb 2017 16:00:59 -0500
>
> Event with --script, Emacs still displays its help when passed --help. This is confusing for users (they might write emacs --script some-script.el --help expecting to get help on the script, but instead they get Emacs' help), and it force ELisp scripts to use --usage or some other harder-to-guess synonym.
>
> Could this be changed so that emacs --script a.el --help does not show Emacs' help?
What should be done with --help in that case?
(In general, I'd expect such script not to use --help or --version at
all.)
> More generally, could we guarantee that options that appear *after* "--script" aren't processed by Emacs itself (and instead left to the script)? Or would that break things?
Which other options should be processed when --script is given? Are
there any requirements for what command-line-args-left should have
when the script is loaded?
IOW, it is not clear to me what are the expectations in this use case.
Please take a look at how the command-line arguments are processed at
startup, in emacs.c and in startup.el, and make a more detailed
proposal. Then we could see if it's easy to implement without
potentially breaking anything.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Sat, 18 Feb 2017 13:47:01 GMT)
Full text and
rfc822 format available.
Message #28 received at 25670 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 2017-02-18 04:59, Eli Zaretskii wrote:
> IOW, it is not clear to me what are the expectations in this use case.
> Please take a look at how the command-line arguments are processed at
> startup, in emacs.c and in startup.el, and make a more detailed
> proposal. Then we could see if it's easy to implement without
> potentially breaking anything.
Ted's pointer to Emacs' support for "--" solved this problem for me: when I pass "--" before "--help", Emacs doesn't process "--". So I don't --script to be special-cased any more :)
Clément.
[signature.asc (application/pgp-signature, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25670
; Package
emacs
.
(Sat, 18 Feb 2017 14:18:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 25670 <at> debbugs.gnu.org (full text, mbox):
> Cc: 25670 <at> debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pitclaudel <at> live.com>
> Date: Sat, 18 Feb 2017 08:46:07 -0500
>
> Ted's pointer to Emacs' support for "--" solved this problem for me: when I pass "--" before "--help", Emacs doesn't process "--". So I don't --script to be special-cased any more :)
OK, thanks.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 19 Mar 2017 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 97 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.