* bug#25670: Feature request: ignore --help in --script mode
@ 2017-02-09 21:00 Clément Pit--Claudel
2017-02-10 4:40 ` Glenn Morris
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Clément Pit--Claudel @ 2017-02-09 21:00 UTC (permalink / raw)
To: 25670
[-- Attachment #1.1: Type: text/plain, Size: 619 bytes --]
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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-09 21:00 bug#25670: Feature request: ignore --help in --script mode Clément Pit--Claudel
@ 2017-02-10 4:40 ` Glenn Morris
2017-02-10 15:05 ` Ted Zlatanov
2017-02-18 9:59 ` Eli Zaretskii
2 siblings, 0 replies; 9+ messages in thread
From: Glenn Morris @ 2017-02-10 4:40 UTC (permalink / raw)
To: Clément Pit--Claudel; +Cc: 25670
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-09 21:00 bug#25670: Feature request: ignore --help in --script mode Clément Pit--Claudel
2017-02-10 4:40 ` Glenn Morris
@ 2017-02-10 15:05 ` Ted Zlatanov
2017-02-10 16:52 ` Clément Pit--Claudel
2017-02-18 9:59 ` Eli Zaretskii
2 siblings, 1 reply; 9+ messages in thread
From: Ted Zlatanov @ 2017-02-10 15:05 UTC (permalink / raw)
To: Clément Pit--Claudel; +Cc: 25670
On Thu, 9 Feb 2017 16:00:59 -0500 Clément Pit--Claudel <clement.pitclaudel@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
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-10 15:05 ` Ted Zlatanov
@ 2017-02-10 16:52 ` Clément Pit--Claudel
2017-02-10 17:36 ` Glenn Morris
0 siblings, 1 reply; 9+ messages in thread
From: Clément Pit--Claudel @ 2017-02-10 16:52 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: 25670-done
[-- Attachment #1.1: Type: text/plain, Size: 691 bytes --]
On 2017-02-10 10:05, Ted Zlatanov wrote:
> On Thu, 9 Feb 2017 16:00:59 -0500 Clément Pit--Claudel <clement.pitclaudel@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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-10 16:52 ` Clément Pit--Claudel
@ 2017-02-10 17:36 ` Glenn Morris
2017-02-10 20:23 ` Clément Pit--Claudel
0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2017-02-10 17:36 UTC (permalink / raw)
To: 25670; +Cc: clement.pitclaudel
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-10 17:36 ` Glenn Morris
@ 2017-02-10 20:23 ` Clément Pit--Claudel
0 siblings, 0 replies; 9+ messages in thread
From: Clément Pit--Claudel @ 2017-02-10 20:23 UTC (permalink / raw)
To: Glenn Morris, 25670
[-- Attachment #1.1: Type: text/plain, Size: 636 bytes --]
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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-09 21:00 bug#25670: Feature request: ignore --help in --script mode Clément Pit--Claudel
2017-02-10 4:40 ` Glenn Morris
2017-02-10 15:05 ` Ted Zlatanov
@ 2017-02-18 9:59 ` Eli Zaretskii
2017-02-18 13:46 ` Clément Pit--Claudel
2 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2017-02-18 9:59 UTC (permalink / raw)
To: Clément Pit--Claudel; +Cc: 25670
> From: Clément Pit--Claudel <clement.pitclaudel@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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-18 9:59 ` Eli Zaretskii
@ 2017-02-18 13:46 ` Clément Pit--Claudel
2017-02-18 14:18 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Clément Pit--Claudel @ 2017-02-18 13:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 25670
[-- Attachment #1.1: Type: text/plain, Size: 559 bytes --]
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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#25670: Feature request: ignore --help in --script mode
2017-02-18 13:46 ` Clément Pit--Claudel
@ 2017-02-18 14:18 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2017-02-18 14:18 UTC (permalink / raw)
To: Clément Pit--Claudel; +Cc: 25670
> Cc: 25670@debbugs.gnu.org
> From: Clément Pit--Claudel <clement.pitclaudel@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.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-02-18 14:18 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09 21:00 bug#25670: Feature request: ignore --help in --script mode Clément Pit--Claudel
2017-02-10 4:40 ` Glenn Morris
2017-02-10 15:05 ` Ted Zlatanov
2017-02-10 16:52 ` Clément Pit--Claudel
2017-02-10 17:36 ` Glenn Morris
2017-02-10 20:23 ` Clément Pit--Claudel
2017-02-18 9:59 ` Eli Zaretskii
2017-02-18 13:46 ` Clément Pit--Claudel
2017-02-18 14:18 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.