emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/lua-mode 694421c 274/468: Add lua-remove-syntax-table-prop


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 694421c 274/468: Add lua-remove-syntax-table-property to syntactic keywords
Date: Thu, 5 Aug 2021 04:58:52 -0400 (EDT)

branch: elpa/lua-mode
commit 694421c383d7e92ebb38805a72df4f1e24f99d40
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>

    Add lua-remove-syntax-table-property to syntactic keywords
    
    Sometimes font-lock doesn't unfontify the region when applying syntactic
    keywords and that broke multiline literal recognition.
---
 lua-mode.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lua-mode.el b/lua-mode.el
index c4f087d..96cfbfd 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -871,8 +871,21 @@ If none can be found before reaching LIMIT, return nil."
   (or (lua-try-match-multiline-end limit)
       (lua-try-match-multiline-begin limit)))
 
+(defun lua-remove-syntax-table-property (limit)
+  "Remove syntax-table property on given region.
+
+This is a workaround for `font-lock-default-fontify-region'
+sometimes forgetting to unpropertize region which may cause
+multiline recognition to fail.
+
+Returns nil so that it's only called once as a syntactic keyword.
+"
+  (remove-text-properties (point) limit '(syntax-table))
+  nil)
+
 (defvar lua-font-lock-syntactic-keywords
-  '((lua-match-multiline-literal-bounds
+  '((lua-remove-syntax-table-property nil)
+    (lua-match-multiline-literal-bounds
      (1 "!" nil noerror)
      (2 "|" nil noerror))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]