From eb8e32c6fe4a3d08be8b856b3ff4a300a2e69d4b Mon Sep 17 00:00:00 2001 From: "N. Raghavendra" Date: Tue, 12 Sep 2017 01:41:16 +0530 Subject: [PATCH] comment-search-backword: move point when there is no comment * lisp/newcomment.el (comment-search-backward): Move point to LIMIT when there is no comment between LIMIT and point. --- lisp/newcomment.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 8772b523..d849fc1 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -525,7 +525,9 @@ comment-search-backward ;; comment-set-column) and to find the comment-start string (via ;; comment-beginning) in indent-new-comment-line, it should be harmless. (if (not (re-search-backward comment-start-skip limit t)) - (unless noerror (error "No comment")) + (progn + (goto-char limit) + (unless noerror (error "No comment"))) (beginning-of-line) (let* ((end (match-end 0)) (cs (comment-search-forward end t)) -- 2.7.4