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

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

Re: Shell-script[bash] indention broken (or fixed?)


From: Glenn Morris
Subject: Re: Shell-script[bash] indention broken (or fixed?)
Date: Sun, 12 Jun 2005 12:19:34 +0100
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Richard Stallman wrote:

>     Until recently the behavior of Shell-script[bash] mode was to
>     not indent the second of the following two lines when tab was hit:
>
>     export VARIABLE=/path/to/here\
>     :/path/to/there
>
>     Now it indents it like this:
>
>     export VARIABLE=/path/to/here\
>       :/path/to/there
>
> I loaded a version of sh-script.el from September and it gave the
> latter result.  So this is not, I believe, the result of a recent
> change.

For the record, the behaviour is the same in Emacs-21.3 as well. I
don't recall ever seeing the former result. It seems to have worked
the way it does now for >~ 5 years.

> I am surprised by the existence of sh-indent-for-continuation. In
> shell syntax, are spaces after backslash-newline ignored? I did an
> experiment and they do not seem to be ignored.

They are not ignored.

> That being so, isn't it simply an error to reindent the continuation
> line?

Sometimes (as in this case) yes, but most of the time (for the shell
scripts I write) no. My continuation lines tend to look like:

command_with_a_lot_of_arguments arg1 arg2 arg3 arg4 \
     arg5 arg6...

or:

command1 && \
     command2


Personally, I like and find useful the indentation of the continued
lines. It's almost never inappropriate (for me); though one could even
write weird things like:

this_is_a_single_\
command_name


which should not be indented. There's no way to tell whether
indentation of a continued line is wrong, so it's a question of what
the default should be. I vote for the current arrangement.




reply via email to

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