• このエントリーをはてなブックマークに追加
  • このエントリをクリップ! このエントリをクリップ!

はじめに

現在使っているAquamacsなemacscperl-modeのインデント調整のメモ.

まだまだ微妙です.

before

my $a = {
         a => 1,
         b => 2,
         c => {
               s => 10,
               t => 20,
              },
         d => [
               100,
               200,
               300,
              ],
        };
 
sub hogehoge {
  my ($x, $y) = @_;
  ($y, $x);
}
 
sub fugafuga {
  my $param = {@_};
 
  if ($param->{foo}) {
    return undef;
  }
  else {
    return 'hoge';
  }
}
 
hogehoge(
         'foo',
         'bar',
        );
 
fugafuga(
         foo => [
                 qw/xxx
                    yyy
                    zzz
                   /,
                ],
         bar => [
                 qw/
                     aaa
                     bbb
                     ccc
                   /
                ],
         baz => {
                 xxx => 1,
                 yyy => 2,
                 zzz => 3,
                },
        );
 
my @a = map {
  $_ . $_;
}
  qw/a b c d e/;
 
my @b = map {
  $_ . $_;
} qw/a b c d e/;
 
my $c = [
         map {
           $_ . $_;
         }
         qw/a b c d e/
        ];
 
$a->{a} = 2
  if $a->{a};
 
(my $s = 'hogehogefugafuga') =~ s{
                                   g[ae]
                               }{
xx
}gx;
(my $t = 'fugafugapiyopiyo') =~ s/
                                   ga
                                 /
xx
/gx;

after

my $a = {
    a => 1,
    b => 2,
    c => {
        s => 10,
        t => 20,
    },
    d => [
        100,
        200,
        300,
    ],
};
 
sub hogehoge {
    my ($x, $y) = @_;
    ($y, $x);
}
 
sub fugafuga {
    my $param = {@_};
 
    if ($param->{foo}) {
        return undef;
    }
    else {
        return 'hoge';
    }
}
 
hogehoge(
    'foo',
    'bar',
);
 
fugafuga(
    foo => [
        qw/xxx
           yyy
           zzz
          /,
    ],
    bar => [
        qw/
              aaa
              bbb
              ccc
          /
      ],
    baz => {
        xxx => 1,
        yyy => 2,
        zzz => 3,
    },
);
 
my @a = map {
    $_ . $_;
}
    qw/a b c d e/;
 
my @b = map {
    $_ . $_;
} qw/a b c d e/;
 
my $c = [
    map {
        $_ . $_;
    }
        qw/a b c d e/
    ];
 
$a->{a} = 2
    if $a->{a};
 
(my $s = 'hogehogefugafuga') =~ s{
                                     g[ae]
                             }{
xx
}gx;
(my $t = 'fugafugapiyopiyo') =~ s/
                                     ga
                                 /
xx
/gx;

変更内容

「Aquamacs」メニュー内の「Preferences…」を呼び出し,現れたバッファで

'Programming' group
> 'Languages' group
> 'Cperl' group
> 'Cperl Indentation Details' group

と下ったところの内容のうち,次のように変更しました.

before

Cperl Indent Level: 2
Cperl Continued Statement Offset: 2
Cperl Close Paren Offset: -1
Cperl Indent Region Fix Constructs: nil
Cperl Indent Parens As Block: off(nil)

after

Cperl Indent Level: 4
Cperl Continued Statement Offset: 4
Cperl Close Paren Offset: -4
Cperl Indent Region Fix Constructs: 1
Cperl Indent Parens As Block: on(non-nil)

ついでに

'Programming' group
> 'Languages' group
> 'Cperl' group
> 'Cperl Autoinsert Details' group

before

Cperl Autoindent On Semi: off(nil)

after

Cperl Autoindent On Semi: on(non-nil)

おわりに

まだまだ微妙です.

ちなみに,Preferencesで設定した内容はどこに保存されているのでしょうかね.

3 Responses to “[emacs][perl] cperl-modeでのインデント調整メモ”

  1. clairvy より:

    > ちなみに,Preferencesで設定した内容はどこに保存されているのでしょうかね.

    普通は,.emacs の末尾に追加されてると思うよ!

  2. issm より:

    @clairvy

    と思って確認してみたんですが,それらしい表記が見あたらないのです...

  3. u より:

    custom-file という変数にファイル名がはいってますよ

コメントをドウゾ

will not be published.

  • twitter
  • facebook
  • github
  • hatena bookmark
  • SlideShare
  • flickr
  • foursquare
  • ustream
  • tumblr
  • friendfeed
  • mixi
  • Apple
  • WordPress
  • come icons are powered by komodomedia!