summaryrefslogtreecommitdiff
path: root/lisp/newcomment.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2014-03-17 08:48:09 +0200
committerDmitry Gutov <dgutov@yandex.ru>2014-03-17 08:48:09 +0200
commit218feefcc075f3da15c87f06fa418048ffe5ae3a (patch)
tree6b2bfcf66218596a34a01fa0092700f1a455eaff /lisp/newcomment.el
parent4f8aeb84b61f3be4eb0b5a7e3be0f7f8e9d5200e (diff)
downloademacs-218feefcc075f3da15c87f06fa418048ffe5ae3a.tar.gz
Restore compatibility with legacy comment-start-skip values
* lisp/newcomment.el (comment-beginning): If `comment-start-skip' doesn't match, move back one char and try again. Fixes: debbugs:16971
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r--lisp/newcomment.el7
1 files changed, 6 insertions, 1 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index 710dc74077d..44e270a66ea 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -523,7 +523,12 @@ the same as `comment-search-backward'."
(when (nth 4 state)
(goto-char (nth 8 state))
(prog1 (point)
- (when (looking-at comment-start-skip)
+ (when (or (looking-at comment-start-skip)
+ ;; Some older modes use regexps that check the
+ ;; char before the comment for quoting. (Bug#16971)
+ (save-excursion
+ (forward-char -1)
+ (looking-at comment-start-skip)))
(goto-char (match-end 0))))))
;; Can't rely on the syntax table, let's guess based on font-lock.
(unless (eq (get-text-property (point) 'face) 'font-lock-string-face)