[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28428: comment-search-backward with no comments
From: |
Stefan Monnier |
Subject: |
bug#28428: comment-search-backward with no comments |
Date: |
Fri, 22 Sep 2017 12:40:58 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> (if (not (re-search-backward comment-start-skip limit t))
> - (unless noerror (error "No comment"))
> + (progn
> + (goto-char limit)
> + (unless noerror (error "No comment")))
That looks fine, thank you. But I think the simpler patch below works
as well:
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index be6dbe3a4c..e32966e596 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -524,7 +524,7 @@ comment-search-backward
;; comment-search-backward is only used to find the comment-column (in
;; 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))
+ (if (not (re-search-backward comment-start-skip limit 'move))
(unless noerror (error "No comment"))
(beginning-of-line)
(let* ((end (match-end 0))
I wonder if there's code out there that depends on this behavior, tho,
since AFAIK it's been behaving this way "forever".
Stefan