unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* [patch] 21.3 newcomment.el - comment-end fix
@ 2003-06-26 18:32 Jari Aalto+mail.emacs
  0 siblings, 0 replies; only message in thread
From: Jari Aalto+mail.emacs @ 2003-06-26 18:32 UTC (permalink / raw)



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  <jari.aalto@poboxes.com>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-06-26 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-26 18:32 [patch] 21.3 newcomment.el - comment-end fix Jari Aalto+mail.emacs

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).