🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: fj.editor.emacs
3 messages
3 total messages Started by NIDE Naoyuki Tue, 02 Jun 2009 13:34
Indentation of case statement in sh-script mode
#632
Author: NIDE Naoyuki
Date: Tue, 02 Jun 2009 13:34
22 lines
1575 bytes
  新出@奈良女子大学です。
  どなたか、sh-scriptモードでcase文を

case word in
pattern)	# labelはインデントしない
    list;;	# 本体は1レベル分インデント
esac

のようにする方法をご教授下さい。

(setq-default sh-indent-for-case-label 0)
(setq-default sh-indent-for-case-alt '+)

というのを試してみたのですが、これは期待の動作にならず

case word in
pattern)
list;;		# 全然インデントされない…
esac

のようになってしまいます。
						nide@ics.nara-wu.ac.jp
Re: Indentation of case statement in sh-script mode
#633
Author: Katsumi Yamaoka
Date: Tue, 02 Jun 2009 23:29
39 lines
2428 bytes
>>>>> 新出さん wrote:
>   どなたか、sh-scriptモードでcase文を

> case word in
> pattern)	# labelはインデントしない
>     list;;	# 本体は1レベル分インデント
> esac

> のようにする方法をご教授下さい。

> (setq-default sh-indent-for-case-label 0)
> (setq-default sh-indent-for-case-alt '+)

> というのを試してみたのですが、これは期待の動作にならず

> case word in
> pattern)
> list;;		# 全然インデントされない…
> esac

> のようになってしまいます。

Emacs 22 以下ではだめのようですね。まだ pretest 中の Emacs 23 を
使いたくなければ、23 に付属している sh-script.el を 22 で使うこ
とはできます。Emacs 21 では、ちょっといじっただけではうまくいき
ませんでした。以下の場所に 23 の sh-script.el を置いておきます。

ftp://ftp.jpl.org/pub/tmp/sh-script-23.0.94.el.gz

これを Emacs 22 で使うには、次のようにコンパイルしてください:

$ gunzip --name sh-script-23.0.94.el.gz
$ emacs -batch -eval '(defmacro characterp (form) (list (quote numberp) form))' -f batch-byte-compile sh-script.el

;; characterp は Emacs 23 から登場した built-in 関数です。
;; 関係無いですが、大昔の egg.el や wnn7egg.el を使うと、そこに
;; ある同名の関数が上書きしてしまいます。
-- 
山岡
Re: Indentation of case statement in sh-script mode
#634
Author: NIDE Naoyuki
Date: Wed, 03 Jun 2009 09:27
13 lines
1896 bytes
  新出@奈良女子大学です。

In article <b4md49mrz8q.fsf@jpl.org>, yamaoka@jpl.org writes:
> Emacs 22 以下ではだめのようですね。まだ pretest 中の Emacs 23 を
> 使いたくなければ、23 に付属している sh-script.el を 22 で使うこ
> とはできます。…

  ありがとうございます。あいにく最近すっかり軟弱化して、OSのパッケージで
提供されているものより新しいものにはよほどのことがない限り手を出さなくなっ
てしまったので、身の回りがEmacs 21ばかりの現在ではとりあえず打つ手はなさ
そうです。Emacs 22以上に移る日を楽しみにしておきます。

						nide@ics.nara-wu.ac.jp
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads