[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode dc55356 261/468: lua-forward-regexp: make sure di
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode dc55356 261/468: lua-forward-regexp: make sure direction is `forward' |
Date: |
Thu, 5 Aug 2021 04:58:49 -0400 (EDT) |
branch: elpa/lua-mode
commit dc55356ca2464f7712a9d3ca77c81da49f39ce48
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
lua-forward-regexp: make sure direction is `forward'
For middle tokens (then/else/elseif) default direction is backward.
---
lua-mode.el | 7 ++++---
test/generic-test.el | 8 ++++++++
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 6ff8798..3405c4a 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -1801,19 +1801,20 @@ left out."
(defun lua-forward-sexp (&optional count)
"Forward to block end"
(interactive "p")
+ ;; negative offsets not supported
+ (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
- )
+ 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))
+ (lua-find-matching-token-word keyword 'forward))
;; If the current keyword is not a "begin" keyword, then just
;; perform the normal forward-sexp.
(forward-sexp 1))
diff --git a/test/generic-test.el b/test/generic-test.el
index 148e1a0..0090674 100644
--- a/test/generic-test.el
+++ b/test/generic-test.el
@@ -11,3 +11,11 @@
(lua-forward-sexp)
(should (looking-back "x = function() return {{}} end"))))
+(ert-deftest lua-forward-sexp-if-then-block ()
+ (with-lua-buffer
+ (lua-insert-goto-<>
+ '("if foo <>then"
+ " return bar"
+ "--[[end here]] end"))
+ (lua-forward-sexp)
+ (should (looking-back (rx "--[[end here]] end")))))
- [nongnu] elpa/lua-mode b684790 219/468: Revert "Rename lua--function-name-rx, use it in font-lock keywords init", (continued)
- [nongnu] elpa/lua-mode b684790 219/468: Revert "Rename lua--function-name-rx, use it in font-lock keywords init", Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8e19d23 231/468: Add basic indentation tests, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6729533 234/468: Rewrite lua-send-buffer function (should fix issue #60), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode afc1ea0 235/468: Send init-code in lua-start-process, enable compilation-shell-minor-mode, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1ede907 242/468: Fix several cases for `indent-new-comment-line' (M-j), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6c55abb 245/468: Add lua-rx/-to-string wrappers to simplify writing Lua-specific regexps, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1452f8e 244/468: should-lua-indent: accept strings rather than lists to simplify writing tests, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a0f3a6f 250/468: Simplify font-lock & imenu regexps with lua-rx, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode e430d01 252/468: Remove deprecated test code from test/, put current code there instead, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1d21a10 259/468: Reorganize test structure, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode dc55356 261/468: lua-forward-regexp: make sure direction is `forward',
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 0a986f7 266/468: Add hideshow support for "repeat... until" blocks, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8d27d2c 268/468: fixed up tests && improved lua-kill-process, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 82daeb5 297/468: Merge pull request #88 from tarsius/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 7b2c18c 305/468: Merge pull request #99 from tarsius/master, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 6f4035a 315/468: Merge pull request #108 from ptrv/patch-1, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f2915c3 324/468: Add string tab escape test, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 652e299 339/468: gitignore: add cask working dir, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode adb1f3a 334/468: lua_loadstring: fix variables that were made global, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 191eb10 330/468: Makefile: add "nocask" targets, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 25c2535 343/468: test-inferior-process: temporarily disable failing test, Philip Kaludercic, 2021/08/05