[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode e68bc14 353/468: Remove compatibility for Emacs <
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode e68bc14 353/468: Remove compatibility for Emacs < 24 |
Date: |
Thu, 5 Aug 2021 04:59:08 -0400 (EDT) |
branch: elpa/lua-mode
commit e68bc142a3e4b417075957dd11d8c7c78330a0ba
Author: Reuben Thomas <rrt@sc3d.org>
Commit: Reuben Thomas <rrt@sc3d.org>
Remove compatibility for Emacs < 24
---
lua-mode.el | 119 ++++++++-------------------------------------
test/test-electric-mode.el | 10 ++--
2 files changed, 26 insertions(+), 103 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index f35d964..a7b4b27 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.
@@ -1757,9 +1682,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 2d308e8 237/468: Move "no-query-on-exit" initialization to lua-start-process, update it, (continued)
- [nongnu] elpa/lua-mode 2d308e8 237/468: Move "no-query-on-exit" initialization to lua-start-process, update it, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 397b883 236/468: Send code to inferior process via loadstring to avoid tempfile issues, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 24cc45e 239/468: Skip shebang line when sending to inferior buffer (issue #61), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c53d071 344/468: travis: disable git-snapshot, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cccb649 346/468: Cask: specify minimum version for buttercup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d5891c5 345/468: Merge pull request #140 from immerrr/fix-buttercup-matchers, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b27edce 348/468: Minor simplification of lua-get-create-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 34e911b 358/468: travis: disable git-snapshot, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4cb20c0 359/468: Cask: specify minimum version for buttercup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c850d2e 357/468: test-inferior-process: temporarily disable failing test, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e68bc14 353/468: Remove compatibility for Emacs < 24,
Philip Kaludercic <=
- [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