From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: filling in the minibuffer Date: Tue, 17 Aug 2004 21:35:03 -0400 Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Message-ID: References: <87d61rgvp3.fsf@emacswiki.org> Reply-To: rms@gnu.org NNTP-Posting-Host: deer.gmane.org X-Trace: sea.gmane.org 1092792978 25532 80.91.224.253 (18 Aug 2004 01:36:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Aug 2004 01:36:18 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 18 03:36:11 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BxFN5-0006q5-00 for ; Wed, 18 Aug 2004 03:36:11 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BxFRG-0004wJ-G7 for ged-emacs-devel@m.gmane.org; Tue, 17 Aug 2004 21:40:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BxFR4-0004vx-DS for emacs-devel@gnu.org; Tue, 17 Aug 2004 21:40:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BxFR3-0004vX-2g for emacs-devel@gnu.org; Tue, 17 Aug 2004 21:40:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BxFR3-0004vU-1E for emacs-devel@gnu.org; Tue, 17 Aug 2004 21:40:17 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BxFM0-0007uT-Dm for emacs-devel@gnu.org; Tue, 17 Aug 2004 21:35:04 -0400 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.34) id 1BxFLz-0003WZ-AO; Tue, 17 Aug 2004 21:35:03 -0400 Original-To: Alex Schroeder In-reply-to: <87d61rgvp3.fsf@emacswiki.org> (message from Alex Schroeder on Mon, 16 Aug 2004 13:37:44 +0200) 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: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:26296 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:26296 The prompt ends with a space. When fill-delete-newlines gets called, we have a problem at the very end: (if (and nosqueeze (not (eq justify 'full))) nil (canonically-space-region (or squeeze-after (point)) to) ;; Remove trailing whitespace. ;; Maybe canonically-space-region should do that. (goto-char to) (delete-char (- (skip-chars-backward " \t")))) (goto-char from)) That is, this tries to delete the space ending the prompt, which fails. It seems to me that a special case check here for the minibuffer, to leave the prompt alone, is an ok solution. The call to move-to-left-margin takes us to the beginning of the prompt. The forward-paragraph takes us to end of the prompt (end). Then the next backward-paragraph takes us to the beginning of the prompt again (beg). I think this is the bug. Maybe move-to-left-margin should stop at field boundaries? I'm not sure this is the correct solution... It would make sense for move-to-left-margin to special-case the minibuffer and treat the end of the prompt as the left margin. Does this patch give good results? *** indent.el 11 Sep 2003 09:45:48 -0400 1.55 --- indent.el 17 Aug 2004 20:27:18 -0400 *************** *** 164,177 **** (interactive (list (prefix-numeric-value current-prefix-arg) t)) (beginning-of-line n) (skip-chars-forward " \t") ! (let ((lm (current-left-margin)) ! (cc (current-column))) ! (cond ((> cc lm) ! (if (> (move-to-column lm force) lm) ! ;; If lm is in a tab and we are not forcing, move before tab ! (backward-char 1))) ! ((and force (< cc lm)) ! (indent-to-left-margin))))) ;; This used to be the default indent-line-function, ;; used in Fundamental Mode, Text Mode, etc. --- 164,181 ---- (interactive (list (prefix-numeric-value current-prefix-arg) t)) (beginning-of-line n) (skip-chars-forward " \t") ! (if (window-minibuffer-p) ! (if (save-excursion (beginning-of-line) (bobp)) ! (goto-char (minibuffer-prompt-end)) ! (beginning-of-line)) ! (let ((lm (current-left-margin)) ! (cc (current-column))) ! (cond ((> cc lm) ! (if (> (move-to-column lm force) lm) ! ;; If lm is in a tab and we are not forcing, move before tab ! (backward-char 1))) ! ((and force (< cc lm)) ! (indent-to-left-margin)))))) ;; This used to be the default indent-line-function, ;; used in Fundamental Mode, Text Mode, etc.