-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprograms.texi
3896 lines (3506 loc) · 197 KB
/
programs.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@c =============================================================
@c = 元 翻 訳: 赤池英夫@電気通信大学
@c = 加筆修正: 大木敦雄@大塚.筑波大学 = 1998/11/25
@c = 20.4改訂: 大木敦雄@大塚.筑波大学 = 1999/09/12
@c =============================================================
@c This is part of the Emacs manual.
@c Copyright (C) 1985, 86, 87, 93, 94, 95, 1997 Free Software Foundation, Inc.
@c See file emacs.texi for copying conditions.
@node Programs, Building, Text, Top
@c @chapter Editing Programs
@chapter プログラムの編集
@c @cindex Lisp editing
@c @cindex C editing
@c @cindex program editing
@cindex Lispの編集
@cindex Cの編集
@cindex プログラムの編集
@c Emacs has many commands designed to understand the syntax of programming
@c languages such as Lisp and C. These commands can
Emacsには、LispやCといったプログラム言語の構文を
理解するように設計されたコマンドが数多くあります。
以下のことを行えます。
@itemize @bullet
@item
@c Move over or kill balanced expressions or @dfn{sexps} (@pxref{Lists}).
釣り合った式や@dfn{S式}(@pxref{Lists})を横断したりそれらをキルする。
@item
@c Move over or mark top-level expressions---@dfn{defuns}, in Lisp;
@c functions, in C (@pxref{Defuns}).
トップレベルの式、つまり、Lispの@dfn{defun}やCの関数(@pxref{Defuns})を
横断したりそれらにマークを設定する。
@item
@c Show how parentheses balance (@pxref{Matching}).
括弧の対応具合を表示する(@pxref{Matching})。
@item
@c Insert, kill or align comments (@pxref{Comments}).
コメントの挿入/キル/整列(@pxref{Comments})。
@item
@c Follow the usual indentation conventions of the language
@c (@pxref{Program Indent}).
使用言語の慣用的な字下げを踏襲する(@pxref{Program Indent})。
@end itemize
@c The commands for words, sentences and paragraphs are very useful in
@c editing code even though their canonical application is for editing
@c human language text. Most symbols contain words (@pxref{Words});
@c sentences can be found in strings and comments (@pxref{Sentences}).
@c Paragraphs per se don't exist in code, but the paragraph commands are
@c useful anyway, because programming language major modes define
@c paragraphs to begin and end at blank lines (@pxref{Paragraphs}).
@c Judicious use of blank lines to make the program clearer will also
@c provide useful chunks of text for the paragraph commands to work
@c on.
単語/文/段落を扱うコマンドは、
自然言語のテキストを編集するのが本来の目的ですが、
コードを編集する場合にもおおいに役立ちます。
なぜなら、たいていのシンボルは単語ですし(@pxref{Words})、
文は文字列やコメントの中にも含まれるからです(@pxref{Sentences})。
段落は本質的にはコードの中には存在しませんが、
プログラム言語向けのメジャーモードでは、
段落は空行で始まり空行で終わると定義するので、
段落コマンドも役立ちます(@pxref{Paragraphs})。
空行をうまく使ってプログラムが整然と見えるようにすると、
段落コマンドもうまく働きます。
@c The selective display feature is useful for looking at the overall
@c structure of a function (@pxref{Selective Display}). This feature causes
@c only the lines that are indented less than a specified amount to appear
@c on the screen.
選択的表示機能は、関数の全体構成を眺めるのに便利です
(@pxref{Selective Display})。
この機能は、指定幅以内の字下げ幅の行だけを表示します。
@menu
* Program Modes:: Major modes for editing programs.
* Lists:: Expressions with balanced parentheses.
* List Commands:: The commands for working with list and sexps.
* Defuns:: Each program is made up of separate functions.
There are editing commands to operate on them.
* Program Indent:: Adjusting indentation to show the nesting.
* Matching:: Insertion of a close-delimiter flashes matching open.
* Comments:: Inserting, killing, and aligning comments.
* Balanced Editing:: Inserting two matching parentheses at once, etc.
* Symbol Completion:: Completion on symbol names of your program or language.
* Which Function:: Which Function mode shows which function you are in.
* Documentation:: Getting documentation of functions you plan to call.
* Change Log:: Maintaining a change history for your program.
* Tags:: Go direct to any function in your program in one
command. Tags remembers which file it is in.
* Emerge:: A convenient way of merging two versions of a program.
* C Modes:: Special commands of C, C++, Objective-C,
Java, and Pike modes.
* Fortran:: Fortran mode and its special features.
* Asm Mode:: Asm mode and its special features.
@end menu
@node Program Modes
@c @section Major Modes for Programming Languages
@section プログラム言語向けメジャーモード
@c @cindex modes for programming languages
@cindex プログラム言語向けモード
@c @cindex Perl mode
@c @cindex Icon mode
@c @cindex Awk mode
@c @cindex Makefile mode
@c @cindex Tcl mode
@c @cindex CPerl mode
@cindex Perlモード
@cindex Iconモード
@cindex Awkモード
@cindex Makefileモード
@cindex Tclモード
@cindex CPerlモード
@c Emacs also has major modes for the programming languages Lisp, Scheme
@c (a variant of Lisp), Awk, C, C++, Fortran, Icon, Java, Objective-C,
@c Pascal, Perl, Pike, CORBA IDL, and Tcl. There is also a major mode for
@c makefiles, called Makefile mode. An second alternative mode for Perl is
@c called CPerl mode.
Emacsには、Lisp、Scheme(Lispの方言の1つ)、Awk、C、C++、Fortran、
Icon、Java、Objective-C、Pascal、Perl、Pike、CORBA IDL、
Tclといった各種プログラム言語向けのメジャーモードがあります。
makefile用のメジャーモード、makefileモードもあります。
Perl向けの別のモードとして、cperlモードもあります。
@c Ideally, a major mode should be implemented for each programming
@c language that you might want to edit with Emacs; but often the mode for
@c one language can serve for other syntactically similar languages. The
@c language modes that exist are those that someone decided to take the
@c trouble to write.
理想的には、Emacsで編集する可能性のあるすべてのプログラム言語に対して、
それぞれのメジャーモードを実装すべきです。
しかし、ある言語向けのモードが、構文的に類似した他の言語にも
使えることがよくあります。
既存の言語モード群は、誰かがわざわざ書こうと決心したものです。
@c There are several forms of Lisp mode, which differ in the way they
@c interface to Lisp execution. @xref{Executing Lisp}.
Lispモードにはいくつか変種がありますが、
Lispを実行する際のインターフェイス方法が異なります。
@xref{Executing Lisp}。
@c Each of the programming language major modes defines the @key{TAB} key
@c to run an indentation function that knows the indentation conventions of
@c that language and updates the current line's indentation accordingly.
@c For example, in C mode @key{TAB} is bound to @code{c-indent-line}.
@c @kbd{C-j} is normally defined to do @key{RET} followed by @key{TAB};
@c thus, it too indents in a mode-specific fashion.
各プログラム言語向けメジャーモードでは、
その言語の慣用的な字下げ方法を理解し
現在行をそのように字下げする関数を実行するように
@key{TAB}キーを定義します。
たとえば、Cモードでは、@key{TAB}は@code{c-indent-line}にバインドされています。
また、@kbd{C-j}は、@key{RET}に続けて@key{TAB}を実行するように
定義されています。
つまり、モードに固有の字下げも行います。
@c @kindex DEL @r{(programming modes)}
@kindex DEL @r{(プログラミングモード)}
@findex backward-delete-char-untabify
@c In most programming languages, indentation is likely to vary from line to
@c line. So the major modes for those languages rebind @key{DEL} to treat a
@c tab as if it were the equivalent number of spaces (using the command
@c @code{backward-delete-char-untabify}). This makes it possible to rub out
@c indentation one column at a time without worrying whether it is made up of
@c spaces or tabs. Use @kbd{C-b C-d} to delete a tab character before point,
@c in these modes.
多くのプログラム言語では、行ごとに字下げ量が異なります。
そのため、そのような言語向けのメジャーモードでは、
(コマンド@code{backward-delete-char-untabify}を使って)
タブ文字を等価な個数の空白と同じに扱うように@key{DEL}を再定義しています。
その結果、字下げが空白かタブのどちらで構成されているのか気にせずに、
1度に1桁ずつ消去することが可能となります。
そのようなモードでは、ポイントの直前にあるタブ文字を削除するには
@kbd{C-b C-d}を使います。
@c Programming language modes define paragraphs to be separated only by
@c blank lines, so that the paragraph commands remain useful. Auto Fill mode,
@c if enabled in a programming language major mode, indents the new lines
@c which it creates.
プログラム言語向けモードでは、段落は空行で分割されると定義するので、
段落コマンドも便利に使えます。
プログラム言語向けメジャーモードで
自動詰め込み(auto-fill)モードがオンのときには、
新たに行を作ると自動的に字下げも行われます。
@c @cindex mode hook
@cindex モードフック
@vindex c-mode-hook
@vindex lisp-mode-hook
@vindex emacs-lisp-mode-hook
@vindex lisp-interaction-mode-hook
@vindex scheme-mode-hook
@vindex muddle-mode-hook
@c Turning on a major mode runs a normal hook called the @dfn{mode hook},
@c which is the value of a Lisp variable. Each major mode has a mode hook,
@c and the hook's name is always made from the mode command's name by
@c adding @samp{-hook}. For example, turning on C mode runs the hook
@c @code{c-mode-hook}, while turning on Lisp mode runs the hook
@c @code{lisp-mode-hook}. @xref{Hooks}.
メジャーモードに入ると、@dfn{モードフック}(mode hook)と
呼ばれるノーマルフックが実行されます。
モードフックは、Lisp変数の値です。
各メジャーモードにはモードフックがあり、
フック名はつねにモードに入るためのコマンド名に@samp{-hook}を付加したものです。
たとえば、Cモードに入るとフック@code{c-mode-hook}が実行され、
Lispモードではフック@code{lisp-mode-hook}が実行されます。
@xref{Hooks}。
@node Lists
@c @section Lists and Sexps
@section リストとS式
@c @cindex Control-Meta
@cindex コントロール・メタ
@c By convention, Emacs keys for dealing with balanced expressions are
@c usually Control-Meta characters. They tend to be analogous in
@c function to their Control and Meta equivalents. These commands are
@c usually thought of as pertaining to expressions in programming
@c languages, but can be useful with any language in which some sort of
@c parentheses exist (including human languages).
慣習として、釣り合った式を扱うEmacsのキーは、普通、コントロール・メタ文字です。
これらは、コントロールやメタだけの対応したキーの機能に似せてあります。
これらは、プログラム言語の式だけに関係したコマンドだと考えられがちですが、
ある種の括弧が存在する(自然言語も含めた)任意の言語に対しても有益なものです。
@c @cindex list
@c @cindex sexp
@c @cindex expression
@cindex リスト
@cindex S式
@cindex 式
@c These commands fall into two classes. Some deal only with @dfn{lists}
@c (parenthetical groupings). They see nothing except parentheses, brackets,
@c braces (whichever ones must balance in the language you are working with),
@c and escape characters that might be used to quote those.
これらのコマンドは、2つのグループに分けられます。
一方は(括弧でまとめた)@dfn{リスト}(list)@footnote{【訳注】
ここでは、Lispの「リスト」ではなく、
単に括弧で括った一塊のこと。}だけを扱うもので、
丸括弧、角括弧、中括弧(使用言語において対応が取れている必要がある括弧)と、
それらをクォートするエスケープ文字だけに注目するコマンド群です。
@c The other commands deal with expressions or @dfn{sexps}. The word `sexp'
@c is derived from @dfn{s-expression}, the ancient term for an expression in
@c Lisp. But in Emacs, the notion of `sexp' is not limited to Lisp. It
@c refers to an expression in whatever language your program is written in.
@c Each programming language has its own major mode, which customizes the
@c syntax tables so that expressions in that language count as sexps.
もう一方は、式あるいは@dfn{S式}(sexp)を扱うコマンド群です。
「sexp」という用語は、
Lispの式を意味する古くからの用語@dfn{s-expression}に由来します。
Emacsでは「S式」の概念をLispに限定しません。
プログラムを記述した言語が何であっても、その式をS式と呼びます。
各プログラム言語には独自のメジャーモードがあり、
そこでは、その言語の式をS式とみなすように構文テーブルを調整してあります。
@c Sexps typically include symbols, numbers, and string constants, as well
@c as anything contained in parentheses, brackets or braces.
一般にS式には、丸括弧、角括弧、中括弧に囲まれた部分だけでなく、
シンボル、数値、文字列定数も含まれます。
@c In languages that use prefix and infix operators, such as C, it is not
@c possible for all expressions to be sexps. For example, C mode does not
@c recognize @samp{foo + bar} as a sexp, even though it @emph{is} a C expression;
@c it recognizes @samp{foo} as one sexp and @samp{bar} as another, with the
@c @samp{+} as punctuation between them. This is a fundamental ambiguity:
@c both @samp{foo + bar} and @samp{foo} are legitimate choices for the sexp to
@c move over if point is at the @samp{f}. Note that @samp{(foo + bar)} is a
@c single sexp in C mode.
Cのように前置演算子と中置演算子を使う言語では、
すべての式をS式として扱うことは不可能です。
たとえば、Cモードでは、@samp{foo + bar}はCの式@emph{です}が、
S式としては認識しません。
かわりに、@samp{foo}と@samp{bar}をそれぞれ1つのS式として認識し、
@samp{+}はあいだにある句読点として認識します。
これは根本的に曖昧なのです。
たとえば、ポイントが@samp{f}にあるとき、横断すべきS式としては、
@samp{foo + bar}でも@samp{foo}でも正当な選択肢です。
@samp{(foo + bar)}は、Cモードにおいて単一のS式であることに注意してください。
@c Some languages have obscure forms of expression syntax that nobody
@c has bothered to make Emacs understand properly.
式の構文が曖昧なために、
Emacsが正しく解釈できるようにしようなどとは誰も思わない言語もあります。
@node List Commands
@c @section List And Sexp Commands
@section リストとS式に対するコマンド
@c doublewidecommands
@table @kbd
@item C-M-f
@c Move forward over a sexp (@code{forward-sexp}).
S式を横断して前向きに移動する(@code{forward-sexp})。
@item C-M-b
@c Move backward over a sexp (@code{backward-sexp}).
S式を横断して後向きに移動する(@code{backward-sexp})。
@item C-M-k
@c Kill sexp forward (@code{kill-sexp}).
前向きにS式をキルする(@code{kill-sexp})。
@item C-M-@key{DEL}
@c Kill sexp backward (@code{backward-kill-sexp}).
後向きにS式をキルする(@code{backward-kill-sexp})。
@item C-M-u
@c Move up and backward in list structure (@code{backward-up-list}).
リスト構造を1レベル上がって後向きに移動する(@code{backward-up-list})。
@item C-M-d
@c Move down and forward in list structure (@code{down-list}).
リスト構造を1レベル下がって前向きに移動する(@code{down-list})。
@item C-M-n
@c Move forward over a list (@code{forward-list}).
リストを横断して前向きに移動する(@code{forward-list})。
@item C-M-p
@c Move backward over a list (@code{backward-list}).
リストを横断して後向きに移動する(@code{backward-list})。
@item C-M-t
@c Transpose expressions (@code{transpose-sexps}).
式を入れ替える(@code{transpose-sexps})。
@item C-M-@@
@c Put mark after following expression (@code{mark-sexp}).
つぎの式の直後にマークを設定する(@code{mark-sexp})。
@end table
@kindex C-M-f
@kindex C-M-b
@findex forward-sexp
@findex backward-sexp
@c To move forward over a sexp, use @kbd{C-M-f} (@code{forward-sexp}). If
@c the first significant character after point is an opening delimiter
@c (@samp{(} in Lisp; @samp{(}, @samp{[} or @samp{@{} in C), @kbd{C-M-f}
@c moves past the matching closing delimiter. If the character begins a
@c symbol, string, or number, @kbd{C-M-f} moves over that.
S式を横断して前向きに移動するには、
@kbd{C-M-f}(@code{forward-sexp})を使います。
ポイントに続く最初の意味ある文字が開き区切り
(Lisp では@samp{(}、Cでは@samp{(}や@samp{[}や@samp{@{})であれば、
対応する閉じ区切りのうしろに移動します。
シンボル、文字列、数値を始める文字の場合には、
それらを横断してその末尾に移動します。
@c The command @kbd{C-M-b} (@code{backward-sexp}) moves backward over a
@c sexp. The detailed rules are like those above for @kbd{C-M-f}, but with
@c directions reversed. If there are any prefix characters (single-quote,
@c backquote and comma, in Lisp) preceding the sexp, @kbd{C-M-b} moves back
@c over them as well. The sexp commands move across comments as if they
@c were whitespace in most modes.
コマンド@kbd{C-M-b}(@code{backward-sexp})は、
S式を横断して後向きに移動します。
移動の詳しい規則は上記の@kbd{C-M-f}と同様ですが、方向は逆です。
S式のまえに接頭辞文字(Lispではシングルクォート、バッククォート、コンマ)が
ある場合には、それらも横断します。
ほとんどのモードでは、S式コマンドはコメントを空白であるかのように
飛び越えます。
@c @kbd{C-M-f} or @kbd{C-M-b} with an argument repeats that operation the
@c specified number of times; with a negative argument, it moves in the
@c opposite direction.
@kbd{C-M-f}や@kbd{C-M-b}に引数を指定すると、
指定された回数だけ動作を繰り返します。
負の引数では、逆向きに移動します。
@kindex C-M-k
@findex kill-sexp
@kindex C-M-DEL
@findex backward-kill-sexp
@c Killing a whole sexp can be done with @kbd{C-M-k} (@code{kill-sexp})
@c or @kbd{C-M-@key{DEL}} (@code{backward-kill-sexp}). @kbd{C-M-k} kills
@c the characters that @kbd{C-M-f} would move over, and @kbd{C-M-@key{DEL}}
@c kills the characters that @kbd{C-M-b} would move over.
1つのS式全体をキルするには、@kbd{C-M-k}(@code{kill-sexp})や
@kbd{C-M-@key{DEL}}(@code{backward-kill-sexp})で行います。
@kbd{C-M-k}は@kbd{C-M-f}で横断するだけの文字をキルし、
@kbd{C-M-@key{DEL}}は@kbd{C-M-b}で横断するだけの文字をキルします。
@kindex C-M-n
@kindex C-M-p
@findex forward-list
@findex backward-list
@c The @dfn{list commands} move over lists, as the sexp commands do, but skip
@c blithely over any number of other kinds of sexps (symbols, strings, etc.).
@c They are @kbd{C-M-n} (@code{forward-list}) and @kbd{C-M-p}
@c (@code{backward-list}). The main reason they are useful is that they
@c usually ignore comments (since the comments usually do not contain any
@c lists).@refill
S式コマンドと同様に、@dfn{リストコマンド}はリストを横断しますが、
リスト以外のS式(シンボルや文字列など)は飛び越します。
これらのコマンドは、@kbd{C-M-n}(@code{forward-list})と
@kbd{C-M-p}(@code{backward-list})です。
これらのコマンドが便利である主な理由は、
(コメントにはリストが何も含まれないのが普通なので)
コメントを無視するからです。
@kindex C-M-u
@kindex C-M-d
@findex backward-up-list
@findex down-list
@c @kbd{C-M-n} and @kbd{C-M-p} stay at the same level in parentheses, when
@c that's possible. To move @emph{up} one (or @var{n}) levels, use @kbd{C-M-u}
@c (@code{backward-up-list}).
@c @kbd{C-M-u} moves backward up past one unmatched opening delimiter. A
@c positive argument serves as a repeat count; a negative argument reverses
@c direction of motion and also requests repetition, so it moves forward and
@c up one or more levels.@refill
@kbd{C-M-n}と@kbd{C-M-p}は、可能な限り同じレベルの括弧にとどまります。
1つ(あるいは@var{n}だけ)@emph{上の}レベルに移動するには、
@kbd{C-M-u}(@code{backward-up-list})を使います。
@kbd{C-M-u}は、対応の取れていない開き区切りのまえへ後向きに移動して、
1つレベルを上げます。
正の引数は反復回数になります。
負の引数は、移動を逆向きにしますが、やはり反復回数です。
つまり、前向きに移動して、1つ以上レベルを上げます。
@c To move @emph{down} in list structure, use @kbd{C-M-d}
@c (@code{down-list}). In Lisp mode, where @samp{(} is the only opening
@c delimiter, this is nearly the same as searching for a @samp{(}. An
@c argument specifies the number of levels of parentheses to go down.
リスト構造中で@emph{下}のレベルに移動するには、
@kbd{C-M-d}(@code{down-list})を使います。
Lispモードでは、@samp{(}が唯一の開き区切りなので、
このコマンドは@samp{(}を探索するのとほとんど同じです。
引数は下がるべき括弧のレベルを指定します。
@c @cindex transposition
@cindex 入れ替え
@kindex C-M-t
@findex transpose-sexps
@c A somewhat random-sounding command which is nevertheless handy is
@c @kbd{C-M-t} (@code{transpose-sexps}), which drags the previous sexp
@c across the next one. An argument serves as a repeat count, and a
@c negative argument drags backwards (thus canceling out the effect of
@c @kbd{C-M-t} with a positive argument). An argument of zero, rather than
@c doing nothing, transposes the sexps ending after point and the mark.
本当は役に立つのに、何の役に立つのだろうと思われるコマンドが
@kbd{C-M-t}(@code{transpose-sexps})です。
これはポイントのまえにあるS式を、つぎにあるS式を越えて移動するコマンドです。
引数は反復回数となり、負の引数では後向きにS式を移動します
(つまり正の引数を指定した@kbd{C-M-t}の効果を打ち消せる)。
引数が0の場合は、何もしないのではなくて、
ポイントのあとにあるS式とマークのあとにあるS式を入れ替えます。
@kindex C-M-@@
@findex mark-sexp
@c To set the region around the next sexp in the buffer, use @kbd{C-M-@@}
@c (@code{mark-sexp}), which sets mark at the same place that @kbd{C-M-f}
@c would move to. @kbd{C-M-@@} takes arguments like @kbd{C-M-f}. In
@c particular, a negative argument is useful for putting the mark at the
@c beginning of the previous sexp.
バッファ内でつぎにあるS式の周りにリージョンを設定するには、
@kbd{C-M-@@}(@code{mark-sexp})を使います。
このコマンドは、@kbd{C-M-f}による移動先にマークを設定します。
@kbd{C-M-@@}は、@kbd{C-M-f}と同様に引数を取ります。
とりわけ、負の引数は、直前のS式の先頭にマークを設定するのに便利です。
@c The list and sexp commands' understanding of syntax is completely
@c controlled by the syntax table. Any character can, for example, be
@c declared to be an opening delimiter and act like an open parenthesis.
@c @xref{Syntax}.
リストおよびS式コマンドが行う構文の解釈は、
構文テーブルに完全に支配されます。
たとえば、任意の文字を開き区切りとして宣言できて、
そうすると開き括弧のようにふるまうようになります。
@xref{Syntax}。
@node Defuns
@c @section Defuns
@section 関数定義(defun)
@c @cindex defuns
@cindex 関数定義(defun)
@cindex defun(関数定義)
@c In Emacs, a parenthetical grouping at the top level in the buffer is
@c called a @dfn{defun}. The name derives from the fact that most top-level
@c lists in a Lisp file are instances of the special form @code{defun}, but
@c any top-level parenthetical grouping counts as a defun in Emacs parlance
@c regardless of what its contents are, and regardless of the programming
@c language in use. For example, in C, the body of a function definition is a
@c defun.
Emacsでは、トップレベルの括弧でグループ化したものは
@dfn{関数定義}(defun)と呼ばれます。
この名前は、Lispファイルではトップレベルにあるリストの大半が
スペシャルフォーム@code{defun}であるという事実に由来します。
しかし、その中身が何であろうとも、また、使用プログラム言語が何であろうとも、
Emacs流には、トップレベルの括弧でグループ化されたものは
すべて関数定義(defun)です。
たとえば、Cの関数定義の本体は関数定義(defun)です。
@c doublewidecommands
@table @kbd
@item C-M-a
@c Move to beginning of current or preceding defun
@c (@code{beginning-of-defun}).
現在の関数定義、あるいは、直前の関数定義の先頭に移動する
(@code{beginning-of-defun})。
@item C-M-e
@c Move to end of current or following defun (@code{end-of-defun}).
現在の関数定義、あるいは、つぎの関数定義の末尾に移動する
(@code{end-of-defun})。
@item C-M-h
@c Put region around whole current or following defun (@code{mark-defun}).
現在の関数定義、あるいは、つぎの関数定義を囲むリージョンを設定する
(@code{mark-defun})。
@end table
@kindex C-M-a
@kindex C-M-e
@kindex C-M-h
@findex beginning-of-defun
@findex end-of-defun
@findex mark-defun
@c The commands to move to the beginning and end of the current defun are
@c @kbd{C-M-a} (@code{beginning-of-defun}) and @kbd{C-M-e} (@code{end-of-defun}).
現在の関数定義の先頭や末尾に移動するコマンドは、
@kbd{C-M-a}(@code{beginning-of-defun})と
@kbd{C-M-e}(@code{end-of-defun})です。
@findex c-mark-function
@c If you wish to operate on the current defun, use @kbd{C-M-h}
@c (@code{mark-defun}) which puts point at the beginning and mark at the end
@c of the current or next defun. For example, this is the easiest way to get
@c ready to move the defun to a different place in the text. In C mode,
@c @kbd{C-M-h} runs the function @code{c-mark-function}, which is almost the
@c same as @code{mark-defun}; the difference is that it backs up over the
@c argument declarations, function name and returned data type so that the
@c entire C function is inside the region. @xref{Marking Objects}.
現在の関数定義を操作したいのであれば、
@kbd{C-M-h}(@code{mark-defun})を使って、
現在の関数定義かつぎの関数定義の先頭にポイントを置き、
その末尾にマークを設定します。
たとえば、関数定義をテキストの別の位置に移動する準備をするには、
このコマンドを使うのがもっとも簡単な方法です。
Cモードでは、@kbd{C-M-h}は@code{c-mark-function}を実行しますが、
@code{mark-defun}とほとんど同じです。
違いは、引数宣言、関数名、戻り値の型名と遡って、
Cの関数全体をリージョンに含めることです。
@xref{Marking Objects}。
@c Emacs assumes that any open-parenthesis found in the leftmost column
@c is the start of a defun. Therefore, @strong{never put an
@c open-parenthesis at the left margin in a Lisp file unless it is the
@c start of a top-level list. Never put an open-brace or other opening
@c delimiter at the beginning of a line of C code unless it starts the body
@c of a function.} The most likely problem case is when you want an
@c opening delimiter at the start of a line inside a string. To avoid
@c trouble, put an escape character (@samp{\}, in C and Emacs Lisp,
@c @samp{/} in some other Lisp dialects) before the opening delimiter. It
@c will not affect the contents of the string.
Emacsは、もっとも左の桁でみつけた任意の開き括弧を
関数定義の始まりであると仮定します。
したがって、@strong{トップレベルのリストの始まりでない限り、
Lispファイルの中では左端に開き括弧を置いてはいけません。
また、関数本体の始まりを表すのでない限り、
Cのコードの行頭に開き中括弧や開き区切りを置いてはいけません。}
もっとも起こりやすい場面は、
文字列の途中で、行頭に開き区切りを入れたい場合です。
トラブルを避けるために、開き区切りのまえに
エスケープ文字(CやEmacs Lispでは @samp{\}、
その他のLisp方言のいくつかでは@samp{/})を入れてください。
これで文字列の内容が影響を受けることはありません。
@c In the remotest past, the original Emacs found defuns by moving upward a
@c level of parentheses until there were no more levels to go up. This always
@c required scanning all the way back to the beginning of the buffer, even for
@c a small function. To speed up the operation, Emacs was changed to assume
@c that any @samp{(} (or other character assigned the syntactic class of
@c opening-delimiter) at the left margin is the start of a defun. This
@c heuristic is nearly always right and avoids the costly scan; however,
@c it mandates the convention described above.
大昔のもともとのEmacsでは、関数定義を探すために、
より上位レベルの括弧がなくなるまで遡っていました。
この方法では、たとえ小さな関数であっても、
バッファの先頭まで遡って走査することがつねに必要でした。
これを高速化するために、左端内の任意の@samp{(}
(あるいは、開き区切りと宣言された任意の文字)が
関数定義の始まりであると仮定するように、Emacsを変更しました。
この発見的手法で、ほとんど正しく処理できて、時間のかかる走査を回避できます。
しかし、上述の約束事は必要です。
@node Program Indent
@c @section Indentation for Programs
@section プログラムの字下げ
@c @cindex indentation for programs
@cindex プログラムの字下げ
@c The best way to keep a program properly indented is to use Emacs to
@c reindent it as you change it. Emacs has commands to indent properly
@c either a single line, a specified number of lines, or all of the lines
@c inside a single parenthetical grouping.
正しく字下げされた状態にプログラムを保つ最良の方法は、
変更したらEmacsに字下げをやり直させることです。
Emacsには、1行の字下げ、指定された行数の字下げ、あるいは、
括弧でグループ化した内部のすべての行の字下げを行うコマンドがあります。
@menu
* Basic Indent:: Indenting a single line.
* Multi-line Indent:: Commands to reindent many lines at once.
* Lisp Indent:: Specifying how each Lisp function should be indented.
* C Indent:: Extra features for indenting C and related modes.
* Custom C Indent:: Controlling indentation style for C and related modes.
@end menu
@c Emacs also provides a Lisp pretty-printer in the library @code{pp}.
@c This program reformats a Lisp object with indentation chosen to look nice.
Emacsでは、ライブラリ@code{pp}にLispのプリティプリンタ@footnote{【訳注】
プログラムのソースコードを美しく清書するプログラムを
一般にプリティプリンタ(pretty-printer)と呼ぶ。}
もあります。
このプログラムは、美しく見えるように字下げを施してLispオブジェクトを
清書するプログラムです。
@node Basic Indent
@c @subsection Basic Program Indentation Commands
@subsection プログラムの字下げ基本コマンド
@c WideCommands
@table @kbd
@item @key{TAB}
@c Adjust indentation of current line.
現在行の字下げを調整する。
@item C-j
@c Equivalent to @key{RET} followed by @key{TAB} (@code{newline-and-indent}).
@key{RET}に続けて@key{TAB}と打鍵するのと同じ
(@code{newline-and-indent})。
@end table
@c @kindex TAB @r{(programming modes)}
@kindex TAB @r{(プログラミングモード)}
@findex c-indent-line
@findex lisp-indent-line
@c The basic indentation command is @key{TAB}, which gives the current line
@c the correct indentation as determined from the previous lines. The
@c function that @key{TAB} runs depends on the major mode; it is @code{lisp-indent-line}
@c in Lisp mode, @code{c-indent-line} in C mode, etc. These functions
@c understand different syntaxes for different languages, but they all do
@c about the same thing. @key{TAB} in any programming-language major mode
@c inserts or deletes whitespace at the beginning of the current line,
@c independent of where point is in the line. If point is inside the
@c whitespace at the beginning of the line, @key{TAB} leaves it at the end of
@c that whitespace; otherwise, @key{TAB} leaves point fixed with respect to
@c the characters around it.
基本的な字下げコマンドは@key{TAB}です。
直前の数行から判断した正しい字下げを現在行に施します。
@key{TAB}が実行する関数は、メジャーモードに依存します。
たとえば、Lispモードでは@code{lisp-indent-line}、
Cモードでは@code{c-indent-line}が実行されます。
これらの関数はそれぞれの言語の構文を解釈しますが、
どれも同じことを行うためのものです。
プログラム言語向けメジャーモードにおいては、
@key{TAB}は、現在行のどこにポイントがあっても、
現在行の先頭に白文字を挿入したり削除したりします。
ポイントが行頭の白文字の中にあったときは、
@key{TAB}は最後の白文字のうしろにポイントを置きます。
そうでなければ、@key{TAB}を打ったときの文字のところに留まります。
@c Use @kbd{C-q @key{TAB}} to insert a tab at point.
ポイント位置にタブを挿入するには、@kbd{C-q @key{TAB}}を使います。
@kindex C-j
@findex newline-and-indent
@c When entering lines of new code, use @kbd{C-j} (@code{newline-and-indent}),
@c which is equivalent to a @key{RET} followed by a @key{TAB}. @kbd{C-j} creates
@c a blank line and then gives it the appropriate indentation.
新たにソースコード行を入力するときには、
@kbd{C-j}(@code{newline-and-indent})を使ってください。
これは、@key{RET}に続けて@key{TAB}を打鍵することと等価です。
@kbd{C-j}は、空行を作ってから、その行で適切な字下げを行います。
@c @key{TAB} indents the second and following lines of the body of a
@c parenthetical grouping each under the preceding one; therefore, if you
@c alter one line's indentation to be nonstandard, the lines below will
@c tend to follow it. This behavior is convenient in cases where you have
@c overridden the standard result of @key{TAB} because you find it
@c unaesthetic for a particular line.
括弧でグループにまとめたところでは、
@key{TAB}は、2行目以降の行をそれぞれ直前の行の真下にくるように字下げします。
したがって、ある行を非標準的な字下げにすると、
以降の行もその字下げに従うことになります。
@key{TAB}による標準的な字下げが、
特定の行では美しくないので無視したい場合には、
字下げのこのようなふるまいが便利です。
@c Remember that an open-parenthesis, open-brace or other opening delimiter
@c at the left margin is assumed by Emacs (including the indentation routines)
@c to be the start of a function. Therefore, you must never have an opening
@c delimiter in column zero that is not the beginning of a function, not even
@c inside a string. This restriction is vital for making the indentation
@c commands fast; you must simply accept it. @xref{Defuns}, for more
@c information on this.
(字下げ処理を含めて)Emacsは、左端にある、開き丸括弧、開き中括弧、
および、その他の開き区切りを関数の始まりと仮定することを
覚えておきましょう。
たとえ文字列の中であっても、
関数の始まりでない開き区切りをけっして0桁目に置いてはいけません。
この制約は字下げコマンドを高速にするためにきわめて重要です。
無条件で受け入れてください。
これに関してより詳しくは、@xref{Defuns}。
@node Multi-line Indent
@c @subsection Indenting Several Lines
@subsection 複数行の字下げ
@c When you wish to reindent several lines of code which have been altered
@c or moved to a different level in the list structure, you have several
@c commands available.
変更した複数行や、リスト構造中の異なるレベル箇所へ移した複数の行を
字下げし直すには、いくつかのコマンドを利用できます。
@table @kbd
@item C-M-q
@c Reindent all the lines within one list (@code{indent-sexp}).
リスト内のすべての行を字下げし直す(@code{indent-sexp})。
@item C-u @key{TAB}
@c Shift an entire list rigidly sideways so that its first line
@c is properly indented.
リストの最初の行が正しい字下げ位置にくるように、
リストのすべての行を横にそのまま動かす。
@item C-M-\
@c Reindent all lines in the region (@code{indent-region}).
リージョン内のすべての行を字下げし直す(@code{indent-region})。
@end table
@kindex C-M-q
@findex indent-sexp
@c You can reindent the contents of a single list by positioning point
@c before the beginning of it and typing @kbd{C-M-q} (@code{indent-sexp} in
@c Lisp mode, @code{c-indent-exp} in C mode; also bound to other suitable
@c commands in other modes). The indentation of the line the sexp starts on
@c is not changed; therefore, only the relative indentation within the list,
@c and not its position, is changed. To correct the position as well, type a
@c @key{TAB} before the @kbd{C-M-q}.
1つのリストの中身を字下げし直すには、
リストの始まり位置にポイントを置いて
@kbd{C-M-q}(Lispモードでは@code{indent-sexp}、
Cモードでは@code{c-indent-exp}、
他のモードでは適切なコマンドにバインドされている)と打ちます。
S式が始まる行の字下げは変化しません。
つまり、リスト内の相対的な字下げが変化するだけで、
リストの位置は変わりません。
リストの開始位置も直すには、@kbd{C-M-q}のまえに@key{TAB}を打ってください。
@kindex C-u TAB
@c If the relative indentation within a list is correct but the
@c indentation of its first line is not, go to that line and type @kbd{C-u
@c @key{TAB}}. @key{TAB} with a numeric argument reindents the current
@c line as usual, then reindents by the same amount all the lines in the
@c grouping starting on the current line. In other words, it reindents the
@c whole grouping rigidly as a unit. It is clever, though, and does not
@c alter lines that start inside strings, or C preprocessor lines when in C
@c mode.
リスト内の相対的な字下げは正しいけれども、
リストの開始行の字下げが正しくない場合には、
その行に移動して@kbd{C-u @key{TAB}}と打ちます。
@key{TAB}に数引数を指定すると、通常どおり現在行を字下げしてから、
その行から始まるリスト内のすべての行にも同じ量の字下げを加えます。
いいかえれば、グループ全体をひとまとめに字下げし直します。
ただし、このコマンドは賢くて、文字列の中の行は移動しませんし、
Cモードではプリプロセッサ行を移動しません。
@c Another way to specify the range to be reindented is with the region.
@c The command @kbd{C-M-\} (@code{indent-region}) applies @key{TAB} to
@c every line whose first character is between point and mark.
字下げし直す範囲を指定するには、リージョンを使うこともできます。
コマンド@kbd{C-M-\}(@code{indent-region})は、
ポイントとマークのあいだに
行の先頭文字が含まれるすべての行について@key{TAB}を実行します。
@node Lisp Indent
@c @subsection Customizing Lisp Indentation
@subsection Lispの字下げのカスタマイズ
@c @cindex customizing Lisp indentation
@cindex Lispの字下げのカスタマイズ
@c The indentation pattern for a Lisp expression can depend on the function
@c called by the expression. For each Lisp function, you can choose among
@c several predefined patterns of indentation, or define an arbitrary one with
@c a Lisp program.
Lisp式に対する字下げの仕方を、
その式から呼ばれる関数と関係付けることができます。
各Lisp関数に対して、あらかじめ定義された字下げパターンの中から選んだり、
Lispプログラムで任意のものを定義したりできます。
@c The standard pattern of indentation is as follows: the second line of the
@c expression is indented under the first argument, if that is on the same
@c line as the beginning of the expression; otherwise, the second line is
@c indented underneath the function name. Each following line is indented
@c under the previous line whose nesting depth is the same.
字下げの標準パターンは、つぎのとおりです。
式の開始行に関数呼び出しの引数がある場合は、
最初の引数の直下に2行目がくるように字下げします。
それ以外の場合は、関数名の直下に2行目がくるように字下げします。
続く各行は、入れ子の深さが同じである行の字下げと同じになります。
@vindex lisp-indent-offset
@c If the variable @code{lisp-indent-offset} is non-@code{nil}, it overrides
@c the usual indentation pattern for the second line of an expression, so that
@c such lines are always indented @code{lisp-indent-offset} more columns than
@c the containing list.
変数@code{lisp-indent-offset}が@code{nil}以外ならば、
式の2行目に対する通常の字下げパターンを無効にして、
式の開始桁からつねに@code{lisp-indent-offset}だけ字下げします。
@vindex lisp-body-indent
@c The standard pattern is overridden for certain functions. Functions
@c whose names start with @code{def} always indent the second line by
@c @code{lisp-body-indent} extra columns beyond the open-parenthesis
@c starting the expression.
標準パターンが使用されない関数もいくつかあります。
名前が@code{def}で始まる関数に対しては、
式を開始する開き括弧の桁位置に@code{lisp-body-indent}を加えた桁位置へ
2行目がくるように字下げします。
@c The standard pattern can be overridden in various ways for individual
@c functions, according to the @code{lisp-indent-function} property of the
@c function name. There are four possibilities for this property:
関数名の属性@code{lisp-indent-function}を変更すれば、
各関数ごとに標準パターン以外の字下げを施せます。
この属性が取りえる値にはつぎの4つがあります。
@table @asis
@item @code{nil}
@c This is the same as no property; the standard indentation pattern is used.
属性がないのと同じ。標準の字下げパターンを使用する。
@item @code{defun}
@c The pattern used for function names that start with @code{def} is used for
@c this function also.
名前が@code{def}で始まる関数に用いる字下げパターンを使用する。
@c @item a number, @var{number}
@item 数値 @var{number}
@c The first @var{number} arguments of the function are
@c @dfn{distinguished} arguments; the rest are considered the @dfn{body}
@c of the expression. A line in the expression is indented according to
@c whether the first argument on it is distinguished or not. If the
@c argument is part of the body, the line is indented @code{lisp-body-indent}
@c more columns than the open-parenthesis starting the containing
@c expression. If the argument is distinguished and is either the first
@c or second argument, it is indented @emph{twice} that many extra columns.
@c If the argument is distinguished and not the first or second argument,
@c the standard pattern is followed for that line.
関数の最初の@var{number}個の引数を@dfn{区別された}引数と呼び、
残りを式の@dfn{本体}と呼ぶ。
行の最初の引数が区別された引数かどうかによって、各行の字下げが異なる。
引数が本体の一部ならば、それを含んだ式を開始する開き括弧の桁位置に
@code{lisp-body-indent}を加えた桁位置へ字下げする。
引数が区別された引数で最初か2番目ならば、
@code{lisp-body-indent}の@emph{2倍}を加えた桁位置へ字下げする。
引数が区別された引数であっても3番目以降ならば、標準パターンを適用する。
@c @item a symbol, @var{symbol}
@item シンボル@var{symbol}
@c @var{symbol} should be a function name; that function is called to
@c calculate the indentation of a line within this expression. The
@c function receives two arguments:
@var{symbol}は関数名であること。
この関数は、当該式の字下げ幅を計算する。
この関数はつぎの2つの引数を受け取る。
@table @asis
@item @var{state}
@c The value returned by @code{parse-partial-sexp} (a Lisp primitive for
@c indentation and nesting computation) when it parses up to the
@c beginning of this line.
当該行の先頭までを解析したときの@code{parse-partial-sexp}
(字下げと入れ子の計算を行うLispの基本的な関数)の戻り値。
@item @var{pos}
@c The position at which the line being indented begins.
字下げ対象の行の開始位置。
@end table
@noindent
@c It should return either a number, which is the number of columns of
@c indentation for that line, or a list whose car is such a number. The
@c difference between returning a number and returning a list is that a
@c number says that all following lines at the same nesting level should
@c be indented just like this one; a list says that following lines might
@c call for different indentations. This makes a difference when the
@c indentation is being computed by @kbd{C-M-q}; if the value is a
@c number, @kbd{C-M-q} need not recalculate indentation for the following
@c lines until the end of the list.
この関数は、当該行に対する字下げ幅の桁数、あるいは、
リストのcarがそのような数値であるリストを返す必要がある。
数値を返した場合は、括弧の入れ子レベルが同じ行に対しては
同じ字下げ幅を意味する。
リストを返した場合は、後続の行に対しては字下げ幅が異なる可能性を意味する。
このような差異は、@kbd{C-M-q}で字下げを計算するときに現れる。
数値が返された場合、@kbd{C-M-q}は、リストの末尾に達するまでは、
字下げの再計算を行う必要がない。
@end table
@node C Indent
@c @subsection Commands for C Indentation
@subsection Cの字下げコマンド
@c Here are the commands for indentation in C mode and related modes:
ここでは、Cモードとその関連モードにおける字下げコマンドを紹介します。
@table @code
@item C-c C-q
@c @kindex C-c C-q @r{(C mode)}
@kindex C-c C-q @r{(Cモード)}
@findex c-indent-defun
@c Reindent the current top-level function definition or aggregate type
@c declaration (@code{c-indent-defun}).
現在のトップレベルの関数定義、あるいは、型宣言の集まりを字下げし直す
(@code{c-indent-defun})。
@item C-M-q
@c @kindex C-M-q @r{(C mode)}
@kindex C-M-q @r{(Cモード)}
@findex c-indent-exp
@c Reindent each line in the balanced expression that follows point
@c (@code{c-indent-exp}). A prefix argument inhibits error checking and
@c warning messages about invalid syntax.
ポイントのうしろにある釣り合った式の中の各行を字下げし直す
(@code{c-indent-exp})。
前置引数を指定すると、
不正な構文に対する検査をせずに、警告メッセージも発しない。
@item @key{TAB}
@findex c-indent-command
@c Reindent the current line, and/or in some cases insert a tab character
@c (@code{c-indent-command}).
現在行を字下げし直すか、タブ文字を挿入する
(@code{c-indent-command})。
@c If @code{c-tab-always-indent} is @code{t}, this command always reindents
@c the current line and does nothing else. This is the default.
@code{c-tab-always-indent}が@code{t}ならば、
現在行を字下げし直すだけで、他には何もしない。
これがデフォルト。
@c If that variable is @code{nil}, this command reindents the current line
@c only if point is at the left margin or in the line's indentation;
@c otherwise, it inserts a tab (or the equivalent number of spaces,
@c if @code{indent-tabs-mode} is @code{nil}).
この変数が@code{nil}ならば、
ポイントが左端か字下げの余白部分にある場合に限り、字下げし直す。
さもなければ、タブ
(あるいは、@code{indent-tabs-mode}が@code{nil}ならば、
等価な個数の空白)を挿入する。
@c Any other value (not @code{nil} or @code{t}) means always reindent the
@c line, and also insert a tab if within a comment, a string, or a
@c preprocessor directive.
上記の(@code{nil}や@code{t})以外の値であれば、通常どおり字下げし直す。
ただし、コメント、文字列、プリプロセッサ指令の内側では、タブを挿入する。
@item C-u @key{TAB}
@c Reindent the current line according to its syntax; also rigidly reindent
@c any other lines of the expression that starts on the current line.
@c @xref{Multi-line Indent}.
現在行の構文に従って現在行を字下げし直す。
なお、現在行から始まる式を構成する行も同じ幅だけ字下げし直す。
@pxref{Multi-line Indent}。
@end table
@c To reindent the whole current buffer, type @kbd{C-x h C-M-\}. This
@c first selects the whole buffer as the region, then reindents that
@c region.
カレントバッファ全体を字下げし直すには、
@kbd{C-x h C-M-\}と打ちます。
これは、まず、バッファ全体をリージョンとしてから、
そのリージョンを字下げし直します。
@c To reindent the current block, use @kbd{C-M-u C-M-q}. This moves
@c to the front of the block and then reindents it all.
カレントブロックを字下げし直すには、@kbd{C-M-u C-M-q}と打ちます。
これは、まず、ブロックの先頭に移動してから、
ブロック全体を字下げし直します。
@node Custom C Indent
@c @subsection Customizing C Indentation
@subsection Cの字下げのカスタマイズ
@c C mode and related modes use a simple yet flexible mechanism for
@c customizing indentation. The mechanism works in two steps: first it
@c classifies the line syntactically according to its contents and context;
@c second, it associates each kind of syntactic construct with an
@c indentation offset which you can customize.
Cモードとその関連モードでは、字下げのカスタマイズには、
単純ですが柔軟性のある機構を用いています。
この機構は2段階で動作します。
まず、行をその内容と文脈から構文的に分類します。
つぎに、構文構成要素の各種類に、
カスタマイズ可能な字下げのオフセットを対応させます。
@menu
* Syntactic Analysis::
* Indentation Calculation::
* Changing Indent Style::
* Syntactic Symbols::
* Variables for C Indent::
* C Indent Styles::
@end menu
@node Syntactic Analysis
@c @subsubsection Step 1---Syntactic Analysis
@subsubsection 第1段階−−構文解析
@c @cindex syntactic analysis
@cindex 構文解析
@c In the first step, the C indentation mechanism looks at the line