unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: adaptive-fill-mode and auto-fill-mode
Date: Sun, 08 Oct 2006 21:03:19 +0200	[thread overview]
Message-ID: <45294B77.5030202@gmx.at> (raw)
In-Reply-To: <jwvbqomregt.fsf-monnier+emacs@gnu.org>

 > I guess what I don't understand is in what way this is a fix for
 > the problem.  Yes, it may work for your specific case, but what about in
 > cases such as:
 >
 >   (defun foo ()
 >     "docstring"
 >
 >     ;; The empty line above is important.
 >     ;; This second line as well.
 >     (let ((toto titi))
 >       ;; some comment klsdhfkshgkslfkhgsjkhgskhgjfdhgd yy
 >
 > the same problem will happen, although not at BOL.

I don't accept the prefix when _compos_ is not at BOL (in your example
compos is before ";; some comment ...").  `comment-indent-new-line' has
no idea where the fill-prefix comes from (otherwise solving all this
would be trivial).  I'm afraid my code is unreadable.

 >  Maybe a better fix would
 > be (when compos is set and `prefix' matches
 > (concat "\\`[ \t]*" comment-start-skip)) to go to compos, and call
 > comment-forward until we reach point.  If we bump into non-comment before
 > reaching point, then the prefix was set based on some other unrelated
 > comment and should be ignored.

Why?  compos is at the beginning of the current comment provided `point'
is within a comment.  The problem that `comment-indent-new-line' used
the fill-prefix in the "not compos" case is trivially handled in the
"else" part of `comment-valid-prefix-p'.  The problem you refer to is
with the "then" part.

 >>Indeed.  The reason is that I don't want to affect multiline comment
 >>environments when the comment starting at compos is a single line
 >>comment.
 >
 >
 > But in what is checking comment-end better than using "comment-forward + not
 > bolp"?

Well, checking comment-end style is cheaper than doing comment-forward.
Combine these before doing the string-match?

 >>>;; foo wrote:
 >>>;; > where the fill-prefix will include 3 spaces after ";;"
 >>>;; > even though the first line doesn't match it.
 >
 >
 >>Do you think my patch would be responsible for not handling these
 >
 >
 > The prefix would be ";; >" which doesn't match the string at compos, so your
 > code would reject it.

... but the string at compos is ";; >" ...

 >>(at line-beginning)?
 >
 >
 > These can happen at any indentation.

... if compos is not at line beginning the prefix is rejected.

 >>If the prefix passed to `comment-valid-prefix-p'
 >>matches the string at compos there shouldn't be any problems.
 >
 >
 > Of course, but what I'm saying is that it may not match, even in cases where
 > it's perfectly correct.

The only cases rejected are when the string is not at line beginning or
does not match the prefix.  In your second example the prefix is ";; ",
at least with emacs -Q, because that's the common prefix of ";; " and
";; >".

 >>I think the second example doesn't work because
 >>`fill-common-string-prefix' determines the common prefix of ";; " and
 >>";; > " as ";; " long before I lay my hands at this.
 >
 >
 > That depends on adaptive-fill-function.

I fail to understand you here.  If the comment at compos doesn't match
the prefix why should I want to insert the prefix on the next line?

 >>Where do you want to strip whitespace,
 >>before the comment marker, between comment marker and body?  Would it be
 >>reliable to do that?
 >
 >
 > Why not?

Because, as I suppose, the number of spaces is significant for the
fill-prefix.

 >>Personally, I don't care at all.  My auto-fill-function uses syntax-ppss
 >>and doesn't fill normal strings.  But, as stated above, I don't think
 >>that auto-fill should be allowed to break non-doc-strings in Elisp.
 >
 >
 > I completely understand your point of view, but it's still far from
 > a bug-fix and it's not the only way to go about it.

It fixes that better than I expected.  Note also that you never had a
chance to handle this _before_ the introduction of the doc-string face.
But I admit that emacs was always breaking lisp strings this way, hence
let's drop it (which means I don't need to change fill.el either).

 > Have you tried
 > comment-auto-fill-only-comments?

It doesn't fill doc-strings.

  reply	other threads:[~2006-10-08 19:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-07 10:00 adaptive-fill-mode and auto-fill-mode martin rudalics
2006-10-07 16:22 ` Stefan Monnier
2006-10-07 18:43   ` martin rudalics
2006-10-08  4:29     ` Stefan Monnier
2006-10-08 10:29       ` martin rudalics
2006-10-08 16:21         ` Stefan Monnier
2006-10-08 19:03           ` martin rudalics [this message]
2006-10-09  1:37             ` Stefan Monnier
2006-10-09 12:35               ` martin rudalics
2006-10-09 16:45                 ` Stefan Monnier
2006-10-09 21:04                   ` martin rudalics
2006-10-10  0:32                     ` Stefan Monnier
2006-10-08  4:30     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=45294B77.5030202@gmx.at \
    --to=rudalics@gmx.at \
    --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 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).