[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 85fda70 039/468: Add patch from Olivier Andrieu f
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 85fda70 039/468: Add patch from Olivier Andrieu for rudimentary long bracket support |
Date: |
Thu, 5 Aug 2021 04:58:04 -0400 (EDT) |
branch: elpa/lua-mode
commit 85fda701e1f8cbfbe9b02330acbbd32addeee222
Author: juergen <juergen>
Commit: juergen <juergen>
Add patch from Olivier Andrieu for rudimentary long bracket support
---
lua-mode.el | 40 ++++++++++++++++++++++++++--------------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 92d5513..25ee419 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -35,16 +35,16 @@
;;; Commentary:
-;; Thanks to Tobias Polzin <polzin<at>gmx.de> for function indenting
+;; Thanks to Tobias Polzin <polzin@gmx.de> for function indenting
;; patch: Indent "(" like "{"
-;; Thanks to Fabien <fleutot<at>gmail.com> for imenu patches.
+;; Thanks to Fabien <fleutot@gmail.com> for imenu patches.
-;; Special Thanks to Simon Marshall <simonm@mail.esrin.esa.it> for
-;; font-lock patches.
+;; Thanks to Simon Marshall <simonm@mail.esrin.esa.it> and Olivier
+;; Andrieu <oandrieu@gmail.com> for font-lock patches.
;; Additional font-lock highlighting and indentation tweaks by
-;; Adam D. Moss <adam@gimp.org> <aspirin@icculus.org>
+;; Adam D. Moss <adam@gimp.org>.
;; INSTALLATION:
@@ -203,14 +203,6 @@ traceback location."
'("\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)[ \t]*=[
\t]*\\(function\\)\\>"
(1 font-lock-function-name-face nil t) (3 font-lock-keyword-face))
- ;; Long comment blocks.
- '("\\(?:^\\|[^-]\\)\\(--\\[\\(=*\\)\\[\\(?:.\\|\n\\)*?\\]\\2\\]\\)"
- (1 font-lock-comment-face t))
-
- ;; Long strings.
- '("\\(?:^\\|[^[-]\\)\\(\\[\\(=*\\)\\[\\(?:.\\|\n\\)*?\\]\\2\\]\\)"
- (1 font-lock-string-face t))
-
;; Keywords.
(concat "\\<"
(regexp-opt '("and" "break" "do" "else" "elseif" "end" "false"
@@ -221,6 +213,23 @@ traceback location."
"Default expressions to highlight in Lua mode.")))
+;; FIXME: Match the correct number of equals signs between open and close long
brackets
+(defvar lua-fls-keywords
+ '(("\\(-\\)-\\[=*\\[\\|\\(\\[\\)=*\\[" (1 "|" t t) (2 "|" t t))
+ ("\\]=*\\(\\]\\)" . (1 "|"))))
+
+(defun lua-fls-face-function (s)
+ (let ((in-string (nth 3 s))
+ (start (nth 8 s)))
+ (if in-string
+ (save-excursion
+ (goto-char start)
+ (if (looking-at "--\\[=*\\[")
+ 'font-lock-comment-face
+ 'font-lock-string-face))
+ 'font-lock-comment-face)))
+
+
(defvar lua-imenu-generic-expression
'((nil "^[ \t]*\\(?:local[ \t]+\\)?function[
\t]+\\(\\(\\sw:\\|\\sw_\\|\\sw\\.\\|\\sw\\)+\\)" 1))
"Imenu generic expression for lua-mode. See `imenu-generic-expression'.")
@@ -271,7 +280,10 @@ The following keys are bound:
(set (make-local-variable 'comment-start) "--")
(set (make-local-variable 'comment-start-skip) "--")
(set (make-local-variable 'font-lock-defaults)
- '(lua-font-lock-keywords nil nil ((?_ . "w"))))
+ '(lua-font-lock-keywords
+ nil nil ((?_ . "w")) nil
+ (font-lock-syntactic-keywords .
lua-fls-keywords)
+ (font-lock-syntactic-face-function .
lua-fls-face-function)))
(set (make-local-variable 'imenu-generic-expression)
lua-imenu-generic-expression)
(setq local-abbrev-table lua-mode-abbrev-table)
- [nongnu] elpa/lua-mode e10183d 037/468: handle font-lock-variable-name-face (Reuben Thomas), (continued)
- [nongnu] elpa/lua-mode e10183d 037/468: handle font-lock-variable-name-face (Reuben Thomas), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ab2d44c 038/468: Multiple changes by Reuben Thomas:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e057e22 044/468: Rename install.rst to README to help github and users., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b20ca34 051/468: Add note to send update to ELPA., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode afdf074 053/468: Make defcustom declaration formats consistent., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ec1a0f2 063/468: Remove extraneous variable lua-indent-whitespace, use back-to-indentation instead, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 47ac4f3 056/468: Don't have the echo command printed itself., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a52e6b1 070/468: lua-left-shift-regexp: optimize and greatly reduce size, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5fa9b81 077/468: lua-indent-line: don't change the indent if inside multiline string literal, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode aedf8a5 018/468: Documentation in restructured text, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 85fda70 039/468: Add patch from Olivier Andrieu for rudimentary long bracket support,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode cf9de96 031/468: Reverted invalid changes for Bug #620, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 04fb034 009/468: lua-jump-to-traceback: Issue warnings about truncated traceback, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0ae7e3e 016/468: Handle function names in assignments, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 89dbb80 020/468: imenu fix for local functions, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bdf4bab 025/468: support for hideshow, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d7c462a 030/468: Fix bug #620: Wrong identation with tables, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eebb50c 035/468: Fix #1913: Indenting: "(" like "{", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode fc0a1e3 036/468: Changes/Fixes by Reuben Thomas:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode de08e4b 028/468: Added version comment for Tom Tromeys package.el, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 676f0a6 045/468: Sync with reality., Philip Kaludercic, 2021/08/05