M-x table-capture コマンドは、領域内のプレーンテキストをキャプチャして表に変換します。M-x table-recognize(表認識を参照)とは異なり、元のテキストが表のような見た目である必要はなく、論理的に表のような構造になっていれば十分です。
例えば、次のような数値があり、それが3行に分かれていて、横方向にカンマで区切られているとします。
1, 2, 3, 4 5, 6, 7, 8 , 9, 10
そのテキストに M-x table-capture を適用すると、次のような表が生成されます:
+-----+-----+-----+-----+ |1 |2 |3 |4 | +-----+-----+-----+-----+ |5 |6 |7 |8 | +-----+-----+-----+-----+ | |9 |10 | | +-----+-----+-----+-----+
M-x table-release はその逆の処理を行い、テーブルをプレーンテキストに戻してセルの枠線を削除します。
このコマンドペアの用途の一つに、レイアウト内でテキストを編集することがあります。以下の3つの段落をご覧ください。
table-capture is a powerful command.
Here are some things it can do:
Parse Cell Items Using row and column delimiter regexps,
it parses the specified text area and
extracts cell items into a table.
上記のテキストを含む領域に table-capture
を適用し、列および行の区切り正規表現に空文字列を指定すると、以下のような単一セルのテーブルが作成されます。
+----------------------------------------------------------+ |table-capture is a powerful command. | |Here are some things it can do: | | | |Parse Cell Items Using row and column delimiter regexps,| | it parses the specified text area and | | extracts cell items into a table. | +----------------------------------------------------------+
次に、セル分割コマンド(テーブルセル用コマンドを参照)を使用してテーブルを細分化し、各段落が1つのセルを占めるようにできます:
+----------------------------------------------------------+ |table-capture is a powerful command. | |Here are some things it can do: | +-----------------+----------------------------------------+ |Parse Cell Items | Using row and column delimiter regexps,| | | it parses the specified text area and | | | extracts cell items into a table. | +-----------------+----------------------------------------+
各セルは、他のセルのレイアウトに影響を与えることなく、個別に編集できるようになりました。完了したら、M-x table-releaseを呼び出してテーブルをプレーンテキストに戻すことができます。