]> git.eshelyaron.com Git - emacs.git/commitdiff
(comment-region): Check for enough chars to delete
authorRichard M. Stallman <rms@gnu.org>
Sat, 6 Jun 1998 22:23:57 +0000 (22:23 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 6 Jun 1998 22:23:57 +0000 (22:23 +0000)
in the numrg != t case as in the numar = t case.

lisp/simple.el

index 45b68b655993bb8bfe3601d72fa17d96c74d6e62..ca083f963d5cdfba68189891c7fdd20f01f15a26 100644 (file)
@@ -2769,10 +2769,11 @@ not end the comment.  Blank lines do not get comments."
                        ;; this is questionable if comment-end ends in whitespace
                        ;; that is pretty brain-damaged though
                        (skip-chars-backward " \t")
-                       (save-excursion
-                         (backward-char (length ce))
-                         (if (looking-at (regexp-quote ce))
-                             (delete-char (length ce))))))))
+                       (if (>= (- (point) (point-min)) (length ce))
+                           (save-excursion
+                             (backward-char (length ce))
+                             (if (looking-at (regexp-quote ce))
+                                 (delete-char (length ce)))))))))
                (forward-line 1))
            ;; Insert at beginning and at end.
             (if (looking-at "[ \t]*$") ()