From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: letters@hotpop.com (Jari Aalto+mail.emacs) Newsgroups: gmane.emacs.bugs Subject: [patch] 21.3 newcomment.el - comment-end fix Date: Thu, 26 Jun 2003 21:32:17 +0300 Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1056654523 6506 80.91.224.249 (26 Jun 2003 19:08:43 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 26 Jun 2003 19:08:43 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 26 21:08:37 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Vc6m-0001gA-00 for ; Thu, 26 Jun 2003 21:08:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.20) id 19Vbos-0006Rv-1y for gnu-bug-gnu-emacs@m.gmane.org; Thu, 26 Jun 2003 14:50:06 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.20) id 19VbhN-0004VS-FF for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 14:42:21 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.20) id 19Vbdg-0003Vi-KQ for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 14:38:36 -0400 Original-Received: from fep06-0.kolumbus.fi ([193.229.0.57] helo=fep06-app.kolumbus.fi) by monty-python.gnu.org with esmtp (Exim 4.20) id 19VbRR-0000Sv-IS for bug-gnu-emacs@prep.ai.mit.edu; Thu, 26 Jun 2003 14:25:53 -0400 Original-Received: from poboxes.com ([81.197.1.6]) by fep06-app.kolumbus.fi with ESMTP id <20030626182550.JGCQ22040.fep06-app.kolumbus.fi@poboxes.com> for ; Thu, 26 Jun 2003 21:25:50 +0300 Original-To: gnu.emacs.bug X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:5403 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:5403 With auto-fill-mode + newcomment.el, it seems to have troubles if comment-end is not set. I do not have the error message at hand any more, but the changes should be obvious. My papers should be there at FSF. Jari 2003-06-26 Thu Jari Aalto * newcomment.el (comment-normalize-vars): 1.1.1.1 Added safegueard against nil `comment-end'. Index: newcomment.el =================================================================== RCS file: /cygdrive/h/data/version-control/cvsroot/emacs/gnu-emacs/lisp213/newcomment.el,v retrieving revision 1.1.1.1 diff -u -IId: -b -w -u -r1.1.1.1 newcomment.el --- newcomment.el 26 Jun 2003 18:06:13 -0000 1.1.1.1 +++ newcomment.el 26 Jun 2003 18:22:24 -0000 @@ -206,13 +206,18 @@ (comment-string-strip (concat (nreverse (string-to-list s))) nil t)) (defun comment-normalize-vars (&optional noerror) - (if (not comment-start) (or noerror (error "No comment syntax is defined")) + (if (not comment-start) + (or noerror (error "No comment syntax is defined")) ;; comment-use-syntax (when (eq comment-use-syntax 'undecided) (set (make-local-variable 'comment-use-syntax) (let ((st (syntax-table)) (cs comment-start) - (ce (if (string= "" comment-end) "\n" comment-end))) + (ce (if (or (null comment-end) + (and (stringp comment-end) + (string= "" comment-end))) + "\n" + comment-end))) ;; Try to skip over a comment using forward-comment ;; to see if the syntax tables properly recognize it. (with-temp-buffer @@ -220,15 +225,19 @@ (insert cs " hello " ce) (goto-char (point-min)) (and (forward-comment 1) (eobp)))))) + (unless comment-end + (setq comment-end "")) ;; comment-padding - (unless comment-padding (setq comment-padding 0)) + (unless comment-padding + (setq comment-padding 0)) (when (integerp comment-padding) (setq comment-padding (make-string comment-padding ? ))) ;; comment markers ;;(setq comment-start (comment-string-strip comment-start t nil)) ;;(setq comment-end (comment-string-strip comment-end nil t)) ;; comment-continue - (unless (or comment-continue (string= comment-end "")) + (unless (or comment-continue + (string= comment-end "")) (set (make-local-variable 'comment-continue) (concat (if (string-match "\\S-\\S-" comment-start) " " "|") (substring comment-start 1))))