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

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

[nongnu] elpa/lua-mode 3c8cfe6 160/468: Add credit, reformat new code to


From: Philip Kaludercic
Subject: [nongnu] elpa/lua-mode 3c8cfe6 160/468: Add credit, reformat new code to fit into 77 cols
Date: Thu, 5 Aug 2021 04:58:28 -0400 (EDT)

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

    Add credit, reformat new code to fit into 77 cols
---
 lua-mode.el | 47 +++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/lua-mode.el b/lua-mode.el
index 2e9bb4b..5555cb2 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -38,6 +38,9 @@
 
 ;;; Commentary:
 
+;; Thanks to d87 <github.com/d87> for an idea of highlighting lua
+;; builtins/numbers
+
 ;; Thanks to Vedat Hallac <github.com/vhallac> for sharing some of
 ;; his fixes and updates to core indentation logics
 
@@ -295,27 +298,36 @@ traceback location."
                          "match" "rep" "reverse" "sub" "upper"))
             ("table" . ("concat" "insert" "maxn" "pack" "remove" "sort" 
"unpack")))))
 
-      ;; This code uses \\< and \\> to delimit builtin symbols instead of \\_< 
and \\_>, because --
-      ;; a necessity -- '.' syntax class is hacked to 'symbol' and \\_> won't 
detect a symbol
-      ;; boundary in 'foo.bar' and -- sufficiency -- conveniently, underscore 
'_' is hacked to count
-      ;; as word constituent, but only for font-locking. Neither of these 
hacks makes sense to me,
-      ;; I'm going to wipe them out as soon as I'm sure that indentation won't 
get hurt. --immerrr
+      ;; This code uses \\< and \\> to delimit builtin symbols instead of
+      ;; \\_< and \\_>, because -- a necessity -- '.' syntax class is hacked
+      ;; to 'symbol' and \\_> won't detect a symbol boundary in 'foo.bar' and
+      ;; -- sufficiency -- conveniently, underscore '_' is hacked to count as
+      ;; word constituent, but only for font-locking. Neither of these hacks
+      ;; makes sense to me, I'm going to wipe them out as soon as I'm sure
+      ;; that indentation won't get hurt. --immerrr
       ;;
-      (flet ((module-name-re (x) (concat "\\(?1:\\<" (if (listp x) (car x) x) 
"\\>\\)"))
-             (module-members-re (x) (if (listp x)
-                                        (concat "\\(?:[ \t]*\\.[ \t]*\\<\\(?2:"
-                                                (regexp-opt (cdr x))
-                                                "\\)\\>\\)?")
-                                      "")))
+      (flet
+          ((module-name-re (x)
+                           (concat "\\(?1:\\<"
+                                   (if (listp x) (car x) x)
+                                   "\\>\\)"))
+           (module-members-re (x) (if (listp x)
+                                      (concat "\\(?:[ \t]*\\.[ \t]*"
+                                              "\\<\\(?2:"
+                                              (regexp-opt (cdr x))
+                                              "\\)\\>\\)?")
+                                    "")))
 
         (concat
-         ;; common prefix - beginning-of-line or neither of [ '.', ':' ] to 
exclude "foo.string.rep"
+         ;; common prefix - beginning-of-line or neither of [ '.', ':' ] to
+         ;; exclude "foo.string.rep"
          "\\(?:\\`\\|[^:. \n\t]\\)"
          ;; optional whitespace
          "[ \n\t]*"
          "\\(?:"
          ;; any of modules/functions
-         (mapconcat (lambda (x) (concat "\\(?:" (module-name-re x) 
(module-members-re x) "\\)"))
+         (mapconcat (lambda (x) (concat (module-name-re x)
+                                        (module-members-re x)))
                     modules
                     "\\|")
          "\\)"))))
@@ -352,7 +364,14 @@ index of respective Lua reference manuals.")
      '("\\_<0x[[:xdigit:]]+\\_>" . font-lock-constant-face)
 
      ;; regular numbers
-     
'("\\_<\\(?1:\\(?:\\(?:[0-9]+\\.?[0-9]*\\|[0-9]*\\.?[0-9]+\\)\\(?:[eE][+-]?[0-9]+\\)?\\)\\)\\_>"
+     ;;
+     ;; This regexp relies on '.' being symbol constituent. Whenever this
+     ;; changes, the regexp needs revisiting --immerrr
+     `(,(concat "\\_<\\(?1:"
+                ;; make a digit on either side of dot mandatory
+                "\\(?:[0-9]+\\.?[0-9]*\\|[0-9]*\\.?[0-9]+\\)"
+                "\\(?:[eE][+-]?[0-9]+\\)?"
+                "\\)\\_>")
        . font-lock-constant-face)
 
      ;; Keywords.



reply via email to

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