diff options
| author | Richard M. Stallman | 2006-11-06 16:01:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2006-11-06 16:01:53 +0000 |
| commit | 708ca5aaaf60344ae2aa31f01a5e427620f7a6ad (patch) | |
| tree | 2ae58a4230fc801635407502a409ca62632e4720 | |
| parent | 59b3965e0c06beffe18adc82d9ca5f0393613501 (diff) | |
| download | emacs-708ca5aaaf60344ae2aa31f01a5e427620f7a6ad.tar.gz emacs-708ca5aaaf60344ae2aa31f01a5e427620f7a6ad.zip | |
(fill-minibuffer-function): New function.
(fill-paragraph): Bind fill-paragraph-function to fill-minibuffer-function.
| -rw-r--r-- | lisp/textmodes/fill.el | 15 |
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." | |||
| 741 | (looking-at (regexp-quote prefix)))) | 741 | (looking-at (regexp-quote prefix)))) |
| 742 | (goto-char (match-end 0)))) | 742 | (goto-char (match-end 0)))) |
| 743 | 743 | ||
| 744 | (defun fill-minibuffer-function (arg) | ||
| 745 | "Fill a paragraph in the minibuffer, ignoring the prompt." | ||
| 746 | (save-restriction | ||
| 747 | (narrow-to-region (minibuffer-prompt-end) (point-max)) | ||
| 748 | (fill-paragraph arg))) | ||
| 749 | |||
| 744 | (defun fill-paragraph (arg) | 750 | (defun fill-paragraph (arg) |
| 745 | "Fill paragraph at or after point. Prefix ARG means justify as well. | 751 | "Fill paragraph at or after point. Prefix ARG means justify as well. |
| 746 | If `sentence-end-double-space' is non-nil, then period followed by one | 752 | 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." | |||
| 755 | (barf-if-buffer-read-only) | 761 | (barf-if-buffer-read-only) |
| 756 | (list (if current-prefix-arg 'full)))) | 762 | (list (if current-prefix-arg 'full)))) |
| 757 | ;; First try fill-paragraph-function. | 763 | ;; First try fill-paragraph-function. |
| 758 | (or (and fill-paragraph-function | 764 | (or (and (or fill-paragraph-function |
| 759 | (let ((function fill-paragraph-function) | 765 | (and (window-minibuffer-p (selected-window)) |
| 766 | (= 1 (point-min)))) | ||
| 767 | (let ((function (or fill-paragraph-function | ||
| 768 | ;; In the minibuffer, don't count the width | ||
| 769 | ;; of the prompt. | ||
| 770 | 'fill-minibuffer-function)) | ||
| 760 | ;; If fill-paragraph-function is set, it probably takes care | 771 | ;; If fill-paragraph-function is set, it probably takes care |
| 761 | ;; of comments and stuff. If not, it will have to set | 772 | ;; of comments and stuff. If not, it will have to set |
| 762 | ;; fill-paragraph-handle-comment back to t explicitly or | 773 | ;; fill-paragraph-handle-comment back to t explicitly or |