From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: define-generic-mode: unexpected handling of comment-end Date: Wed, 24 Nov 2004 09:03:18 -0500 Message-ID: References: <86u0rfk2aa.fsf@ketchup.de.uu.net> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1101305020 23814 80.91.229.6 (24 Nov 2004 14:03:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 24 Nov 2004 14:03:40 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 24 15:03:32 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CWxk4-0003zH-00 for ; Wed, 24 Nov 2004 15:03:32 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWxtD-0008EF-IO for ged-emacs-devel@m.gmane.org; Wed, 24 Nov 2004 09:12:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CWxt7-0008E7-Jl for emacs-devel@gnu.org; Wed, 24 Nov 2004 09:12:53 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CWxt7-0008Dv-7I for emacs-devel@gnu.org; Wed, 24 Nov 2004 09:12:53 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CWxt7-0008Ds-3k for emacs-devel@gnu.org; Wed, 24 Nov 2004 09:12:53 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CWxjv-0005oD-BN for emacs-devel@gnu.org; Wed, 24 Nov 2004 09:03:23 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 1B8AC8282FA; Wed, 24 Nov 2004 09:03:23 -0500 (EST) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 9D4A84AC53F; Wed, 24 Nov 2004 09:03:18 -0500 (EST) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 4FB0D8CA69; Wed, 24 Nov 2004 09:03:18 -0500 (EST) Original-To: Kai Grossjohann In-Reply-To: <86u0rfk2aa.fsf@ketchup.de.uu.net> (Kai Grossjohann's message of "Wed, 24 Nov 2004 10:46:21 +0100") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=0, requis 5) X-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30319 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30319 > It seems that it doesn't work to specify ("# " . "") for comments: > Debugger entered--Lisp error: (args-out-of-range "" 0) > generic-mode-set-comments((("# " . ""))) > generic-mode-internal(baselib-config-mode (("# " . "")) ("include") nil nil) > baselib-config-mode() > set-auto-mode-0(baselib-config-mode nil) > set-auto-mode() > normal-mode(t) > after-find-file(nil nil t t nil) > revert-buffer(t) > call-interactively(revert-buffer) > Specifying ("# " . nil) instead works as I intended ("# " . "") to work. > Shouldn't the documentation say that comment-end is handled specially? Well, the documentation suggests that the accepted values are the same as the ones for comment-end, so the empty string should be accepted. Does the following patch fix it for you? Stefan --- generic.el 18 sep 2004 17:24:29 -0400 1.24 +++ generic.el 24 nov 2004 09:01:25 -0500 @@ -289,13 +289,14 @@ ;; Go through all the comments (dolist (start comment-list) - (let ((end ?\n) (comstyle "")) + (let ((end nil) (comstyle "")) ;; Normalize (when (consp start) (setq end (or (cdr start) end)) (setq start (car start))) (when (char-valid-p start) (setq start (char-to-string start))) (when (char-valid-p end) (setq end (char-to-string end))) + (when (zerop (length end)) (setq end "\n")) ;; Setup the vars for `comment-region' (if comment-start @@ -414,5 +415,5 @@ (provide 'generic) -;;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea +;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea ;;; generic.el ends here