[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/zig-mode 0b9cddb 098/104: Exclude all except fn and test b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/zig-mode 0b9cddb 098/104: Exclude all except fn and test blocks |
Date: |
Sun, 29 Aug 2021 11:37:10 -0400 (EDT) |
branch: elpa/zig-mode
commit 0b9cddb3ed5ccc6b095bdbbe5c190db6485f5133
Author: vent <ventlark@gmail.com>
Commit: vent <ventlark@gmail.com>
Exclude all except fn and test blocks
---
zig-mode.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/zig-mode.el b/zig-mode.el
index e6f386c..2745f10 100644
--- a/zig-mode.el
+++ b/zig-mode.el
@@ -266,9 +266,12 @@ If given a SOURCE, execute the CMD on it."
(defun zig-in-str-or-cmnt () (nth 8 (syntax-ppss)))
(defconst zig-top-item-beg-re
- (concat "^"
+ (concat "^ *"
(regexp-opt
- '("const" "pub" "fn" "extern" "export" "test"))
+ '("pub" "extern" "export" ""))
+ "[[:space:]]*"
+ (regexp-opt
+ '("fn" "test"))
"[[:space:]]+")
"Start of a Zig item.")
@@ -290,13 +293,12 @@ This is written mainly to be used as
`beginning-of-defun-function' for Zig."
(catch 'done
(dotimes (_ magnitude)
;; Search until we find a match that is not in a string or comment.
- (while (if (re-search-backward (concat "^\\(" zig-top-item-beg-re
"\\)")
+ (while (if (re-search-backward (concat "^[[:space:]]*\\("
zig-top-item-beg-re "\\)")
nil 'move sign)
(zig-in-str-or-cmnt)
;; Did not find it.
(throw 'done nil)))))
- t)
- (beginning-of-line))
+ t))
(defun zig-end-of-defun ()
"Move forward to the next end of defun.
@@ -309,11 +311,12 @@ at the beginning of the defun body.
This is written mainly to be used as `end-of-defun-function' for Zig."
(interactive)
+
;; Jump over the function parameters and paren-wrapped return, if they exist.
(while (re-search-forward "(" (point-at-eol) t)
- (progn
- (backward-char)
- (forward-sexp)))
+ (progn
+ (backward-char)
+ (forward-sexp)))
;; Find the opening brace
(if (re-search-forward "[{]" nil t)
@@ -321,7 +324,7 @@ This is written mainly to be used as
`end-of-defun-function' for Zig."
(goto-char (match-beginning 0))
;; Go to the closing brace
(condition-case nil
- (forward-sexp)
+ (forward-sexp)
(scan-error
;; The parentheses are unbalanced; instead of being unable
;; to fontify, just jump to the end of the buffer
- [nongnu] elpa/zig-mode ab46e22 048/104: add some zig cli build commands, (continued)
- [nongnu] elpa/zig-mode ab46e22 048/104: add some zig cli build commands, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode acebfb1 057/104: Add anyframe; remove promise, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode fc7fde3 056/104: Merge pull request #23 from joachimschmidt557/master, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode ad844c3 062/104: noasync -> nosuspend, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 2c45c45 059/104: Merge pull request #24 from joachimschmidt557/add-anyframe, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 22187f4 076/104: Merge pull request #32 from joachimschmidt557/remove-this, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 8721255 079/104: Merge pull request #34 from jdpage/shell-quoting, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode b7d9613 091/104: Account for braces inside of function parameters, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 41fa032 092/104: Account for paren-wrapped return type, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode bab3143 094/104: Add `zig-test-optimization-mode` and `zig-run-optimization-mode`, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 0b9cddb 098/104: Exclude all except fn and test blocks,
ELPA Syncer <=
- [nongnu] elpa/zig-mode 8ad244b 101/104: Merge pull request #54 from ve-nt/feature/begin-end-defun, ELPA Syncer, 2021/08/29
- [nongnu] elpa/zig-mode 909e263 096/104: Merge pull request #53 from bbuccianti/master, ELPA Syncer, 2021/08/29