aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjohn muhl2025-03-20 14:20:24 -0500
committerPo Lu2025-08-25 09:59:04 +0800
commit2fe72d48d35c421c8d1bf237a25c393e7fd80134 (patch)
tree8aa057e4de8de55e2d408e54c496840b4adc4df2
parent6465b3cbec50d5ab6e4c2822073f0826bc46d5f7 (diff)
downloademacs-2fe72d48d35c421c8d1bf237a25c393e7fd80134.tar.gz
emacs-2fe72d48d35c421c8d1bf237a25c393e7fd80134.zip
Cleanup whitespace in 'lua-mode'
-rw-r--r--lisp/progmodes/lua-mode.el29
1 files changed, 0 insertions, 29 deletions
diff --git a/lisp/progmodes/lua-mode.el b/lisp/progmodes/lua-mode.el
index c3dbc9560e6..56a2cb1fa6c 100644
--- a/lisp/progmodes/lua-mode.el
+++ b/lisp/progmodes/lua-mode.el
@@ -93,7 +93,6 @@
93;; See "M-x apropos-command ^lua-" for a list of commands. 93;; See "M-x apropos-command ^lua-" for a list of commands.
94;; See "M-x customize-group lua" for a list of customizable variables. 94;; See "M-x customize-group lua" for a list of customizable variables.
95 95
96
97;;; Code: 96;;; Code:
98(eval-when-compile 97(eval-when-compile
99 (require 'cl-lib) 98 (require 'cl-lib)
@@ -103,7 +102,6 @@
103(require 'newcomment) 102(require 'newcomment)
104(require 'rx) 103(require 'rx)
105 104
106
107;; rx-wrappers for Lua 105;; rx-wrappers for Lua
108 106
109(eval-and-compile 107(eval-and-compile
@@ -254,7 +252,6 @@ If the latter is nil, the keymap translates into `lua-mode-map' verbatim.")
254(defvar lua--electric-indent-chars 252(defvar lua--electric-indent-chars
255 (mapcar #'string-to-char '("}" "]" ")"))) 253 (mapcar #'string-to-char '("}" "]" ")")))
256 254
257
258(defvar lua-mode-map 255(defvar lua-mode-map
259 (let ((result-map (make-sparse-keymap))) 256 (let ((result-map (make-sparse-keymap)))
260 (unless (boundp 'electric-indent-chars) 257 (unless (boundp 'electric-indent-chars)
@@ -409,7 +406,6 @@ traceback location."
409This is a compilation of 5.1, 5.2 and 5.3 builtins taken from the 406This is a compilation of 5.1, 5.2 and 5.3 builtins taken from the
410index of respective Lua reference manuals.") 407index of respective Lua reference manuals.")
411 408
412
413(defvar lua-font-lock-keywords 409(defvar lua-font-lock-keywords
414 `(;; highlight the hash-bang line "#!/foo/bar/lua" as comment 410 `(;; highlight the hash-bang line "#!/foo/bar/lua" as comment
415 ("^#!.*$" . font-lock-comment-face) 411 ("^#!.*$" . font-lock-comment-face)
@@ -573,8 +569,6 @@ index of respective Lua reference manuals.")
573 ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end 569 ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
574 nil lua-forward-sexp)))) 570 nil lua-forward-sexp))))
575 571
576
577
578;;;###autoload 572;;;###autoload
579(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode)) 573(add-to-list 'auto-mode-alist '("\\.lua\\'" . lua-mode))
580 574
@@ -614,7 +608,6 @@ index of respective Lua reference manuals.")
614 (let ((fill-paragraph-handle-comment t)) 608 (let ((fill-paragraph-handle-comment t))
615 (fill-paragraph justify region)))) 609 (fill-paragraph justify region))))
616 610
617
618(defun lua-prefix-key-update-bindings () 611(defun lua-prefix-key-update-bindings ()
619 (let (old-cons) 612 (let (old-cons)
620 (if (eq lua-prefix-mode-map (keymap-parent lua-mode-map)) 613 (if (eq lua-prefix-mode-map (keymap-parent lua-mode-map))
@@ -684,7 +677,6 @@ If point is not inside string or comment, return nil."
684(defconst lua-ml-begin-regexp 677(defconst lua-ml-begin-regexp
685 "\\(?:\\(?1:-\\)-\\[\\|\\(?2:\\[\\)\\)\\(?3:=*\\)\\[") 678 "\\(?:\\(?1:-\\)-\\[\\|\\(?2:\\[\\)\\)\\(?3:=*\\)\\[")
686 679
687
688(defun lua-try-match-multiline-end (end) 680(defun lua-try-match-multiline-end (end)
689 "Try to match close-bracket for multiline literal around point. 681 "Try to match close-bracket for multiline literal around point.
690 682
@@ -706,7 +698,6 @@ information provided at point and re-search-forward to it."
706 (if (match-beginning 1) 1 2)) 698 (if (match-beginning 1) 1 2))
707 end 'noerror)))) 699 end 'noerror))))
708 700
709
710(defun lua-try-match-multiline-begin (limit) 701(defun lua-try-match-multiline-begin (limit)
711 "Try to match multiline open-brackets. 702 "Try to match multiline open-brackets.
712 703
@@ -751,7 +742,6 @@ Intended to be used as a `syntax-propertize-function'."
751 (put-text-property (match-beginning 2) (match-end 2) 742 (put-text-property (match-beginning 2) (match-end 2)
752 'syntax-table (string-to-syntax "|")))))) 743 'syntax-table (string-to-syntax "|"))))))
753 744
754
755(defun lua-indent-line () 745(defun lua-indent-line ()
756 "Indent current line for Lua mode. 746 "Indent current line for Lua mode.
757Return the amount the indentation changed by." 747Return the amount the indentation changed by."
@@ -794,7 +784,6 @@ Return the amount the indentation changed by."
794 0 784 0
795 lua-indent-level)))))) 785 lua-indent-level))))))
796 786
797
798(defun lua--signum (x) 787(defun lua--signum (x)
799 "Return 1 if X is positive, -1 if negative, 0 if zero." 788 "Return 1 if X is positive, -1 if negative, 0 if zero."
800 ;; XXX: backport from cl-extras for Emacs24 789 ;; XXX: backport from cl-extras for Emacs24
@@ -813,7 +802,6 @@ If point is beyond limit, move it onto limit."
813 (goto-char limit) 802 (goto-char limit)
814 nil)) 803 nil))
815 804
816
817(defun lua--escape-from-string (&optional backward) 805(defun lua--escape-from-string (&optional backward)
818 "Move point outside of string if it is inside one. 806 "Move point outside of string if it is inside one.
819 807
@@ -827,7 +815,6 @@ placed before the string."
827 (parse-partial-sexp (point) (line-end-position) nil nil (syntax-ppss) 'syntax-table)) 815 (parse-partial-sexp (point) (line-end-position) nil nil (syntax-ppss) 'syntax-table))
828 t))) 816 t)))
829 817
830
831(defun lua-find-regexp (direction regexp &optional limit) 818(defun lua-find-regexp (direction regexp &optional limit)
832 "Searches for a regular expression in the direction specified. 819 "Searches for a regular expression in the direction specified.
833 820
@@ -858,7 +845,6 @@ found, returns point position, nil otherwise."
858 (forward-comment 1))))) 845 (forward-comment 1)))))
859 finally return (point)))) 846 finally return (point))))
860 847
861
862(defconst lua-block-regexp 848(defconst lua-block-regexp
863 (eval-when-compile 849 (eval-when-compile
864 (concat 850 (concat
@@ -1081,7 +1067,6 @@ Return non-nil if moved point."
1081 (when (/= start-pos (point)) 1067 (when (/= start-pos (point))
1082 (point))))) 1068 (point)))))
1083 1069
1084
1085(defun lua-forward-line-skip-blanks (&optional back) 1070(defun lua-forward-line-skip-blanks (&optional back)
1086 "Move 1 line forward/backward and skip all insignificant ws/comment lines. 1071 "Move 1 line forward/backward and skip all insignificant ws/comment lines.
1087 1072
@@ -1177,7 +1162,6 @@ previous one even though it looked like an end-of-statement.")
1177 (setq return-value nil))) 1162 (setq return-value nil)))
1178 return-value))) 1163 return-value)))
1179 1164
1180
1181(defun lua-first-token-continues-p () 1165(defun lua-first-token-continues-p ()
1182 "Return non-nil if the first token on this line is a continuation token." 1166 "Return non-nil if the first token on this line is a continuation token."
1183 (let ((line-end (line-end-position))) 1167 (let ((line-end (line-end-position)))
@@ -1192,14 +1176,12 @@ previous one even though it looked like an end-of-statement.")
1192 (or (match-beginning 1) 1176 (or (match-beginning 1)
1193 (match-beginning 2)))))) 1177 (match-beginning 2))))))
1194 1178
1195
1196(defun lua--backward-up-list-noerror () 1179(defun lua--backward-up-list-noerror ()
1197 "Safe version of lua-backward-up-list that does not signal an error." 1180 "Safe version of lua-backward-up-list that does not signal an error."
1198 (condition-case nil 1181 (condition-case nil
1199 (lua-backward-up-list) 1182 (lua-backward-up-list)
1200 (scan-error nil))) 1183 (scan-error nil)))
1201 1184
1202
1203(defun lua-backward-up-list () 1185(defun lua-backward-up-list ()
1204 "Goto starter/opener of the block that contains point." 1186 "Goto starter/opener of the block that contains point."
1205 (interactive) 1187 (interactive)
@@ -1241,7 +1223,6 @@ previous one even though it looked like an end-of-statement.")
1241 "for" "local") 1223 "for" "local")
1242 lua-funcheader))))) 1224 lua-funcheader)))))
1243 1225
1244
1245(defun lua-is-continuing-statement-p-1 () 1226(defun lua-is-continuing-statement-p-1 ()
1246 "Return non-nil if current lined continues a statement. 1227 "Return non-nil if current lined continues a statement.
1247 1228
@@ -1276,7 +1257,6 @@ The criteria for a continuing statement are:
1276 (equal parent-block-opener "{"))))) 1257 (equal parent-block-opener "{")))))
1277 continuation-pos)))))) 1258 continuation-pos))))))
1278 1259
1279
1280(defun lua-is-continuing-statement-p (&optional parse-start) 1260(defun lua-is-continuing-statement-p (&optional parse-start)
1281 "Returns non-nil if the line at PARSE-START should be indented as continuation line. 1261 "Returns non-nil if the line at PARSE-START should be indented as continuation line.
1282 1262
@@ -1465,7 +1445,6 @@ Return list of indentation modifiers from point to BOUND."
1465 indentation-info)))) 1445 indentation-info))))
1466 indentation-info) 1446 indentation-info)
1467 1447
1468
1469(defun lua-calculate-indentation-info (&optional parse-end) 1448(defun lua-calculate-indentation-info (&optional parse-end)
1470 "For each block token on the line, computes how it affects the indentation. 1449 "For each block token on the line, computes how it affects the indentation.
1471The effect of each token can be either a shift relative to the current 1450The effect of each token can be either a shift relative to the current
@@ -1507,7 +1486,6 @@ and relative each, and the shift/column to indent to."
1507 1486
1508 indentation-info)) 1487 indentation-info))
1509 1488
1510
1511(defun lua-accumulate-indentation-info (reversed-indentation-info) 1489(defun lua-accumulate-indentation-info (reversed-indentation-info)
1512 "Accumulates the indentation information previously calculated by 1490 "Accumulates the indentation information previously calculated by
1513lua-calculate-indentation-info. Returns either the relative indentation 1491lua-calculate-indentation-info. Returns either the relative indentation
@@ -1552,7 +1530,6 @@ one."
1552 (- (cdr indentation-info) (current-indentation)) 1530 (- (cdr indentation-info) (current-indentation))
1553 (cdr indentation-info)))) 1531 (cdr indentation-info))))
1554 1532
1555
1556(eval-when-compile 1533(eval-when-compile
1557 (defconst lua--function-name-rx 1534 (defconst lua--function-name-rx
1558 '(seq symbol-start 1535 '(seq symbol-start
@@ -1562,7 +1539,6 @@ one."
1562 symbol-end) 1539 symbol-end)
1563 "Lua function name regexp in `rx'-SEXP format.")) 1540 "Lua function name regexp in `rx'-SEXP format."))
1564 1541
1565
1566(defconst lua--left-shifter-regexp 1542(defconst lua--left-shifter-regexp
1567 (eval-when-compile 1543 (eval-when-compile
1568 (rx 1544 (rx
@@ -1608,7 +1584,6 @@ The following left-shifter expressions are currently handled:
1608 - function call arguments block, () or {} block 1584 - function call arguments block, () or {} block
1609 - function expression a.k.a. lambda, begin-end block.") 1585 - function expression a.k.a. lambda, begin-end block.")
1610 1586
1611
1612(defun lua-point-is-after-left-shifter-p () 1587(defun lua-point-is-after-left-shifter-p ()
1613 "Check if point is right after a left-shifter expression. 1588 "Check if point is right after a left-shifter expression.
1614 1589
@@ -1644,7 +1619,6 @@ left-shifter expression. "
1644 (goto-char pos) 1619 (goto-char pos)
1645 return-val)))) 1620 return-val))))
1646 1621
1647
1648(defun lua-calculate-indentation-override (&optional parse-start) 1622(defun lua-calculate-indentation-override (&optional parse-start)
1649 "Return overriding indentation amount for special cases. 1623 "Return overriding indentation amount for special cases.
1650 1624
@@ -1692,7 +1666,6 @@ If not, return nil."
1692 (current-column) 1666 (current-column)
1693 (current-indentation)))))) 1667 (current-indentation))))))
1694 1668
1695
1696(defun lua-calculate-indentation () 1669(defun lua-calculate-indentation ()
1697 "Return appropriate indentation for current line as Lua code." 1670 "Return appropriate indentation for current line as Lua code."
1698 (save-excursion 1671 (save-excursion
@@ -1717,7 +1690,6 @@ If not, return nil."
1717 (lua-rx-to-string '(: bol (? (symbol "local") ws+) lua-funcheader)) 1690 (lua-rx-to-string '(: bol (? (symbol "local") ws+) lua-funcheader))
1718 "Lua top level (matches only at the beginning of line) function header regex.") 1691 "Lua top level (matches only at the beginning of line) function header regex.")
1719 1692
1720
1721(defun lua-beginning-of-proc (&optional arg) 1693(defun lua-beginning-of-proc (&optional arg)
1722 "Move backward to the beginning of a Lua proc (or similar). 1694 "Move backward to the beginning of a Lua proc (or similar).
1723 1695
@@ -1965,7 +1937,6 @@ Create a Lua process if one doesn't already exist."
1965 (interactive) 1937 (interactive)
1966 (display-buffer (process-buffer (lua-get-create-process)))) 1938 (display-buffer (process-buffer (lua-get-create-process))))
1967 1939
1968
1969(defun lua-hide-process-buffer () 1940(defun lua-hide-process-buffer ()
1970 "Delete all windows that display `lua-process-buffer'." 1941 "Delete all windows that display `lua-process-buffer'."
1971 (interactive) 1942 (interactive)