bug-gnu-emacs
[Top][All Lists]
Advanced

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

[patch] 21.3 newcomment.el - comment-end fix


From: Jari Aalto+mail.emacs
Subject: [patch] 21.3 newcomment.el - comment-end fix
Date: Thu, 26 Jun 2003 21:32:17 +0300

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  <address@hidden>

        * 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))))





reply via email to

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