Next: The Kill Ring, Previous: Deletion, Up: Text
本節では、テキストを削除する上位レベルのコマンドについて述べます。 これらはLispプログラムでも有用ですが主にユーザー向けのコマンドです。
この関数は、ポイントの周りの空白やタブをすべて削除する。
nil
を返す。つぎの例では、毎回ポイントを2番目と3番目の文字のあいだに置いて、 各行につき1回ずつ
delete-horizontal-space
を計4回呼び出す。---------- Buffer: foo ---------- I -!-thought I -!- thought We-!- thought Yo-!-u thought ---------- Buffer: foo ---------- (delete-horizontal-space) ; Four times. nil ---------- Buffer: foo ---------- Ithought Ithought Wethought You thought ---------- Buffer: foo ----------
この関数は、ポイントがある行をそのまえの行に連結する。 連結箇所の白文字は削除し、場合によっては空白1個に置き換える。 join-following-pが
nil
以外であると、delete-indentation
は、この行を後続の行に連結する。 関数はnil
を返す。詰め込み接頭辞があり、かつ、連結対象の2番目の行が その接頭辞で始まっている場合には、
delete-indentation
は連結するまえに詰め込み接頭辞を削除する。 see Margins。以下の例では、ポイントは‘events’で始まる行にあり、 そのまえの行の行末に空白があっても違いはない。
---------- Buffer: foo ---------- When in the course of human -!- events, it becomes necessary ---------- Buffer: foo ---------- (delete-indentation) nil ---------- Buffer: foo ---------- When in the course of human-!- events, it becomes necessary ---------- Buffer: foo ----------行を連結したあと、 関数
fixup-whitespace
には、 連結箇所に空白を置くかどうかを決定する責任がある。
この関数は、文脈に応じて、 ポイントを囲む白文字すべてを1つの空白に置換するかまったくなくす。
nil
を返す。行の先頭や末尾では、空白の適切な量は0である。 閉じ括弧構文の文字のまえや、 開き括弧構文や式前置子構文の文字のうしろでも空白はないほうが適している。 それ以外では、空白1個が適している。 see Syntax Class Table。
以下の例では、最初の行の単語‘spaces’のまえにポイントがあるときに 最初に
fixup-whitespace
が呼ばれる。 2度目に呼ばれるときには、ポイントは‘(’の直後にある。---------- Buffer: foo ---------- This has too many -!-spaces This has too many spaces at the start of (-!- this list) ---------- Buffer: foo ---------- (fixup-whitespace) nil (fixup-whitespace) nil ---------- Buffer: foo ---------- This has too many spaces This has too many spaces at the start of (this list) ---------- Buffer: foo ----------