unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* auto-fill-mode and docstring
@ 2004-09-13  6:33 Katsumi Yamaoka
  2004-09-13 13:14 ` Robert J. Chassell
  0 siblings, 1 reply; 4+ messages in thread
From: Katsumi Yamaoka @ 2004-09-13  6:33 UTC (permalink / raw)


Hi,

Recently, I rearranged docstrings in some ELisp files using
auto-fill-mode and noticed it inserts undesired spaces in the
beginning of lines.  For instance, when I type space just after
`jumps' in the following form

(defun quick-brown-fox (jumps-over &optional the-lazy-dog)
  "The quich brown fox jumps over the lazy dog.
The quich brown fox jumps over the lazy dog.  The quich brown fox jumps

, it is folded as follows:

(defun quick-brown-fox (jumps-over &optional the-lazy-dog)
  "The quich brown fox jumps over the lazy dog.
The quich brown fox jumps over the lazy dog.  The quich brown fox
  jumps 

Is inserting fill-prefix there an intended behavior?  I also
noticed it can be avoided by setting adaptive-fill-mode as nil,
and finished the work smoothly.

In addition, emacs-lisp-docstring-fill-column doesn't seem to be
effective when folding docstring lines.  Is it right?

Regards,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-fill-mode and docstring
  2004-09-13  6:33 auto-fill-mode and docstring Katsumi Yamaoka
@ 2004-09-13 13:14 ` Robert J. Chassell
  2004-09-14 14:07   ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Robert J. Chassell @ 2004-09-13 13:14 UTC (permalink / raw)


Katsumi Yamaoka <yamaoka@jpl.org> wrote

   ... auto-fill-mode ... inserts undesired spaces in the
   beginning of lines.  For instance, when I type space just after
   `jumps' in the following form

   (defun quick-brown-fox (jumps-over &optional the-lazy-dog)
     "The quich brown fox jumps over the lazy dog.
   The quich brown fox jumps over the lazy dog.  The quich brown fox jumps

   , it is folded as follows:

   ...
   The quich brown fox jumps over the lazy dog.  The quich brown fox
     jumps 

Yes, I repeated the bug in a Lisp Interaction buffer (the `*scratch*'
buffer) with auto-fill turned on.

    Using today's CVS snapshot, Mon, 2004 Sep 13  12:01 UTC
    GNU Emacs 21.3.50.35 (i686-pc-linux-gnu, GTK+ Version 2.4.9)
    started with

        /usr/local/src/emacs/src/emacs -Q

The bug occurs when do-auto-fill, which is in lisp/simple.el, tries
to find a fill-prefix automatically and the current fill-prefix is "".

On the other hand, M-q (fill-paragraph) does the filling properly.

That is because fill-paragraph, which is in lisp/textmodes/fill.el,
calls fill-paragraph-function.  In this mode, that function has the
value of lisp-fill-paragraph (in lisp/emacs-lisp/lisp-mode.el).

However, do-auto-fill does not call fill-paragraph-function.

When I changed do-auto-fill to call fill-paragraph-function, it
filled properly both in buffers in lisp-interaction-mode and text-mode
with auto-fill-mode on, but it failed in a buffer in lisp-mode and
auto-fill-mode on.

(By default, neither a lisp-interaction-mode nor a lisp-mode buffer
turn on auto-fill-mode.)

(For the unsuccessful fix, I added the fill-paragraph-function
expression from fill-paragraph to do-auto-fill like this:

      (defun do-auto-fill ()
        (let (fc justify give-up
               (fill-prefix fill-prefix))
    !     (if (or
    ! 	 ;; First try fill-paragraph-function.
    ! 	 (and fill-paragraph-function
    !        .... 

)

Unfortunately, I do not have time to investigate this further.

-- 
    Robert J. Chassell                         
    bob@rattlesnake.com                         GnuPG Key ID: 004B4AC8
    http://www.rattlesnake.com                  http://www.teak.cc

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-fill-mode and docstring
  2004-09-13 13:14 ` Robert J. Chassell
@ 2004-09-14 14:07   ` Richard Stallman
  2004-09-15  9:33     ` Richard Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2004-09-14 14:07 UTC (permalink / raw)
  Cc: emacs-devel

    However, do-auto-fill does not call fill-paragraph-function.

fill-paragraph-function functions are designed to be called from
fill-paragraph, and they do what fill-paragraph needs.  That's not the
same thing that do-auto-fill needs, so I am not surprised that calling
do-auto-fill there causes trouble.

You can think of calling fill-paragraph-function as calling
fill-paragraph.  What you need to do, to arrange to get good results
by calling fill-paragraph-function, is the same as what you need to do
to get good results by calling fill-paragraph.

So the right way to make do-auto-fill call fill-paragraph-function is
to make it use fill-paragraph.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-fill-mode and docstring
  2004-09-14 14:07   ` Richard Stallman
@ 2004-09-15  9:33     ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2004-09-15  9:33 UTC (permalink / raw)
  Cc: bob, emacs-devel

I wrote

    fill-paragraph-function functions are designed to be called from
    fill-paragraph, and they do what fill-paragraph needs.  That's not the
    same thing that do-auto-fill needs, so I am not surprised that calling
    do-auto-fill there causes trouble.

but I meant

    fill-paragraph-function functions are designed to be called from
    fill-paragraph, and they do what fill-paragraph needs.  That's not the
    same thing that do-auto-fill needs, so I am not surprised that calling
    fill-paragraph-function there causes trouble.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-09-15  9:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-13  6:33 auto-fill-mode and docstring Katsumi Yamaoka
2004-09-13 13:14 ` Robert J. Chassell
2004-09-14 14:07   ` Richard Stallman
2004-09-15  9:33     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).