私はRobertJ.Chassellによる「EmacsLispでのプログラミング入門」を読んでいます。そして、私は質問があります。ノード「fwd-parawhile」(のwhile
ループの説明forward-paragraph
)では、次のように記述されています。
興味深いことに、バッファの終わりに到達するか、段落区切り文字のローカル値の表示を停止しない限り、段落間のスペースを残すまでループカウントは減少しません。
理解できませんが、誰か説明してもらえますか?ありがとう。
ループは次のwhile
ようになります。
;; going forwards and not at the end of the buffer
(while (and (> arg 0) (not (eobp)))
;; between paragraphs
;; Move forward over separator lines...
(while (and (not (eobp))
(progn (move-to-left-margin) (not (eobp)))
(looking-at parsep))
(forward-line 1))
;; This decrements the loop
(unless (eobp) (setq arg (1- arg)))
;; ... and one more line.
(forward-line 1)
(if fill-prefix-regexp
;; There is a fill prefix; it overrides parstart;
;; we go forward line by line
(while (and (not (eobp))
(progn (move-to-left-margin) (not (eobp)))
(not (looking-at parsep))
(looking-at fill-prefix-regexp))
(forward-line 1))
;; There is no fill prefix;
;; we go forward character by character
(while (and (re-search-forward sp-parstart nil 1)
(progn (setq start (match-beginning 0))
(goto-char start)
(not (eobp)))
(progn (move-to-left-margin)
(not (looking-at parsep)))
(or (not (looking-at parstart))
(and use-hard-newlines
(not (get-text-property (1- start) 'hard)))))
(forward-char 1))
;; and if there is no fill prefix and if we are not at the end,
;; go to whatever was found in the regular expression search
;; for sp-parstart
(if (< (point) (point-max))
(goto-char start))))
編集して回答していただきありがとうございます。前段落についてさらに3つの質問があります。
の意味は何
(progn (move-to-left-margin) (not (eobp)))
ですか?真の場合、常に(not (eobp))
真である必要はありませんか?(progn (move-to-left-margin) (not (eobp)))
この行について:
;; ... and one more line. (forward-line 1)
なぜもう1行転送するのですか?
この段落について:
この
while
ループでは、可能な空白と段落の先頭または段落区切り文字のローカル値の組み合わせである「sp-parstart」を前方に検索します。なぜ
the local value of the start of a paragraph or of a paragraph separator
ですか?私に関する限り、段落区切り文字の条件は、の最初のwhile
ループですでに処理されていますwhile
。