# HG changeset patch # User Richard M. Stallman # Date 1162828913 0 # Node ID 7e762349b1c32952e1cec5075af29f311ba2423e # Parent 461d1ed79b75b79599f286d935d42ab1c588b64d (fill-minibuffer-function): New function. (fill-paragraph): Bind fill-paragraph-function to fill-minibuffer-function. diff -r 461d1ed79b75 -r 7e762349b1c3 lisp/textmodes/fill.el --- a/lisp/textmodes/fill.el Mon Nov 06 15:59:58 2006 +0000 +++ b/lisp/textmodes/fill.el Mon Nov 06 16:01:53 2006 +0000 @@ -741,6 +741,12 @@ (looking-at (regexp-quote prefix)))) (goto-char (match-end 0)))) +(defun fill-minibuffer-function (arg) + "Fill a paragraph in the minibuffer, ignoring the prompt." + (save-restriction + (narrow-to-region (minibuffer-prompt-end) (point-max)) + (fill-paragraph arg))) + (defun fill-paragraph (arg) "Fill paragraph at or after point. Prefix ARG means justify as well. If `sentence-end-double-space' is non-nil, then period followed by one @@ -755,8 +761,13 @@ (barf-if-buffer-read-only) (list (if current-prefix-arg 'full)))) ;; First try fill-paragraph-function. - (or (and fill-paragraph-function - (let ((function fill-paragraph-function) + (or (and (or fill-paragraph-function + (and (window-minibuffer-p (selected-window)) + (= 1 (point-min)))) + (let ((function (or fill-paragraph-function + ;; In the minibuffer, don't count the width + ;; of the prompt. + 'fill-minibuffer-function)) ;; If fill-paragraph-function is set, it probably takes care ;; of comments and stuff. If not, it will have to set ;; fill-paragraph-handle-comment back to t explicitly or