[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/sm-c-mode a3efebd 09/12: * sm-c-mode.el: Fix some prob
From: |
Stefan Monnier |
Subject: |
[elpa] externals/sm-c-mode a3efebd 09/12: * sm-c-mode.el: Fix some problems reported by Andrés Ramírez |
Date: |
Sat, 28 Nov 2020 18:11:08 -0500 (EST) |
branch: externals/sm-c-mode
commit a3efebd9e6c341892222ecf7f9b168decdee7954
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* sm-c-mode.el: Fix some problems reported by Andrés Ramírez
(sm-c-smie-rules): Avoid inf-looping on "case foo: {".
(sm-c--cpp-syntax-propertize): Treat trailing //...\n in CPP directive
as being outside the directive.
---
sm-c-mode.el | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/sm-c-mode.el b/sm-c-mode.el
index deaf952..0731203 100644
--- a/sm-c-mode.el
+++ b/sm-c-mode.el
@@ -150,8 +150,20 @@ no difference."
(with-syntax-table sm-c--cpp-syntax-table
(nth 4 (parse-partial-sexp (1+ (nth 8 ppss)) (point)))))))
(when found
- (put-text-property (1- (point)) (point)
- 'syntax-table (string-to-syntax "> c"))))))
+ (let* ((ppss-in
+ (save-excursion
+ (parse-partial-sexp (1+ (nth 8 ppss)) (1- (point)))))
+ ;; Put the end before a closing //...\n comment so as to avoid
+ ;; a bug in back_comment. The problem is that back_comment
+ ;; otherwise will see "// <...> <...> \n" and will consider the
+ ;; CPP pseudo-comments as nested within the //...\n comment.
+ (end (if (and (nth 4 ppss-in) ;Inside a comment.
+ (null (nth 7 ppss-in)) ;A style `a' comment.
+ (memq (char-before (nth 8 ppss-in)) '(?\s ?\t)))
+ (nth 8 ppss-in)
+ (point))))
+ (put-text-property (1- end) end
+ 'syntax-table (string-to-syntax "> c")))))))
;;;; Indenting CPP directives.
@@ -661,6 +673,7 @@ if INNER is non-nil, it stops at the innermost one."
(equal ")" (car (smie-indent-backward-token))))
(up-list -1)
`(column . ,(sm-c--smie-virtual)))))
+ ((>= (point) pos) nil)
(t `(column . ,(smie-indent-virtual))))))))
((smie-rule-hanging-p)
(cond
- [elpa] branch externals/sm-c-mode created (now a207ad8), Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 1f2c7ec 04/12: * sm-c-mode: Improve indentation of struct; plus bug fixes, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 9d2cff5 06/12: * packages/sm-c-mode: Add imenu/which-func/add-log support, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 97dea83 02/12: * sm-c-mode.el (sm-c-font-lock-keywords): Match function defs., Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 4c63cb1 03/12: * sm-c-mode.el: Auto-align backslashes. Improve indent rules, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 5e67afc 07/12: * sm-c-mode/sm-c-mode.el (sm-c-smie-rules): Improve indent of enum's {...}, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 3ef465d 11/12: * packages/sm-c-mode/sm-c-mode.el: Improve \ alignment with long lines, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode a207ad8 12/12: * .gitignore: New file, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode a3efebd 09/12: * sm-c-mode.el: Fix some problems reported by Andrés Ramírez,
Stefan Monnier <=
- [elpa] externals/sm-c-mode 5646e71 05/12: * sm-c-mode.el: Improve "Commentary:" and docstrings, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 3c3b1f7 08/12: * sm-c-mode.el (sm-c--comment-regexp): Fix excessive backtracking, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 3b5d1e0 01/12: * sm-c-mode: New experimental package, Stefan Monnier, 2020/11/28
- [elpa] externals/sm-c-mode 0fde734 10/12: * packages/sm-c-mode/sm-c-mode.el: Release as version 1.0, Stefan Monnier, 2020/11/28