all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: filling inside minibuffer behaves poorly
Date: Thu, 02 Nov 2006 16:47:42 -0500	[thread overview]
Message-ID: <E1GfkPW-0007Oe-CB@fencepost.gnu.org> (raw)
In-Reply-To: <87ejsoxlu4.fsf@enterprisedb.com> (gsstark@mit.edu)

    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

       reply	other threads:[~2006-11-02 21:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87ejsoxlu4.fsf@enterprisedb.com>
2006-11-02 21:47 ` Richard Stallman [this message]
2006-11-03  0:27   ` filling inside minibuffer behaves poorly Gregory Stark
2006-11-04  6:37     ` Richard Stallman
2006-11-04  7:37       ` Mathias Dahl
2006-11-04 18:12       ` John S. Yates, Jr.
2006-11-05 19:22         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1GfkPW-0007Oe-CB@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.