Amend c-backward-sws better to handle multiline block comments
In particular, multiline comments lacking escaped newlines. * lisp/progmodes/cc-engine.el (c-backward-sws): Whilst searching backward for a putative beginning of macro, move back over block comments whose innards lack escaped newlines.
This commit is contained in:
parent
7ceb45f61f
commit
efc9d4fe3e
1 changed files with 27 additions and 8 deletions
|
@ -327,6 +327,8 @@ comment at the start of cc-engine.el for more info."
|
||||||
(when (or (null lim)
|
(when (or (null lim)
|
||||||
(>= here lim))
|
(>= here lim))
|
||||||
(save-match-data
|
(save-match-data
|
||||||
|
;; Note the similarity of the code here to some in
|
||||||
|
;; `c-backward-sws'.
|
||||||
(while
|
(while
|
||||||
(progn
|
(progn
|
||||||
(while (eq (char-before (1- (point))) ?\\)
|
(while (eq (char-before (1- (point))) ?\\)
|
||||||
|
@ -2461,17 +2463,34 @@ comment at the start of cc-engine.el for more info."
|
||||||
(/= cmt-skip-pos simple-ws-beg)
|
(/= cmt-skip-pos simple-ws-beg)
|
||||||
(c-beginning-of-macro))
|
(c-beginning-of-macro))
|
||||||
;; Inside a cpp directive. See if it should be skipped over.
|
;; Inside a cpp directive. See if it should be skipped over.
|
||||||
(let ((cpp-beg (point)))
|
(let ((cpp-beg (point))
|
||||||
|
pause pos)
|
||||||
|
|
||||||
;; Move back over all line continuations in the region skipped
|
;; Move back over all line continuations and block comments in
|
||||||
;; over by `c-backward-comments'. If we go past it then we
|
;; the region skipped over by `c-backward-comments'. If we go
|
||||||
;; started inside the cpp directive.
|
;; past it then we started inside the cpp directive.
|
||||||
(goto-char simple-ws-beg)
|
(goto-char simple-ws-beg)
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(while (and (> (point) cmt-skip-pos)
|
;; Note the similarity of the code here to some in
|
||||||
(progn (backward-char)
|
;; `c-beginning-of-macro'.
|
||||||
(eq (char-before) ?\\)))
|
(setq pause (point))
|
||||||
(beginning-of-line))
|
(while
|
||||||
|
(progn
|
||||||
|
(while (and (> (point) cmt-skip-pos)
|
||||||
|
(progn (backward-char)
|
||||||
|
(eq (char-before) ?\\)))
|
||||||
|
(beginning-of-line))
|
||||||
|
(setq pos (point))
|
||||||
|
(when (and c-last-c-comment-end-on-line-re
|
||||||
|
(re-search-forward
|
||||||
|
c-last-c-comment-end-on-line-re pause t))
|
||||||
|
(goto-char (match-end 1))
|
||||||
|
(if (c-backward-single-comment)
|
||||||
|
(progn
|
||||||
|
(beginning-of-line)
|
||||||
|
(setq pause (point)))
|
||||||
|
(goto-char pos)
|
||||||
|
nil))))
|
||||||
|
|
||||||
(if (< (point) cmt-skip-pos)
|
(if (< (point) cmt-skip-pos)
|
||||||
;; Don't move past the cpp directive if we began inside
|
;; Don't move past the cpp directive if we began inside
|
||||||
|
|
Loading…
Add table
Reference in a new issue