[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode b11a136 022/468: implemented lua-forward-sexp usi
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode b11a136 022/468: implemented lua-forward-sexp using lua-find-matching-token-word |
Date: |
Thu, 5 Aug 2021 04:58:01 -0400 (EDT) |
branch: elpa/lua-mode
commit b11a1364178f41f09cad5b7926d0ecc1b9d0de8a
Author: juergen <juergen>
Commit: juergen <juergen>
implemented lua-forward-sexp using lua-find-matching-token-word
---
lua-mode.el | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index dff2616..db60e62 100755
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -239,6 +239,10 @@ traceback location."
(defvar lua-mode-abbrev-table nil
"Abbreviation table used in lua-mode buffers.")
+(defvar lua-sexp-alist '(("then" . "end")
+ ("function" . "end")
+ ("do" . "end")))
+
(define-abbrev-table 'lua-mode-abbrev-table
'(
("end" "end" lua-indent-line 0)
@@ -336,8 +340,8 @@ The following keys are bound:
(unless (assq 'lua-mode hs-special-modes-alist)
(add-to-list 'hs-special-modes-alist
`(lua-mode
- ,(regexp-opt '("do" "function" "then") 'words) ;start
- ,(regexp-opt '("end") 'words) ;end
+ ,(regexp-opt (mapcar 'car lua-sexp-alist) 'words);start
+ ,(regexp-opt (mapcar 'cdr lua-sexp-alist) 'words) ;end
nil lua-forward-sexp)))
(run-hooks 'lua-mode-hook)))
@@ -1238,9 +1242,27 @@ left out."
;;{{{ lua-forward-sexp
(defun lua-forward-sexp (&optional count)
- "Find begin and end of Lua block."
- (let ((case-fold-search t))
- (re-search-forward "\\<end\\>" nil t)))
+ "Forward to block end"
+ (interactive "p")
+ (save-match-data
+ (let* ((count (or count 1))
+ (stackheight 0)
+ (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
+ )
+ (while (> count 0)
+ ;; skip whitespace
+ (skip-chars-forward " \t\n")
+ (if (looking-at (regexp-opt block-start 'words))
+ (let ((keyword (match-string 1)))
+ (lua-find-matching-token-word keyword nil))
+ ;; If the current keyword is not a "begin" keyword, then just
+ ;; perform the normal forward-sexp.
+ (forward-sexp 1))
+ (setq count (1- count))))))
+
;;}}}
;;{{{ menu bar
- [nongnu] elpa/lua-mode 78f7b78 014/468: emacs-compatibility: replace-in-string not available on GNU emacs, (continued)
- [nongnu] elpa/lua-mode 78f7b78 014/468: emacs-compatibility: replace-in-string not available on GNU emacs, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ea5c4a1 015/468: Documentation: Added installation notes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9d20d58 019/468: fold mode cleanup, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 78fc3ba 005/468: lua-postprocess-output-buffer: jump to lua errors in source files, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8802c43 006/468: fixed lua-postprocess-output-buffer: start search from last prompt, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 3d6f6ed 012/468: enforce interactive mode by default: (defcustom lua-default-command-switches (list "-i")..., Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8ab6df6 026/468: Fix bug #619: Wrong identation with .. operator, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d313ff5 024/468: New Release: 20061208, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 31acb6b 029/468: Fix bug #621: Wrong comment block detection, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8f17c27 021/468: fix [#472] lua-mode colorization, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b11a136 022/468: implemented lua-forward-sexp using lua-find-matching-token-word,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode c49fb68 023/468: Fixed lua-prompt-regex and handling of output without newline (bug #425), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 99324a4 034/468: minor font-lock fix, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c61bda2 040/468: Commit from Reuben:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cd5fa7d 010/468: lua-start-process: made program &optional argument (defaults to name), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 13363db 017/468: Fixed typo (#470), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 9730289 027/468: Insert Project page Link, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bf0b902 033/468: New Release 20070708, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ab9783f 041/468: Applied patch from Reuben Thomas:, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2786823 043/468: Add example code to trigger lua-mode for hash-bang lines containing, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4f4d3de 047/468: Add Makefile with dist and release targets, and ignore release zips., Philip Kaludercic, 2021/08/05