emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adaptive-fill-mode and auto-fill-mode


From: Stefan Monnier
Subject: Re: adaptive-fill-mode and auto-fill-mode
Date: Mon, 09 Oct 2006 12:45:34 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>>> 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?
>> Why not?

> Your own patch might impede you.  If you manually change the
> comment-start sequence at compos or the whitespace preceding it, the
> prefix won't match the comment at compos any more and hence won't be
> used.

I'm not sure what you're referring to.  Of course, if the comment-start is
different, I want to reject the prefix, and if the leading whitespace is of
different length, I also want to reject it.  Both of these are pretty clear
signs that the prefix was built from some other unrelated comment.
Of course, one can never be sure, but one has to guess.

> !            (save-excursion
> !              (goto-char compos)
> !              ;; The comstart marker is the same.
> !              (and (looking-at comment-start-skip)
> !               (string-equal
> !                prefix-comstart
> !                (comment-string-strip (match-string 0) nil t))

AFAICT this is the only spot where you changed my suggested code.
What was the scenario where this change is needed?

BTW comment-start-skip can't be used like that in `looking-at' because it
may need to match some chars *before* the actual comment start.  This is
typically the case when it starts with
"\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)" as in elisp.  So you need to
either narrow so as to pretend that compos is at BOL, or match from BOL and
prepend something like ".*".  Instead I just did (looking-at (regexp-quote
prefix-comstart)) which I thought should work just as well.


        Stefan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]