[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 1f596a9 392/468: Merge pull request #161 from tar
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 1f596a9 392/468: Merge pull request #161 from tarsiiformes/lexical |
Date: |
Thu, 5 Aug 2021 04:59:15 -0400 (EDT) |
branch: elpa/lua-mode
commit 1f596a93b3f1caadd7bba01030f8c179b029600b
Merge: dc30240 3c9ec08
Author: immerrr again <immerrr+lua@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #161 from tarsiiformes/lexical
Use proper lexical-bindings instead of lexical-let*
---
lua-mode.el | 46 +++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index d289dc3..640e490 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1,4 +1,4 @@
-;;; lua-mode.el --- a major-mode for editing Lua scripts
+;;; lua-mode.el --- a major-mode for editing Lua scripts -*- lexical-binding:
t -*-
;; Author: 2011-2013 immerrr <immerrr+lua@gmail.com>
;; 2010-2011 Reuben Thomas <rrt@sc3d.org>
@@ -13,6 +13,7 @@
;;
;; URL: http://immerrr.github.com/lua-mode
;; Version: 20151025
+;; Package-Requires: ((emacs "24.3"))
;;
;; This file is NOT part of Emacs.
;;
@@ -86,7 +87,7 @@
;;; Code:
(eval-when-compile
- (require 'cl))
+ (require 'cl-lib))
(require 'comint)
(require 'newcomment)
@@ -170,8 +171,7 @@ FORM is a cons (NAME . DEFN), see more in `rx-constituents'
doc.
This function enables specifying new definitions using old ones:
if DEFN is a list that starts with `:rx' symbol its second
element is itself expanded with `lua-rx-to-string'. "
- (let ((name (car form))
- (form-definition (cdr form)))
+ (let ((form-definition (cdr form)))
(when (and (listp form-definition) (eq ':rx (car form-definition)))
(setcdr form (lua-rx-to-string (cadr form-definition) 'nogroup)))
(push form lua-rx-constituents)))
@@ -185,11 +185,12 @@ element is itself expanded with `lua-rx-to-string'. "
(setq form (if (eq 1 (length form))
(car form)
(append '(or) form)))
- (rx-form `(seq symbol-start ,form symbol-end) rx-parent))
+ (and (fboundp 'rx-form) ; Silence Emacs 27's byte-compiler.
+ (rx-form `(seq symbol-start ,form symbol-end) rx-parent)))
(setq lua-rx-constituents (copy-sequence rx-constituents))
- (mapc #'lua--new-rx-form
+ (mapc 'lua--new-rx-form
`((symbol lua--rx-symbol 1 nil)
(ws . "[ \t]*") (ws+ . "[ \t]+")
(lua-name :rx (symbol (regexp "[[:alpha:]_]+[[:alnum:]_]*")))
@@ -317,8 +318,7 @@ If the latter is nil, the keymap translates into
`lua-mode-map' verbatim.")
(defvar lua-mode-map
- (let ((result-map (make-sparse-keymap))
- prefix-key)
+ (let ((result-map (make-sparse-keymap)))
(unless (boundp 'electric-indent-chars)
(mapc (lambda (electric-char)
(define-key result-map
@@ -528,7 +528,7 @@ groups set according to next matched token:
Blanks & comments between tokens are silently skipped.
Groups 6-9 can be used in any of argument regexps."
- (lexical-let*
+ (let*
((delimited-matcher-re-template
"\\=\\(?2:.*?\\)\\(?:\\(?%s:\\(?4:%s\\)\\|\\(?5:%s\\)\\)\\|\\(?%s:\\(?1:%s\\)\\)\\)")
;; There's some magic to this regexp. It works as follows:
@@ -555,7 +555,6 @@ Groups 6-9 can be used in any of argument regexps."
(lambda (end)
(let* ((prev-elt-p (match-beginning 1))
- (prev-sep-p (match-beginning 4))
(prev-end-p (match-beginning 5))
(regexp (if prev-elt-p sep-or-end-expected-re elt-expected-re))
@@ -937,7 +936,7 @@ Return the amount the indentation changed by."
(back-to-indentation)
(if (lua-comment-or-string-p)
(setq indent (lua-calculate-string-or-comment-indentation)) ;; just
restore point position
- (setq indent (max 0 (lua-calculate-indentation nil))))
+ (setq indent (max 0 (lua-calculate-indentation))))
(when (not (equal indent (current-column)))
(delete-region (line-beginning-position) (point))
@@ -1046,12 +1045,12 @@ TOKEN-TYPE determines where the token occurs on a
statement. open indicates that
"Returns the relevant match regexp from token info"
(cond
((eq direction 'forward) (cadr token-info))
- ((eq direction 'backward) (caddr token-info))
+ ((eq direction 'backward) (nth 2 token-info))
(t nil)))
(defun lua-get-token-type (token-info)
"Returns the relevant match regexp from token info"
- (cadddr token-info))
+ (nth 3 token-info))
(defun lua-backwards-to-block-begin-or-end ()
"Move backwards to nearest block begin or end. Returns nil if not
successful."
@@ -1400,9 +1399,7 @@ Return list of indentation modifiers from point to BOUND."
(while (lua-find-regexp 'forward lua-indentation-modifier-regexp
bound)
(let ((found-token (match-string 0))
- (found-pos (match-beginning 0))
- (found-end (match-end 0))
- (data (match-data)))
+ (found-pos (match-beginning 0)))
(setq indentation-info
(lua-add-indentation-info-pair
(lua-make-indentation-info-pair found-token found-pos)
@@ -1416,8 +1413,7 @@ The effect of each token can be either a shift relative
to the current
indentation level, or indentation to some absolute column. This information
is collected in a list of indentation info pairs, which denote absolute
and relative each, and the shift/column to indent to."
- (let ((combined-line-end (line-end-position))
- indentation-info)
+ (let (indentation-info)
(while (lua-is-continuing-statement-p)
(lua-forward-line-skip-blanks 'back))
@@ -1587,11 +1583,10 @@ If not, return nil."
(current-indentation)
(current-column)))))))
-(defun lua-calculate-indentation (&optional parse-start)
+(defun lua-calculate-indentation ()
"Return appropriate indentation for current line as Lua code."
(save-excursion
- (let ((continuing-p (lua-is-continuing-statement-p))
- (cur-line-begin-pos (line-beginning-position)))
+ (let ((cur-line-begin-pos (line-beginning-position)))
(or
;; when calculating indentation, do the following:
;; 1. check, if the line starts with indentation-modifier (open/close
brace)
@@ -1903,13 +1898,10 @@ left out."
"Forward to block end"
(interactive "p")
;; negative offsets not supported
- (assert (or (not count) (>= count 0)))
+ (cl-assert (or (not count) (>= count 0)))
(save-match-data
- (let* ((count (or count 1))
- (block-start (mapcar 'car lua-sexp-alist))
- (block-end (mapcar 'cdr lua-sexp-alist))
- (block-regex (regexp-opt (append block-start block-end) 'words))
- current-exp)
+ (let ((count (or count 1))
+ (block-start (mapcar 'car lua-sexp-alist)))
(while (> count 0)
;; skip whitespace
(skip-chars-forward " \t\n")
- [nongnu] elpa/lua-mode 8b66d36 364/468: Merge branch 'master' into master, (continued)
- [nongnu] elpa/lua-mode 8b66d36 364/468: Merge branch 'master' into master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 95c64bb 366/468: Add doc for lua-find-matching-token-word, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode aee46da 367/468: added lua-indent-nested-block-content-align var, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8503e16 370/468: travis: specify language=minimal explicitly, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c7c3aaa 377/468: Set comint-prompt-regexp locally in process buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 52cc3e4 378/468: Merge pull request #154 from immerrr/set-comint-prompt-regexp-locally-in-process-buf, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0f7f010 383/468: Fix typo, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 505896f 386/468: added tests for lua-indent-nested-block-content-align and lua-indent-close-paren-align, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0cf8000 387/468: add lua-indent-close-paren-align to README.md, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2a8b58b 390/468: Silence byte-compiler, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1f596a9 392/468: Merge pull request #161 from tarsiiformes/lexical,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 0781d83 404/468: Merge pull request #175 from immerrr/add-lua-backward-up-list-command, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d6dc6fb 406/468: Don't add "continuation line" indentation inside parentheses/brackets, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ed01d35 071/468: Implement proper syntax-status querying: improve precision a lot, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0a1e915 262/468: bug fixes for show/hide process buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6315591 265/468: indentation-test: extend unary op test cases, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6c4f7cb 251/468: lua-default-command-switches: declare buffer-local with make-variable-buffer-local, not make-local-variable, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9117cfc 269/468: Makefile: add tryout target to start editing test.lua, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2453e37 272/468: Makefile: account EMACS env variable in 'tryout' target, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3e8d475 275/468: Fixed broken local variable assignments, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1d804f6 279/468: Drop pre-Emacs23 support macros, Philip Kaludercic, 2021/08/05