emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-matchit f87f03bbf4 169/244: add generic rule to jump


From: ELPA Syncer
Subject: [nongnu] elpa/evil-matchit f87f03bbf4 169/244: add generic rule to jump between brackets
Date: Thu, 6 Jan 2022 02:58:58 -0500 (EST)

branch: elpa/evil-matchit
commit f87f03bbf4cecf4a11dea17049b1428cab4fdd48
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    add generic rule to jump between brackets
---
 README.org             |  2 +-
 evil-matchit-simple.el | 25 +++++++++++++++++++------
 evil-matchit.el        |  4 ++--
 pkg.sh                 |  2 +-
 4 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/README.org b/README.org
index 37785caa15..dbf1e965f7 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.3.0)
+* evil-matchit (v2.3.1)
 
 
[[http://melpa.org/#/evil-matchit][file:http://melpa.org/packages/evil-matchit-badge.svg]]
 
[[http://stable.melpa.org/#/evil-matchit][file:http://stable.melpa.org/packages/evil-matchit-badge.svg]]
 
diff --git a/evil-matchit-simple.el b/evil-matchit-simple.el
index 7d1c319ba6..cbaf04e479 100644
--- a/evil-matchit-simple.el
+++ b/evil-matchit-simple.el
@@ -1,6 +1,6 @@
 ;;; evil-matchit-simple.el --- simple match plugin of evil-matchit
 
-;; Copyright (C) 2014-2017 Chen Bin <chenbin.sh@gmail.com>
+;; Copyright (C) 2014-2019 Chen Bin <chenbin.sh@gmail.com>
 
 
 ;; Author: Chen Bin <chenbin.sh@gmail.com>
@@ -30,25 +30,37 @@
 (require 'evil-matchit-sdk)
 
 (defun evilmi--simple-find-open-brace (cur-line)
+  "Find open brace from CUR-LINE."
   (if evilmi-debug (message "evilmi--simple-find-open-brace called => 
cur-line=%s (point)=%d" cur-line (point)))
   (let (rlt)
-    ;; javascript code line "(function(...) { ..."
-    ;; C code line "} else {"
     (cond
+
+     ;; code "(function(...) { ..."
+     ;; code "} else {"
      ;; css-mode use characters ".:-"
-     ((or (string-match "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
-          (string-match "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
+     ((or (string-match-p "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
+          (string-match-p "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
+      (setq rlt 1))
+
+    ;; code "} if (...) {"
+    ;; code "} else (...) {"
+     ((and (string-match-p "^[ \t]*[\}]? \\(if\\|el[a-z]*\\) *.*{ *?$" 
cur-line)
+           (not (eq (following-char) ?})))
       (setq rlt 1))
+
+     ;; next line is "{"
      (t
       (save-excursion
         (forward-line)
         (setq cur-line (evilmi-sdk-curline))
-        (if (string-match "^[ \t]*{ *$" cur-line)
+        (if (string-match-p "^[ \t]*{ *$" cur-line)
             (setq rlt 2)))))
+
     rlt))
 
 ;;;###autoload
 (defun evilmi-simple-get-tag ()
+  "Get current tag in simple language."
   (let* (forward-line-num
          ;; Only handle open tag
          (tmp (evilmi--get-char-under-cursor))
@@ -76,6 +88,7 @@
 
 ;;;###autoload
 (defun evilmi-simple-jump (rlt NUM)
+  "Jump from current tag to matching tag in simple language."
   (when rlt
     (if evilmi-debug (message "evilmi-simple-jump called (point)=%d" (point)))
 
diff --git a/evil-matchit.el b/evil-matchit.el
index affd76be42..dd521e458d 100644
--- a/evil-matchit.el
+++ b/evil-matchit.el
@@ -4,7 +4,7 @@
 
 ;; Author: Chen Bin <chenbin.sh@gmail.com>
 ;; URL: http://github.com/redguardtoo/evil-matchit
-;; Version: 2.3.0
+;; Version: 2.3.1
 ;; Keywords: matchit vim evil
 ;; Package-Requires: ((evil "1.2.0") (emacs "24.4"))
 ;;
@@ -454,7 +454,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
 ;;;###autoload
 (defun evilmi-version()
   (interactive)
-  (message "2.3.0"))
+  (message "2.3.1"))
 
 ;;;###autoload
 (define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index 0ad20f310f..768b29db33 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 name=evil-matchit
-version=2.3.0
+version=2.3.1
 pkg=$name-$version
 mkdir $pkg
 cp README.org $pkg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]