summaryrefslogtreecommitdiff
path: root/lisp/textmodes/fill.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2006-11-06 16:01:53 +0000
committerRichard M. Stallman <rms@gnu.org>2006-11-06 16:01:53 +0000
commit708ca5aaaf60344ae2aa31f01a5e427620f7a6ad (patch)
tree2ae58a4230fc801635407502a409ca62632e4720 /lisp/textmodes/fill.el
parent59b3965e0c06beffe18adc82d9ca5f0393613501 (diff)
downloademacs-708ca5aaaf60344ae2aa31f01a5e427620f7a6ad.tar.gz
(fill-minibuffer-function): New function.
(fill-paragraph): Bind fill-paragraph-function to fill-minibuffer-function.
Diffstat (limited to 'lisp/textmodes/fill.el')
-rw-r--r--lisp/textmodes/fill.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 514350119fe..e5b3a64db84 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -741,6 +741,12 @@ space does not end a sentence, so don't break a line there."
(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 @@ If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling."
(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