[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 7909513 363/468: Merge pull request #141 from rrt
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 7909513 363/468: Merge pull request #141 from rrthomas/master |
Date: |
Thu, 5 Aug 2021 04:59:10 -0400 (EDT) |
branch: elpa/lua-mode
commit 7909513c056ac85fd637aece6d3773ffa3b9b6cd
Merge: 6c69183 acd0c55
Author: dennis again <immerrr@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #141 from rrthomas/master
Assume Emacs >= 24.3
---
.travis.yml | 4 +-
lua-mode.el | 145 ++++++++++-----------------------------------
test/test-electric-mode.el | 10 ++--
3 files changed, 38 insertions(+), 121 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index c1101c6..bdf11ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,12 +5,12 @@ addons:
packages:
- lua5.2
env:
- - EVM_EMACS=emacs-24.1-travis
- - EVM_EMACS=emacs-24.2-travis
- EVM_EMACS=emacs-24.3-travis
- EVM_EMACS=emacs-24.4-travis
- EVM_EMACS=emacs-24.5-travis
- EVM_EMACS=emacs-25.1-travis
+ - EVM_EMACS=emacs-25.2-travis
+ - EVM_EMACS=emacs-25.3-travis
# - EVM_EMACS=emacs-git-snapshot-travis
before_install:
- curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw >
travis.sh && source ./travis.sh
diff --git a/lua-mode.el b/lua-mode.el
index f35d964..ebe6ea2 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -149,14 +149,6 @@ element is itself expanded with `lua-rx-to-string'. "
(setq lua-rx-constituents (copy-sequence rx-constituents))
- ;; group-n is not available in Emacs23, provide a fallback.
- (unless (assq 'group-n rx-constituents)
- (defun lua--rx-group-n (form)
- (concat (format "\\(?%d:" (nth 1 form))
- (rx-form `(seq ,@(nthcdr 2 form)) ':)
- "\\)"))
- (push '(group-n lua--rx-group-n 1 nil) lua-rx-constituents))
-
(mapc #'lua--new-rx-form
`((symbol lua--rx-symbol 1 nil)
(ws . "[ \t]*") (ws+ . "[ \t]+")
@@ -185,40 +177,6 @@ element is itself expanded with `lua-rx-to-string'. "
))
-(eval-and-compile
- (if (fboundp 'setq-local)
- (defalias 'lua--setq-local 'setq-local)
- (defmacro lua--setq-local (var val)
- `(set (make-local-variable (quote ,var)) ,val)))
-
- ;; Backward compatibility for Emacsen < 24.1
- (unless (fboundp 'prog-mode)
- (define-derived-mode prog-mode fundamental-mode "Prog"))
-
- (defalias 'lua--cl-assert
- (if (fboundp 'cl-assert) 'cl-assert 'assert))
-
- (defalias 'lua--cl-labels
- (if (fboundp 'cl-labels) 'cl-labels 'flet))
-
- ;; backward compatibility for Emacsen < 23.3
- ;; Emacs 23.3 introduced with-silent-modifications macro
- (if (fboundp 'with-silent-modifications)
- (defalias 'lua--with-silent-modifications 'with-silent-modifications)
-
- (defmacro lua--with-silent-modifications (&rest body)
- "Execute BODY, pretending it does not modifies the buffer.
-
-This is a reimplementation of macro `with-silent-modifications'
-for Emacsen that doesn't contain one (pre-23.3)."
- `(let ((old-modified-p (buffer-modified-p))
- (inhibit-modification-hooks t)
- (buffer-undo-list t))
-
- (unwind-protect
- ,@body
- (set-buffer-modified-p old-modified-p))))))
-
;; Local variables
(defgroup lua nil
"Major mode for editing Lua code."
@@ -282,7 +240,7 @@ Should be a list of strings."
"Buffer used for communication with the Lua process")
(defun lua--customize-set-prefix-key (prefix-key-sym prefix-key-val)
- (lua--cl-assert (eq prefix-key-sym 'lua-prefix-key))
+ (cl-assert (eq prefix-key-sym 'lua-prefix-key))
(set prefix-key-sym (if (and prefix-key-val (> (length prefix-key-val) 0))
;; read-kbd-macro returns a string or a vector
;; in both cases (elt x 0) is ok
@@ -476,7 +434,7 @@ traceback location."
("utf8" . ("char" "charpattern" "codepoint" "codes" "len"
"offset")))))
- (lua--cl-labels
+ (cl-labels
((module-name-re (x)
(concat "\\(?1:\\_<"
(if (listp x) (car x) x)
@@ -676,18 +634,9 @@ Groups 6-9 can be used in any of argument regexps."
"Abbreviation table used in lua-mode buffers.")
(define-abbrev-table 'lua-mode-abbrev-table
- ;; Emacs 23 introduced :system property that prevents abbrev
- ;; entries from being written to file specified by abbrev-file-name
- ;;
- ;; Emacs 22 and earlier had this functionality implemented
- ;; by simple nil/non-nil flag as positional parameter
- (if (>= emacs-major-version 23)
- '(("end" "end" lua-indent-line :system t)
- ("else" "else" lua-indent-line :system t)
- ("elseif" "elseif" lua-indent-line :system t))
- '(("end" "end" lua-indent-line nil 'system)
- ("else" "else" lua-indent-line nil 'system)
- ("elseif" "elseif" lua-indent-line nil 'system))))
+ '(("end" "end" lua-indent-line :system t)
+ ("else" "else" lua-indent-line :system t)
+ ("elseif" "elseif" lua-indent-line :system t)))
(defvar lua-mode-syntax-table
(with-syntax-table (copy-syntax-table)
@@ -722,36 +671,31 @@ Groups 6-9 can be used in any of argument regexps."
(setq comint-prompt-regexp lua-prompt-regexp)
- (lua--setq-local font-lock-defaults '(lua-font-lock-keywords ;; keywords
+ (setq-local font-lock-defaults '(lua-font-lock-keywords ;; keywords
nil ;; keywords-only
nil ;; case-fold
nil ;; syntax-alist
nil ;; syntax-begin
))
- (if (boundp 'syntax-propertize-function)
- (lua--setq-local syntax-propertize-function
- 'lua--propertize-multiline-bounds)
- (with-no-warnings
- ;; font-lock-syntactic-keywords are deprecated since 24.1
- (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)
- (lua--setq-local beginning-of-defun-function 'lua-beginning-of-proc)
- (lua--setq-local end-of-defun-function 'lua-end-of-proc)
- (lua--setq-local comment-start lua-comment-start)
- (lua--setq-local comment-start-skip lua-comment-start-skip)
- (lua--setq-local comment-use-syntax t)
- (lua--setq-local fill-paragraph-function #'lua--fill-paragraph)
+ (setq-local syntax-propertize-function
+ 'lua--propertize-multiline-bounds)
+
+ (setq-local parse-sexp-lookup-properties t)
+ (setq-local indent-line-function 'lua-indent-line)
+ (setq-local beginning-of-defun-function 'lua-beginning-of-proc)
+ (setq-local end-of-defun-function 'lua-end-of-proc)
+ (setq-local comment-start lua-comment-start)
+ (setq-local comment-start-skip lua-comment-start-skip)
+ (setq-local comment-use-syntax t)
+ (setq-local fill-paragraph-function #'lua--fill-paragraph)
(with-no-warnings
- (lua--setq-local comment-use-global-state t))
- (lua--setq-local imenu-generic-expression lua-imenu-generic-expression)
+ (setq-local comment-use-global-state t))
+ (setq-local imenu-generic-expression lua-imenu-generic-expression)
(when (boundp 'electric-indent-chars)
;; If electric-indent-chars is not defined, electric indentation is done
;; via `lua-mode-map'.
- (lua--setq-local electric-indent-chars
+ (setq-local electric-indent-chars
(append electric-indent-chars lua--electric-indent-chars)))
@@ -930,25 +874,6 @@ If none can be found before reaching LIMIT, return nil."
(or (lua-try-match-multiline-end limit)
(lua-try-match-multiline-begin limit)))
-(defun lua-remove-syntax-table-property (limit)
- "Remove syntax-table property on given region.
-
-This is a workaround for `font-lock-default-fontify-region'
-sometimes forgetting to unpropertize region which may cause
-multiline recognition to fail.
-
-Returns nil so that it's only called once as a syntactic keyword.
-"
- (remove-text-properties (point) limit '(syntax-table))
- nil)
-
-(defvar lua-font-lock-syntactic-keywords
- '((lua-remove-syntax-table-property nil)
- (lua-match-multiline-literal-bounds
- (1 "!" nil noerror)
- (2 "|" nil noerror))))
-
-
(defun lua--propertize-multiline-bounds (start end)
"Put text properties on beginnings and ends of multiline literals.
@@ -1522,25 +1447,19 @@ one."
;; This regexp should answer the following questions:
;; 1. is there a left shifter regexp on that line?
;; 2. where does block-open token of that left shifter reside?
- ;;
- ;; NOTE: couldn't use `group-n' keyword of `rx' macro, because it was
- ;; introduced in Emacs 24.2 only, so for the sake of code clarity the
named
- ;; groups don't really match anything, they just report the position of
the
- ;; match.
- (or (seq (regexp "\\_<local[ \t]+") (regexp "\\(?1:\\)function\\_>"))
- (seq (eval lua--function-name-rx) (* blank) (regexp "\\(?1:\\)[{(]"))
- (seq (or
- ;; assignment statement prefix
- (seq (* nonl) (not (any "<=>~")) "=" (* blank))
- ;; return statement prefix
- (seq word-start "return" word-end (* blank)))
- (regexp "\\(?1:\\)")
+ (or (seq (group-n 1 symbol-start "local" (+ blank)) "function" symbol-end)
+
+ (seq (group-n 1 (eval lua--function-name-rx) (* blank)) (any "{("))
+ (seq (group-n 1 (or
+ ;; assignment statement prefix
+ (seq (* nonl) (not (any "<=>~")) "=" (* blank))
+ ;; return statement prefix
+ (seq word-start "return" word-end (* blank))))
;; right hand side
(or "{"
"function"
- (seq
- (eval lua--function-name-rx) (* blank)
- (regexp "\\(?1:\\)") (any "({")))))))
+ (seq (group-n 1 (eval lua--function-name-rx) (* blank))
+ (any "({")))))))
"Regular expression that matches left-shifter expression.
@@ -1757,9 +1676,7 @@ When called interactively, switch to the process buffer."
(make-local-variable 'compilation-error-regexp-alist)
(setq compilation-error-regexp-alist
(cons (list lua-traceback-line-re 1 2)
- ;; Remove 'gnu entry from error regexp alist, it somehow forces
- ;; leading TAB to be recognized as part of filename in Emacs23.
- (delq 'gnu compilation-error-regexp-alist)))
+ compilation-error-regexp-alist))
(compilation-shell-minor-mode 1))
;; when called interactively, switch to process buffer
diff --git a/test/test-electric-mode.el b/test/test-electric-mode.el
index dac4d05..d88b4a3 100644
--- a/test/test-electric-mode.el
+++ b/test/test-electric-mode.el
@@ -10,7 +10,7 @@
(describe "Test electric mode"
(it "works with curly braces"
(with-lua-buffer
- (lua--setq-local blink-matching-paren nil)
+ (setq-local blink-matching-paren nil)
(make-local-variable 'electric-indent-mode)
(electric-indent-mode 1)
(execute-kbd-macro (kbd "return SPC foo SPC { M-j"))
@@ -22,7 +22,7 @@
(it "works with parentheses"
(with-lua-buffer
- (lua--setq-local blink-matching-paren nil)
+ (setq-local blink-matching-paren nil)
(make-local-variable 'electric-indent-mode)
(electric-indent-mode 1)
(execute-kbd-macro (kbd "return SPC foo SPC ( M-j"))
@@ -77,9 +77,9 @@
(let ((old-mode (if electric-pair-mode 1 0)))
(unwind-protect
(with-lua-buffer
- (lua--setq-local blink-matching-paren nil)
- (lua--setq-local electric-pair-skip-self t)
- (lua--setq-local lua-electric-flag t)
+ (setq-local blink-matching-paren nil)
+ (setq-local electric-pair-skip-self t)
+ (setq-local lua-electric-flag t)
(electric-pair-mode 1)
(execute-kbd-macro "(")
(should (string= (buffer-string) "()"))
- [nongnu] elpa/lua-mode 56af490 446/468: lua-find-regexp: escape string/comment after a match is ignored, (continued)
- [nongnu] elpa/lua-mode 56af490 446/468: lua-find-regexp: escape string/comment after a match is ignored, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 93da584 449/468: Bump indentation tests, add missing function-call-arguments suite, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 0018e95 452/468: make-indentation-pair: don't calculate full indentation on every closer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d2ff304 456/468: Copy cl-signum into lua--signum for backward compat, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3688bf7 347/468: Merge pull request #136 from EdwardBetts/spelling, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6c69183 351/468: Merge pull request #139 from rrthomas/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode eacf137 349/468: Spell “Lua” consistently and its “process” (not “subprocess”), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode acd0c55 354/468: Revert to using group-n in lua--left-shifter-regexp, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3ba5ecc 360/468: Minor simplification of lua-get-create-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c6e053e 361/468: Spell “Lua” consistently and its “process” (not “subprocess”), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 7909513 363/468: Merge pull request #141 from rrthomas/master,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode a260cf9 368/468: Travis: enable testing on 26.1, 26.2 and git snapshot, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c9635fb 369/468: travis.yml: print emacs version, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 494a5de 371/468: Fix some linter complaints about docstrings, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ceb575b 374/468: tests: break down function header tests into separate cases, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99c7431 375/468: travis: mark "git-snapshot" as allowed failure, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 770a83d 376/468: Merge pull request #152 from immerrr/fix-compat-with-new-rx-package, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 171b99c 382/468: Merge pull request #159 from tarsiiformes/typos, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a1f6d28 385/468: added lua-indent-close-paren-align var, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3c9ec08 391/468: Depend on Emacs 24.3, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 478da4a 393/468: Fixed order of expected & actual in matcher's message, Philip Kaludercic, 2021/08/05