gnu.emacs.help
[Top] [All Lists]

Re: Error with fill-paragraph in my own major mode

Subject: Re: Error with fill-paragraph in my own major mode
From: Stefan Kamphausen
Date: Thu, 31 Jan 2008 09:36:59 +0100
Newsgroups: gnu.emacs.help

Hi Stefan,

Stefan Monnier <monnier@xxxxxxxxxxxxxxxx> writes:

>> Today it has been brought to my attention that there is an error when
>> one tries to fill a paragraph (M-q) using that major mode in Gnu Emacs
>> 22.  Back then I wrote that mode in XEmacs, today I seem to be a Gnu
>> Emacs user so I'd like to fix that issue.
>
>> Hitting M-q leads to an error
>> Args out of range: "", -1, 0
>
>> Using debug-on-error and edebug I could track that error down to the
>> following code in function fill-comment-paragraph in fill.el:
>
>>   (if (string-match comment-start-skip (concat "\0" commark "a"))
>>       (concat "[ \t]*" (regexp-quote commark)
>>               ;; Make sure we only match comments that
>>               ;; use the exact same comment marker.
>>               "[^" (substring commark -1) "]")
>>                    ^^^^^^^^^^^^^^^^^^^^^^
>
> The problem is the setting of comment-start-skip.
> This regexp should match a "comment-start marker" (plus some optional
> whitespace), where you set it to "".

thanks.  I now have

 (setq comment-start "@#: "
        comment-end ""
        comment-start-skip "@#: +")


and that seems to work.  I will have to further test it, though.  The
new setting was 'inspired' by the one in texinfo-mode so I will read
some more of that code.

Nevertheless I must admit that I don't really grok that code in
fill.el.  What is that (concat "\0" commark "a") good for?

Anyway, thanks once more for your time.

Regards,
Stefan
-- 
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.

From the frying pan to the fire!
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on archivum
X-Spam-Level: ****
X-Spam-Status: No, score=4.2 required=5.0 tests=MISSING_DATE,MISSING_HEADERS,
        MISSING_MID,MISSING_SUBJECT,NO_HEADERS_MESSAGE,NO_RECEIVED,NO_RELAYS
        autolearn=no version=3.2.5

  - cb

<Prev in Thread] Current Thread [Next in Thread>