[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Syntax of "-" in shell-mode
From: |
Drew Adams |
Subject: |
RE: Syntax of "-" in shell-mode |
Date: |
Fri, 24 Jun 2016 14:11:38 -0700 (PDT) |
> >> Hi. What do people think about giving "-" a syntax of "word" in
> >> shell-mode? The rationale is that in this mode one is generally editing
> >> shell commands where "-" precedes commandline options, and strings such
> >> as "--help" generally represent a single semantic token.
> >>
> >> More specifically if I have something like "xxx --yyy" with the point in
> >> the whitespace, and I invoke (transpose-words) I want the result to be
> >> "--yyy xxx" and not "yyy --xxx". The latter means something very
> >> different in a shell command.
> >
> > Maybe not so simple. A shell command can involve lots of stuff,
> > including arguments to commands that use their own syntax (think
> > `find').
>
> Of course the true syntax depends on context, but in my experience, in
> shell commands "-" is a word far more often than it isn't.
One thing that could perhaps be done is to set the `syntax-table'
text property on the zone of text up through the last switch.
You might try it.