branch: externals/a68-mode
commit 20a24f25a904b119e599ab5067eec64dd5e5c7c8
Author: Jose E. Marchesi <jose.march...@oracle.com>
Commit: Jose E. Marchesi <jose.march...@oracle.com>

    Install syntax-multiline properties in comment blocks
---
 a68-mode.el | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/a68-mode.el b/a68-mode.el
index 6be7832c26..971a7d04bf 100644
--- a/a68-mode.el
+++ b/a68-mode.el
@@ -302,17 +302,23 @@
            (*? anychar)
            (group "#"))
        (1 (when (not (a68-within-string)) (string-to-syntax "<")))
-       (2 (when (not (a68-within-string)) (string-to-syntax ">"))))
+       (2 (when (not (a68-within-string)) (string-to-syntax ">")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t))))
       ((rx bow (group "C") "OMMENT" eow
            (*? anychar)
            bow "COMMEN" (group "T") eow)
        (1 (when (not (a68-within-string)) (string-to-syntax "< b")))
-       (2 (when (not (a68-within-string)) (string-to-syntax "> b"))))
+       (2 (when (not (a68-within-string)) (string-to-syntax "> b")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t))))
       ((rx bow (group "C") "O" eow
            (*? anychar)
            bow "C" (group "O") eow)
        (1 (when (not (a68-within-string)) (string-to-syntax "< c")))
-       (2 (when (not (a68-within-string)) (string-to-syntax "> c")))))
+       (2 (when (not (a68-within-string)) (string-to-syntax "> c")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t)))))
      (point) end)))
 
 ;;;; SUPPER stropping.
@@ -475,25 +481,25 @@
            (*? anychar)
            (group "#"))
        (1 (when (not (a68-within-string)) (string-to-syntax "<")))
-       (2 (when (not (a68-within-string)) (string-to-syntax ">"))))
+       (2 (when (not (a68-within-string)) (string-to-syntax ">")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t))))
       ((rx bow (group "c") "omment" eow
            (*? anychar)
            bow "commen" (group "t") eow)
        (1 (when (not (a68-within-string)) (string-to-syntax "< b")))
-       (2 (when (not (a68-within-string)) (string-to-syntax "> b"))))
+       (2 (when (not (a68-within-string)) (string-to-syntax "> b")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t))))
       ((rx bow (group "c") "o" eow
            (*? anychar)
            bow "c" (group "o") eow)
        (1 (when (not (a68-within-string)) (string-to-syntax "< c")))
-       (2 (when (not (a68-within-string)) (string-to-syntax "> c")))))
+       (2 (when (not (a68-within-string)) (string-to-syntax "> c")))
+       (0 (ignore (put-text-property (match-beginning 0) (match-end 0)
+                                     'syntax-multiline t)))))
      (point) end)))
 
-;;;; Syntax highlighting functions
-
-(defun a68--syntax-propertize-wholebuffer (beg end)
-  "Let `syntax-propertize' pay attention to the syntax-multiline property."
-  (cons (point-min) (point-max)))
-
 ;;;; The major mode.
 
 ;;;###autoload
@@ -520,8 +526,10 @@
     (setq-local beginning-of-defun-function #'a68-beginning-of-defun-upper)
     (setq-local syntax-propertize-function 
#'a68-syntax-propertize-function-upper))
   (add-hook 'after-change-functions #'a68--after-change-function nil t)
+;  (add-hook 'syntax-propertize-extend-region-functions
+;            #'a68--syntax-propertize-wholebuffer 'append 'local)
   (add-hook 'syntax-propertize-extend-region-functions
-            #'a68--syntax-propertize-wholebuffer 'append 'local)
+            #'syntax-propertize-multiline 'append 'local)
   (setq-local comment-start a68-comment-style)
   (setq-local comment-end a68-comment-style))
 

Reply via email to