Richard Stallman writes: > Would someone please DTRT and ack? This is not a must-fix bug, since > perfect indentation in Shell Script mode is too much to hope for, but > we should fix it if it isn't hard. > > From: Dan Jacobson > Subject: shell-script-mode case indenting > To: emacs-pretest-bug@gnu.org > Date: Thu, 21 Sep 2006 18:28:18 +0800 > X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=failed > version=3.0.4 > > Pressing TAB on each line in this file.sh produces the first line of > this case expression indented different than the rest: > (sed 's/.$/ &/'|while read route company; do case $company in > r)set ???? Renyou;; > z)set ???? Taizhong;; > q)set ???? Quanhang;; > j)set ???? Juye;; > t)set ???? Tonglian;; > *)echo $company: HUH? 1>&2;exit 55;; > esac; echo "[[????:???? ${1}???? - Operator $2 Bus Co.]]" \ > >> $route; done)< 001r > 005q > 006r > EOF The following patch attempts to take `sh-leading-keywords' into account when calculating (sh-prev-thing). This patch seems to work in this and a few other cases I played around with, but I make no guarantees that I haven't broken something along the way: