From e1f0a6d2e83242f6fabf1381f31321e115782b34 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sat, 6 Jun 1998 22:23:57 +0000 Subject: [PATCH] (comment-region): Check for enough chars to delete in the numrg != t case as in the numar = t case. --- lisp/simple.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 45b68b65599..ca083f963d5 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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]*$") () -- 2.39.2