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

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

[nongnu] elpa/evil-matchit 6fabc1b8e7 048/244: support funtional javascr


From: ELPA Syncer
Subject: [nongnu] elpa/evil-matchit 6fabc1b8e7 048/244: support funtional javascript syntax v1.3.1
Date: Thu, 6 Jan 2022 02:58:48 -0500 (EST)

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

    support funtional javascript syntax v1.3.1
---
 README.org                                         |  4 ++--
 ...matchit-simple.el => evil-matchit-javascript.el | 24 +++++++++++++---------
 evil-matchit-pkg.el                                |  2 +-
 evil-matchit-simple.el                             |  4 ++--
 evil-matchit.el                                    | 15 ++++++++++++--
 pkg.sh                                             |  2 +-
 6 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/README.org b/README.org
index 0d06a07461..b1737b7cf2 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (version 1.3.0)
+* evil-matchit (v1.3.1)
 
 Vim [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] by 
Benji Fisher ported into Emacs.
 
@@ -195,4 +195,4 @@ Key points about code quality of plugin:
 - support emacs 23
 - performance is the first priority
 * Contact me
-You can report bugs at [[https://github.com/redguardtoo/evil-matchit]].
\ No newline at end of file
+You can report bugs at [[https://github.com/redguardtoo/evil-matchit]].
diff --git a/evil-matchit-simple.el b/evil-matchit-javascript.el
similarity index 73%
copy from evil-matchit-simple.el
copy to evil-matchit-javascript.el
index 87780ebc9e..5b1ede20cd 100644
--- a/evil-matchit-simple.el
+++ b/evil-matchit-javascript.el
@@ -1,4 +1,4 @@
-;;; evil-matchit-simple.el --- simple match plugin of evil-matchit
+;;; evil-matchit-javascript.el --- simple match plugin of evil-matchit
 
 ;; Copyright (C) 2014  Chen Bin <chenbin.sh@gmail.com>
 
@@ -28,12 +28,13 @@
 
 (require 'evil-matchit)
 
-(defun evilmi--simple-find-open-brace (cur-line)
+;; TODO, fn.then().({}, find the second (
+(defun evilmi--javascript-find-open-brace (cur-line)
   (let (rlt)
     ;; javascript code line "(function(...) { ..."
     ;; C code line "} else {"
-    (if (or (string-match "^[ \t]*[\(\}]?[a-zA-Z0-9]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
-            (string-match "^[ \t]*[\(\}]?[a-zA-Z0-9]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
+    (if (or (string-match "^[ \t]*[\(\}]?[$_a-zA-Z0-9]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
+            (string-match "^[ \t]*[\(\}]?[$_a-zA-Z0-9]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
         (setq rlt 1)
       (save-excursion
         (forward-line)
@@ -49,17 +50,17 @@
   )
 
 ;;;###autoload
-(defun evilmi-simple-get-tag ()
+(defun evilmi-javascript-get-tag ()
   (let (p
         forward-line-num
         rlt
         (cur-line (buffer-substring-no-properties
                    (line-beginning-position) (line-end-position)))
         )
-
+    (message "evilmi-javascript-get-tag called")
     ;; only handle open tag
     (if (not (memq (following-char) (string-to-list "{[(}}])")))
-        (if (setq forward-line-num (evilmi--simple-find-open-brace cur-line))
+        (if (setq forward-line-num (evilmi--javascript-find-open-brace 
cur-line))
             (when forward-line-num
               (setq p (line-beginning-position))
               (forward-line (1- forward-line-num))
@@ -75,7 +76,7 @@
   )
 
 ;;;###autoload
-(defun evilmi-simple-jump (rlt NUM)
+(defun evilmi-javascript-jump (rlt NUM)
   (let (cur-line)
     (when rlt
       (evil-jump-item)
@@ -84,11 +85,14 @@
                       (line-beginning-position)
                       (line-end-position)))
       ;; hack for javascript
-      (if (string-match "^[ \t]*})(.*)\; *$" cur-line)
+      (message "cur-line=%s" cur-line)
+      (if (or (string-match "^[ \t]*}\)\(.*\)\; *$" cur-line)
+              (string-match "^[ \t]*}\(.*\))\; *$" cur-line)
+              (string-match "^[ \t]*}\])\; *$" cur-line))
           (line-end-position)
         (1+ (point))
         )
       )
     ))
 
-(provide 'evil-matchit-simple)
+(provide 'evil-matchit-javascript)
diff --git a/evil-matchit-pkg.el b/evil-matchit-pkg.el
index 51d9291d4c..53bccb9aac 100644
--- a/evil-matchit-pkg.el
+++ b/evil-matchit-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-matchit" "1.3.0"
+(define-package "evil-matchit" "1.3.1"
                 "Vim matchit ported into Emacs (requires EVIL)")
diff --git a/evil-matchit-simple.el b/evil-matchit-simple.el
index 87780ebc9e..c0536833c7 100644
--- a/evil-matchit-simple.el
+++ b/evil-matchit-simple.el
@@ -32,8 +32,8 @@
   (let (rlt)
     ;; javascript code line "(function(...) { ..."
     ;; C code line "} else {"
-    (if (or (string-match "^[ \t]*[\(\}]?[a-zA-Z0-9]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
-            (string-match "^[ \t]*[\(\}]?[a-zA-Z0-9]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
+    (if (or (string-match "^[ \t]*[\(\}]?[_a-zA-Z0-9]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
+            (string-match "^[ \t]*[\(\}]?[_a-zA-Z0-9]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
         (setq rlt 1)
       (save-excursion
         (forward-line)
diff --git a/evil-matchit.el b/evil-matchit.el
index b683f09ca7..5692d2b332 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: 1.3.0
+;; Version: 1.3.1
 ;; Keywords: matchit vim evil
 ;; Package-Requires: ((evil "1.0.7"))
 ;;
@@ -88,7 +88,15 @@
   (mapc (lambda (mode)
           (plist-put evilmi-plugins mode '((evilmi-simple-get-tag 
evilmi-simple-jump)))
           )
-        '(java-mode js-mode js2-mode javascript-mode perl-mode cperl-mode 
go-mode))
+        '(java-mode perl-mode cperl-mode go-mode))
+
+  ;; Javascript
+  (autoload 'evilmi-javascript-get-tag "evil-matchit-javascript" nil)
+  (autoload 'evilmi-javascript-jump "evil-matchit-javascript" nil)
+  (mapc (lambda (mode)
+          (plist-put evilmi-plugins mode '((evilmi-javascript-get-tag 
evilmi-javascript-jump)))
+          )
+        '(js-mode js2-mode js3-mode javascript-mode))
 
   ;; Html
   (autoload 'evilmi-html-get-tag "evil-matchit-html" nil)
@@ -182,6 +190,9 @@
     ;; need some hook here
     ))
 
+;;;###autoload
+(defun evilmi-version() (interactive) (message "1.3.1"))
+
 ;;;###autoload
 (define-minor-mode evil-matchit-mode
   "Buffer-local minor mode to emulate matchit.vim"
diff --git a/pkg.sh b/pkg.sh
index 7b009ce253..2e33745f2b 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
 #!/bin/bash
-pkg=evil-matchit-1.3.0
+pkg=evil-matchit-1.3.1
 mkdir $pkg
 cp README.org $pkg
 cp *.el $pkg



reply via email to

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