changeset 54276:0c512d4c08e1

(uncomment-region): Allow non-terminated comment.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 04 Mar 2004 19:20:35 +0000
parents f4b54db9c8ae
children d6041d05bc86
files lisp/newcomment.el
diffstat 1 files changed, 4 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/newcomment.el	Thu Mar 04 18:19:19 2004 +0000
+++ b/lisp/newcomment.el	Thu Mar 04 19:20:35 2004 +0000
@@ -1,6 +1,6 @@
 ;;; newcomment.el --- (un)comment regions of buffers
 
-;; Copyright (C) 1999,2000,2003  Free Software Foundation Inc.
+;; Copyright (C) 1999,2000,2003,2004  Free Software Foundation Inc.
 
 ;; Author: code extracted from Emacs-20's simple.el
 ;; Maintainer: Stefan Monnier <monnier@cs.yale.edu>
@@ -716,35 +716,9 @@
 		;; Find the end of the comment.
 		(ept (progn
 		       (goto-char spt)
-		       (unless
-			   (or
-			    (comment-forward)
-			    ;; Allow eob as comment-end instead of \n.
-			    (and
-			     (eobp)
-			     (let ((s1 (aref (syntax-table) (char-after spt)))
-				   (s2 (aref (syntax-table)
-					     (or (char-after (1+ spt)) 0)))
-				   (sn (aref (syntax-table) ?\n))
-				   (flag->b (car (string-to-syntax "> b")))
-				   (flag-1b (car (string-to-syntax "  1b")))
-				   (flag-2b (car (string-to-syntax "  2b"))))
-			       (cond
-				;; One-character comment-start terminated by
-				;; \n.
-				((and
-				  (equal sn (string-to-syntax ">"))
-				  (equal s1 (string-to-syntax "<")))
-				 (insert-char ?\n 1)
-				 t)
-				;; Two-character type b comment-start
-				;; terminated by \n.
-				((and
-				  (= (logand (car sn) flag->b) flag->b)
-				  (= (logand (car s1) flag-1b) flag-1b)
-				  (= (logand (car s2) flag-2b) flag-2b))
-				 (insert-char ?\n 1)
-				 t)))))
+		       (unless (or (comment-forward)
+				   ;; Allow non-terminated comments.
+				   (eobp))
 			 (error "Can't find the comment end"))
 		       (point)))
 		(box nil)