From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: filling inside minibuffer behaves poorly Date: Thu, 02 Nov 2006 16:47:42 -0500 Message-ID: References: <87ejsoxlu4.fsf@enterprisedb.com> Reply-To: rms@gnu.org NNTP-Posting-Host: main.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: sea.gmane.org 1162504379 9912 80.91.229.2 (2 Nov 2006 21:52:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Nov 2006 21:52:59 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 02 22:52:58 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfkU6-0004oB-P8 for ged-emacs-devel@m.gmane.org; Thu, 02 Nov 2006 22:52:28 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfkU6-0000l8-Db for ged-emacs-devel@m.gmane.org; Thu, 02 Nov 2006 16:52:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GfkPY-0007fR-E7 for emacs-devel@gnu.org; Thu, 02 Nov 2006 16:47:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GfkPX-0007e8-Nn for emacs-devel@gnu.org; Thu, 02 Nov 2006 16:47:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfkPX-0007ds-JD for emacs-devel@gnu.org; Thu, 02 Nov 2006 16:47:43 -0500 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GfkPX-00053X-KP for emacs-devel@gnu.org; Thu, 02 Nov 2006 16:47:43 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1GfkPW-0007Oe-CB; Thu, 02 Nov 2006 16:47:42 -0500 Original-To: gsstark@mit.edu In-reply-to: <87ejsoxlu4.fsf@enterprisedb.com> (gsstark@mit.edu) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61636 Archived-At: 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