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

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

[nongnu] elpa/evil-matchit 50bb882419 132/244: support elixir


From: ELPA Syncer
Subject: [nongnu] elpa/evil-matchit 50bb882419 132/244: support elixir
Date: Thu, 6 Jan 2022 02:58:56 -0500 (EST)

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

    support elixir
---
 README.org             |  3 ++-
 evil-matchit-elixir.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++
 evil-matchit.el        | 13 +++++++++--
 pkg.sh                 |  2 +-
 4 files changed, 76 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 5add38bbdc..1fcc604402 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.2.4)
+* evil-matchit (v2.2.6)
 
 
[[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]]
 
@@ -21,6 +21,7 @@ Many modern languages are supported:
 - CMake
 - Org-mode (match tag of org-mode and tags of other languages embedded in org 
file)
 - Ruby
+- Elixir
 - Bash
 - Lua
 - PHP
diff --git a/evil-matchit-elixir.el b/evil-matchit-elixir.el
new file mode 100644
index 0000000000..8da849f1e3
--- /dev/null
+++ b/evil-matchit-elixir.el
@@ -0,0 +1,62 @@
+;;; evil-matchit-elixir.el ---elixir plugin of evil-matchit
+
+;; Copyright (C) 2018 Chen Bin <chenbin.sh@gmail.com>
+
+;; Author: Chen Bin <chenbin.sh@gmail.com>
+
+;; This file is not part of GNU Emacs.
+
+;;; License:
+
+;; This file is part of evil-matchit
+;;
+;; evil-matchit is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+;;
+;; evil-matchit is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+;;; Code:
+
+;; OPTIONAL, you don't need SDK to write a plugin for evil-matchit
+;; but SDK do make you write less code, isn't it?
+;; All you need to do is just define the match-tags for SDK algorithm to 
lookup.
+(require 'evil-matchit-sdk)
+
+;; {{ Sample elixir code:
+;; defmodule MyValidator do
+;;   use Validator
+;;   validate_length :name, 1..100
+;;   validate_matches :email, ~r/@/
+;; end
+;; }}
+
+;; should try next howto, the purpose is avoid missing any howto
+(defvar evilmi-elixir-extract-keyword-howtos
+  '(("^[ \t]*\\(def[a-z]+\\|fn\\|if\\|case\\|unless\\|cond\\) " 1)
+    ("^[ \t]*\\(end\\|else\\)[ \t]*$" 1)
+    ("^[^=]+=[ \t]*\\(if\\|case\\|unless\\|cond\\)[ \t]+" 1)))
+
+(defvar evilmi-elixir-match-tags
+  '((("defmodule" "defp" "defmacro" "fn" "cond") () "end")
+    (("if" "case" "unless") ("else") "end")))
+
+;;;###autoload
+(defun evilmi-elixir-get-tag ()
+  (let* ((rlt (evilmi-sdk-get-tag evilmi-elixir-match-tags 
evilmi-elixir-extract-keyword-howtos)))
+    rlt))
+
+;;;###autoload
+(defun evilmi-elixir-jump (rlt NUM)
+  (evilmi-sdk-jump rlt NUM evilmi-elixir-match-tags 
evilmi-elixir-extract-keyword-howtos))
+
+(provide 'evil-matchit-elixir)
+;;; evil-matchit-elixir.el ends here
\ No newline at end of file
diff --git a/evil-matchit.el b/evil-matchit.el
index 6c7c3ff485..d77e3b1d80 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.2.4
+;; Version: 2.2.6
 ;; Keywords: matchit vim evil
 ;; Package-Requires: ((evil "1.0.7"))
 ;;
@@ -400,6 +400,15 @@ If IS-FORWARD is t, jump forward; or else jump backward."
                                            (evilmi-ruby-get-tag 
evilmi-ruby-jump))))
         '(ruby-mode enh-ruby-mode)))
 
+  (autoload 'evilmi-elixir-get-tag "evil-matchit-elixir" nil)
+  (autoload 'evilmi-elixir-jump "evil-matchit-elixir" nil)
+  ;; @see https://github.com/syl20bnr/spacemacs/issues/2093
+  ;; spacemacs use enh-elixir-mode
+  (mapc (lambda (mode)
+          (plist-put evilmi-plugins mode '((evilmi-simple-get-tag 
evilmi-simple-jump)
+                                           (evilmi-elixir-get-tag 
evilmi-elixir-jump))))
+        '(elixir-mode))
+
 (defun evilmi--region-to-select-or-delete (num &optional is-inner)
   (let* (where-to-jump-in-theory b e)
     (save-excursion
@@ -492,7 +501,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
 ;;;###autoload
 (defun evilmi-version()
   (interactive)
-  (message "2.2.4"))
+  (message "2.2.6"))
 
 ;;;###autoload
 (define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index 0962b0fd3d..b33e06ad72 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 name=evil-matchit
-version=2.2.4
+version=2.2.6
 pkg=$name-$version
 mkdir $pkg
 cp README.org $pkg



reply via email to

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