[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: filling inside minibuffer behaves poorly
From: |
Richard Stallman |
Subject: |
Re: filling inside minibuffer behaves poorly |
Date: |
Thu, 02 Nov 2006 16:47:42 -0500 |
I use a package that does instant messaging inside of emacs. It
prompts for the message in the minibuffer. In previous versions if
my message went long I hit M-q (fill-paragraph) to word wrap the
message before sending it and the message appeared fine.
In this version it seems to get confused and the first line is
always short. It seems it's taking into account the length of the
prompt as if it were part of the text I'm typing. As a result all
my messages look odd with a very short first line followed by
regular length lines afterwards.
That is because the prompt is now text in the minibuffer.
I can see why the result is inconvenient for your application, and I
can see how to make it give results that are good for you. What I am
not sure is whether we should consider it generally wrong.
Do you like the results that this patch gives?
It changes M-q in all minibuffers. We might instead want to
change M-q only for particular minibuffer inputs.
*** fill.el 07 Sep 2006 17:19:34 -0400 1.191
--- fill.el 02 Nov 2006 15:07:19 -0500
***************
*** 741,746 ****
--- 741,751 ----
(looking-at (regexp-quote prefix))))
(goto-char (match-end 0))))
+ (defun fill-minibuffer-function (arg)
+ (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,762 ****
(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)
;; 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
--- 760,770 ----
(barf-if-buffer-read-only)
(list (if current-prefix-arg 'full))))
;; First try fill-paragraph-function.
! (or (and (or fill-paragraph-function
! (and (window-minibuffer-p (selected-window))
! (= 1 (point-min))))
! (let ((function (or fill-paragraph-function
! '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
- Re: filling inside minibuffer behaves poorly,
Richard Stallman <=