emacs fill-paragraph只考虑当前行及以下?

时间:2013-11-13 00:57:01

标签: emacs elisp

假设我的光标位于_

 This is line 1.
_This is line 2. 
 This is line 3.

如果我使用fill-paragraph(meta-q),emacs会像这样转换文本。

 This is line 1.  This is line 2.  This is line 3.

但我希望如此。

 This is line 1.
 This is line 2.  This is line 3.

目前我必须在第2行之前插入额外的空白行

 This is line 1.

_This is line 2. 
 This is line 3.

然后调用fill-paragraph,但这不太方便。

由于

2 个答案:

答案 0 :(得分:1)

似乎是一个很好的建议候选人:

(defadvice fill-paragraph (around start-filling-at-current-line activate)
  (save-restriction
    (narrow-to-region (line-beginning-position) (point-max))
    ad-do-it))

答案 1 :(得分:0)

如果您愿意,可以使用简单的功能

(defun fill-following-paragraph ()
  "Do fill-region from the current line to the end of the
buffer"
  (interactive)
  (fill-region (line-beginning-position) (point-max)))