From: Richard M. Stallman Date: Sat, 6 Jun 1998 22:23:57 +0000 (+0000) Subject: (comment-region): Check for enough chars to delete X-Git-Tag: emacs-20.3~703 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e1f0a6d2e83242f6fabf1381f31321e115782b34;p=emacs.git (comment-region): Check for enough chars to delete in the numrg != t case as in the numar = t case. --- 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]*$") ()