* shell-script goofy indentation
@ 2004-11-28 4:31 Dan Jacobson
[not found] ` <E1CZ22p-0003uH-1A@fencepost.gnu.org>
0 siblings, 1 reply; 4+ messages in thread
From: Dan Jacobson @ 2004-11-28 4:31 UTC (permalink / raw)
What's up with this goofy indentation in shell-script mode?
Hit TAB on each line.
#!/bin/sh
if mla
then pla
else bla
fi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: shell-script goofy indentation
[not found] ` <E1CZ22p-0003uH-1A@fencepost.gnu.org>
@ 2004-11-30 23:01 ` Dan Jacobson
[not found] ` <mailman.2640.1101880616.27204.bug-gnu-emacs@gnu.org>
1 sibling, 0 replies; 4+ messages in thread
From: Dan Jacobson @ 2004-11-30 23:01 UTC (permalink / raw)
rms> I tried it, and the indentation did not change. Is that a bug?
Well shouldn't the then and the else be at the same indentation?
Wait, more challenges, hit TAB on each line (which shouldn't change
anything, as I have already hit TAB there)
if a
then b
elif c
then g
fi
The above makes more sense than the else case. However what really
"boils" me is when one hits TAB on the third line of
if e
then h
<----
the cursor is indeed now sitting right below the t of then,
but then enter the word else and hit TAB. It slides back to column 1.
Oh, I see, I have encountered different people's indenting styles and
not a bug. I see, I can do
(setq sh-indent-for-else sh-indent-for-then)
Looks good, but only on four-liners. OK, if I only write in the
multi-liner style, I won't feel as bad.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: shell-script goofy indentation
[not found] ` <mailman.2640.1101880616.27204.bug-gnu-emacs@gnu.org>
@ 2004-12-01 18:17 ` Jari Aalto
2004-12-01 19:13 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Jari Aalto @ 2004-12-01 18:17 UTC (permalink / raw)
Dan Jacobson <jidanni@jidanni.org> writes:
| rms> I tried it, and the indentation did not change. Is that a bug?
|
| Well shouldn't the then and the else be at the same indentation?
|
| Wait, more challenges, hit TAB on each line (which shouldn't change
| anything, as I have already hit TAB there)
| if a
| then b
| elif c
| then g
| fi
I think the sh-mode is programmed to expect constructs like this:
if a ; then
b
elif c ; then
g
fi
Or like this for longish "a" and "c" conditions:
if a
then
b
elif c
then
g
fi
Jari
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: shell-script goofy indentation
[not found] ` <mailman.2640.1101880616.27204.bug-gnu-emacs@gnu.org>
2004-12-01 18:17 ` Jari Aalto
@ 2004-12-01 19:13 ` Stefan Monnier
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2004-12-01 19:13 UTC (permalink / raw)
> (setq sh-indent-for-else sh-indent-for-then)
You want (setq sh-indent-for-then 0)
That's what I use anyway, so that I can write
if foo
then bar
else baz
fi
I always found the default value of sh-indent-for-then (i.e. `+') to be
at best unnatural.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-12-01 19:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-28 4:31 shell-script goofy indentation Dan Jacobson
[not found] ` <E1CZ22p-0003uH-1A@fencepost.gnu.org>
2004-11-30 23:01 ` Dan Jacobson
[not found] ` <mailman.2640.1101880616.27204.bug-gnu-emacs@gnu.org>
2004-12-01 18:17 ` Jari Aalto
2004-12-01 19:13 ` Stefan Monnier
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.