[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit bc31e7d594 199/244: clean code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit bc31e7d594 199/244: clean code |
Date: |
Thu, 6 Jan 2022 02:59:01 -0500 (EST) |
branch: elpa/evil-matchit
commit bc31e7d59477ef5eb7d53d82e578d9a0d1544d76
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
clean code
---
evil-matchit-markdown.el | 2 +-
evil-matchit-sdk.el | 17 +++++------------
tests/evil-matchit-tests.el | 1 -
3 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/evil-matchit-markdown.el b/evil-matchit-markdown.el
index 41c34cfa7c..550e0d4bb9 100644
--- a/evil-matchit-markdown.el
+++ b/evil-matchit-markdown.el
@@ -42,7 +42,7 @@ Return (list start-position tag)."
(let* ((str (match-string 1 cur-line))
(prefix (buffer-substring-no-properties (point-min)
(line-beginning-position)))
- (forward-direction (evilmi-evenp (evilmi-count-matches str
prefix))))
+ (forward-direction (eq (% (evilmi-sdk-count-matches str prefix)
2) 0)))
(setq rlt (list (if forward-direction (line-beginning-position)
(line-end-position))
forward-direction
diff --git a/evil-matchit-sdk.el b/evil-matchit-sdk.el
index cf898366c0..0f96387ba1 100644
--- a/evil-matchit-sdk.el
+++ b/evil-matchit-sdk.el
@@ -1,4 +1,5 @@
(require 'evil nil t)
+(require 'subr-x)
(defvar evilmi-debug nil
"Debug flag.")
@@ -274,7 +275,6 @@ Rule is looked up in HOWTOS."
(setq howto (nth i howtos))
(when (string-match (nth 0 howto) cur-line)
;; keyword should be trimmed because FORTRAN use "else if"
- (unless (featurep 'subr-x) (require 'subr-x))
(setq keyword (string-trim (match-string (nth 1 howto) cur-line)))
;; keep search keyword by using next howto (regex and match-string
index)
(unless (evilmi-sdk-member keyword match-tags) (setq keyword nil)))
@@ -289,7 +289,7 @@ Rule is looked up in HOWTOS."
(and (nth 2 tag-info) (string= (nth 2 tag-info) "MONOGAMY")))
(defun evilmi-sdk-exactly-same-type-p (crt orig)
- (= (nth 0 crt) (nth 0 orig)))
+ (eq (nth 0 crt) (nth 0 orig)))
(defun evilmi-sdk-same-type (crt orig)
(when (and crt orig)
@@ -425,9 +425,6 @@ after calling this function."
(member f fonts))
fontfaces))))
-(defun evilmi-empty-line-p (line)
- (string-match "^[ \t]*$" line))
-
(defun evilmi-next-non-empty-line ()
"Return next non-empty line content or nil."
(let* ((b (line-beginning-position))
@@ -441,7 +438,7 @@ after calling this function."
(while (and continue (> (point) e))
(setq line (evilmi-sdk-curline))
(cond
- ((evilmi-empty-line-p line)
+ ((string-blank-p line)
(setq b (line-beginning-position))
(setq e (line-end-position))
(forward-line))
@@ -450,14 +447,10 @@ after calling this function."
(setq rlt line)))))
rlt))
-;;;###autoload
-(defun evilmi-evenp (num)
- (= (% num 2) 0))
-
-(defun evilmi-count-matches (regexp str)
+(defun evilmi-sdk-count-matches (regexp str)
+ "Count matches of regexp in STR."
(let* ((count 0)
(start 0))
- (unless start (setq start 0))
(while (string-match regexp str start)
(setq count (1+ count))
(setq start (match-end 0)))
diff --git a/tests/evil-matchit-tests.el b/tests/evil-matchit-tests.el
index 697f09a67b..bddc0eebb7 100644
--- a/tests/evil-matchit-tests.el
+++ b/tests/evil-matchit-tests.el
@@ -173,7 +173,6 @@
; jump back
(evilmi-jump-items)
(should (eq (following-char) ?{))
- (message "(point)=%s" (point))
(should (string-match "switch(c)" (evilmi-sdk-curline) ))
(should (eq major-mode 'c-mode))))
- [nongnu] elpa/evil-matchit 289982cbee 192/244: doc, (continued)
- [nongnu] elpa/evil-matchit 289982cbee 192/244: doc, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9b228b097a 242/244: easier to add own rules, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3417dbb275 117/244: Add ocaml support, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 80413a836a 121/244: Merge pull request #79 from msaffer/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 47894a6cc0 151/244: Merge pull request #93 from AitBits/patch-2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 4c6b8f412f 159/244: Add autoload definitions, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 1c428e192b 149/244: ocaml use font-lock-doc-face for comment, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0845b2a0bf 178/244: Merge pull request #109 from neojski/add-double-semicolon, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 11aa990ecb 177/244: Merge pull request #110 from leungbk/elisp, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 11d98debf8 187/244: Merge pull request #115 from dajva/jump_motion, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit bc31e7d594 199/244: clean code,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 6fd4c56855 198/244: clean code, more c unit test, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 24dcd74a55 205/244: support terminal in Emacs, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ede6382955 206/244: enhance verilog mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 721d0a9c56 211/244: More ocaml tests, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fccad4255b 217/244: Merge pull request #128 from leungbk/byte-comp, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 593c2d53a7 224/244: `evilmi-sdk-simple-jump': skip comments, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit f397504270 204/244: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2df3a62a8b 222/244: Add a regression test, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d7ad7f712b 235/244: emacs 28 changed API define-obsolete-function-alias. It is EVIL code. Not my code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d1f59ad941 225/244: Merge pull request #131 from nbfalcon/bugfix/evilmi-sdk-simple-jump-whitespace, ELPA Syncer, 2022/01/06