From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?iso-8859-1?q?R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: Error with fill-paragraph in my own major mode Date: Wed, 30 Jan 2008 22:15:42 +0100 Message-ID: <200801302215.43903.andreas.roehler@online.de> References: <85y7a7l0z3.fsf@usenet.my.skamphausen.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1201727700 8738 80.91.229.12 (30 Jan 2008 21:15:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Jan 2008 21:15:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 30 22:15:20 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JKKH7-000887-NJ for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Jan 2008 22:15:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKKGg-0007fZ-AJ for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Jan 2008 16:14:50 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JKKGN-0007eW-Nd for help-gnu-emacs@gnu.org; Wed, 30 Jan 2008 16:14:31 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JKKGJ-0007c1-2n for help-gnu-emacs@gnu.org; Wed, 30 Jan 2008 16:14:31 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JKKGI-0007by-UR for help-gnu-emacs@gnu.org; Wed, 30 Jan 2008 16:14:26 -0500 Original-Received: from moutng.kundenserver.de ([212.227.126.179]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JKKGI-0006KS-D5 for help-gnu-emacs@gnu.org; Wed, 30 Jan 2008 16:14:26 -0500 Original-Received: from noname (p54BE8DF3.dip0.t-ipconnect.de [84.190.141.243]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1JKKGG3EsS-0006nJ; Wed, 30 Jan 2008 22:14:25 +0100 User-Agent: KMail/1.9.5 In-Reply-To: <85y7a7l0z3.fsf@usenet.my.skamphausen.de> Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX18YGbHax2j5FpApYoCIb8sAAO20jTRXCJVdShB d88umHw4+PgpB9JG9zgHJE0l5ifMQbzLnfGL8BNDBFVkcXPTry jJXAlxaOJW7mM2JhCVVYg== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51104 Archived-At: Am Mittwoch, 30. Januar 2008 17:41 schrieb Stefan Kamphausen: > Hi, > > a good while back (actually I started this in 2004) I wrote a major > mode to write articles for the (German) linux magazin ([1]). This > major mode can be found on my website at > > http://www.skamphausen.de/cgi-bin/ska/linmag-mode > > 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) "]") > ^^^^^^^^^^^^^^^^^^^^^^ > > I tried to understand the workings there but to no avail and I would > appreciate any pointers to what I may be doing wrong in my major mode. > > To reproduce: > > * emacs -q > * Load linmag-mode.el (M-x load-file) > * Save the sample article from below ([2]) in a file with suffix > .linmag > * Open the file, the buffer should be in linmag-mode. > * Move to the lorem ispum text > * Hit M-q. > * Voila. > > > > Regards, > stefan > =2E.. Seems a clash with your comment-start setting. Error occurs if form in line 871 from `fill-comment-paragraph' "[^" (substring commark -1) "]") is called. A comment there says ,---- |=20 | The specialized regexp only works for "normal" comment | ;; syntax, not for Texinfo's "@c" (w `---- BTW, when substring's `from' was set to 0, filling worked. However, didn't check the results further, other nasty things may happen than. Andreas R=F6hler