[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode d4ee03e 278/468: Use syntax-propertize-function i
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode d4ee03e 278/468: Use syntax-propertize-function if it is available |
Date: |
Thu, 5 Aug 2021 04:58:52 -0400 (EDT) |
branch: elpa/lua-mode
commit d4ee03edad67efcf7d8c054c6dc8f27e848a6c5a
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Use syntax-propertize-function if it is available
font-lock-syntactic-keywords aren't considered if font-lock-mode is off.
---
lua-mode.el | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 1c772f9..2555da4 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -717,8 +717,13 @@ Groups 6-9 can be used in any of argument regexps."
nil ;; syntax-alist
nil ;; syntax-begin
))
- (lua--setq-local
- font-lock-syntactic-keywords 'lua-font-lock-syntactic-keywords)
+
+ (if (boundp 'syntax-propertize-function)
+ (lua--setq-local syntax-propertize-function
+ 'lua--propertize-multiline-bounds)
+ (with-no-warnings
+ (lua--setq-local
+ font-lock-syntactic-keywords 'lua-font-lock-syntactic-keywords)))
(lua--setq-local font-lock-extra-managed-props '(syntax-table))
(lua--setq-local parse-sexp-lookup-properties t)
(lua--setq-local indent-line-function 'lua-indent-line)
@@ -896,6 +901,22 @@ Returns nil so that it's only called once as a syntactic
keyword.
(1 "!" nil noerror)
(2 "|" nil noerror))))
+
+(defun lua--propertize-multiline-bounds (start end)
+ "Put text properties on beginnings and ends of multiline literals.
+
+Intended to be used as a `syntax-propertize-function'."
+ (save-excursion
+ (goto-char start)
+ (while (lua-match-multiline-literal-bounds end)
+ (when (match-beginning 1)
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'syntax-table (string-to-syntax "!")))
+ (when (match-beginning 2)
+ (put-text-property (match-beginning 2) (match-end 2)
+ 'syntax-table (string-to-syntax "|"))))))
+
+
(defun lua-indent-line ()
"Indent current line for Lua mode.
Return the amount the indentation changed by."
- [nongnu] elpa/lua-mode 9e200e8 247/468: Fix font-locking of functions with underscores (issue #63), (continued)
- [nongnu] elpa/lua-mode 9e200e8 247/468: Fix font-locking of functions with underscores (issue #63), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bbab5a6 253/468: Don't anchor arglist continuation to block openers, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d86a22 254/468: Fix indentation error raised if 'else' is on the same line as 'if', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2ad2ac8 256/468: lua-imenu-generic-expression add support for local function, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8ff3427 257/468: Merge pull request #65 from guoxx/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78f0e09 260/468: Make sure nested token searches begin from open-token positions, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2cdfda7 264/468: Add inferior-test.el with some basic (failing) tests, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d166d5e 267/468: Merge remote-tracking branch 'upstream/master', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d52e291 270/468: Don't fontify "stdin:N:" stacktrace entries in REPL buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ec1b634 271/468: Bump NEWS, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d4ee03e 278/468: Use syntax-propertize-function if it is available,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode fd0f6ba 280/468: Merge pull request #69 from atomontage/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 694421c 274/468: Add lua-remove-syntax-table-property to syntactic keywords, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b73794f 276/468: Merge pull request #79 from j-fu/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 13f6ffa 277/468: Provide lua--setq-local fallback macro for pre-24.3, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ce0a813 282/468: Mention xristos in AUTHORS, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6d66aee 284/468: Redo handling of "stdin:N" in tracebacks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d7855bc 285/468: remove function lua-comment-p, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5995697 286/468: Merge pull request #81 from v2e4lisp/remove-lua-comment-p, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8a37fce 288/468: Merge pull request #82 from holomorph/browse-url, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c3b103d 290/468: lua-beginning-of-proc: improve defun header regex, Philip Kaludercic, 2021/08/05