[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit 0b0e6d61a6 119/244: clean code
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit 0b0e6d61a6 119/244: clean code |
Date: |
Thu, 6 Jan 2022 02:58:55 -0500 (EST) |
branch: elpa/evil-matchit
commit 0b0e6d61a6462fc6fff7000b739ce5b31acd0d4c
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
clean code
- support text-object and other evlimi commands
- use namespace evilmi-ocaml
- remove trailing spaces
---
README.org | 7 +++----
evil-matchit-ocaml.el | 48 ++++++++++++++++++++++++++----------------------
evil-matchit.el | 8 ++++----
pkg.sh | 2 +-
4 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/README.org b/README.org
index 386281b74f..fe6395ad41 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.2.1)
+* evil-matchit (v2.2.2)
[[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]]
@@ -14,6 +14,7 @@ Many modern languages are supported:
- Javascript
- React JSX (rjsx-mode)
- JSON
+- OCaml
- Perl
- Latex
- CMake
@@ -175,9 +176,7 @@ Here is a complete sample:
;; we use it to select/delete tag. The other elements of the list could
;; be any data type
(defun evilmi-mylang-find-tag ()
- (let (rlt)
- (setq rlt '(position-of-open-end "anything-you-like" "anything-you-like")
- rlt))
+ (list position-of-open-end "anything-you-like" "anything-you-like"))
;; @parama rlt result from evilmi-mylang-find-tag
;; @param NUM numeric argument when user press "%" to match tag
diff --git a/evil-matchit-ocaml.el b/evil-matchit-ocaml.el
index 00e1c2e00e..1ec48b39b7 100644
--- a/evil-matchit-ocaml.el
+++ b/evil-matchit-ocaml.el
@@ -1,28 +1,29 @@
-(setq evilmi-ocaml-keywords
- '((("struct" "begin" "object") ("end"))
- (("if") ("then"))
- (("match") ("with"))
- (("match" "try") ("with"))
- (("while" "for") ("done"))
- (("let") ("in"))
- ()))
+(defvar evilmi-ocaml-keywords
+ '((("struct" "begin" "object") ("end"))
+ (("if") ("then"))
+ (("match") ("with"))
+ (("match" "try") ("with"))
+ (("while" "for") ("done"))
+ (("let") ("in"))
+ ())
+ "Ocaml keywords.")
-;; regexp to find next/previous keyword
-(setq keywords-regex
+(defvar evilmi-ocaml-keywords-regex
(let ((all-keywords (apply 'append (apply 'append evilmi-ocaml-keywords))))
- (format "\\<\\(%s\\)\\>" (mapconcat 'identity all-keywords "\\|"))))
+ (format "\\<\\(%s\\)\\>" (mapconcat 'identity all-keywords "\\|")))
+ "Regexp to find next/previous keyword.")
;; jumps to next keyword. Returs nil if there's no next word
(defun evilmi-ocaml-next-word (direction)
(if (= direction 0)
(let ((new-point (save-excursion
(forward-char)
- (if (search-forward-regexp keywords-regex nil t)
- (search-backward-regexp keywords-regex)
+ (if (search-forward-regexp evilmi-ocaml-keywords-regex nil t)
+ (search-backward-regexp evilmi-ocaml-keywords-regex)
nil)
)))
(if new-point (goto-char new-point)))
- (search-backward-regexp keywords-regex nil t)))
+ (search-backward-regexp evilmi-ocaml-keywords-regex nil t)))
(defun evilmi-ocaml-end-word ()
(save-excursion
@@ -33,11 +34,11 @@
(buffer-substring-no-properties (point) (evilmi-ocaml-end-word)))
(defun evilmi-ocaml-is-keyword (l keyword)
- "Checks if the keyword belongs to a row"
+ "Checks if the keyword belongs to a row."
(find-if (lambda (w) (string-equal w keyword)) (apply 'append l)))
(defun evilmi-ocaml-get-tag-info (keyword)
- "Find the row in the evilmi-ocaml-keywords"
+ "Find the row in the evilmi-ocaml-keywords."
(find-if (lambda (l) (evilmi-ocaml-is-keyword l keyword))
evilmi-ocaml-keywords))
;; 0 - forward
@@ -46,7 +47,7 @@
(if (= level 0)
(point)
(if (evilmi-ocaml-next-word direction)
- (progn
+ (progn
(setq keyword (evilmi-ocaml-get-word))
(if (evilmi-ocaml-is-keyword tag-info keyword)
@@ -66,17 +67,20 @@
;;;###autoload
(defun evilmi-ocaml-get-tag ()
- (save-excursion
+ "Return information of current tag: (list position-of-word word)."
+ (save-excursion
(evilmi-ocaml-goto-word-beginning)
- (evilmi-ocaml-get-word)))
+ (list (car (bounds-of-thing-at-point 'word))
+ (evilmi-ocaml-get-word))))
;;;###autoload
(defun evilmi-ocaml-jump (rlt num)
- (let* ((tag-info (evilmi-ocaml-get-tag-info rlt))
- (direction (if (member rlt (car tag-info)) 0 1)))
+ (let* ((keyword (cadr rlt))
+ (tag-info (evilmi-ocaml-get-tag-info keyword))
+ (direction (if (member keyword (car tag-info)) 0 1)))
(let ((new-point (save-excursion
(evilmi-ocaml-goto-word-beginning)
(evilmi-ocaml-go tag-info 1 direction))))
(if new-point (goto-char new-point)))))
-(provide 'evil-matchit-ocaml)
+(provide 'evil-matchit-ocaml)
\ No newline at end of file
diff --git a/evil-matchit.el b/evil-matchit.el
index ab489f1c6f..1c1899261d 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.1
+;; Version: 2.2.2
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -312,8 +312,8 @@ If font-face-under-cursor is NOT nil, the quoted string is
being processed."
;; ocaml
(autoload 'evilmi-ocaml-get-tag "evil-matchit-ocaml" nil)
(autoload 'evilmi-ocaml-jump "evil-matchit-ocaml" nil t)
- (plist-put evilmi-plugins 'tuareg-mode '((evilmi-ocaml-get-tag
evilmi-ocaml-jump)
- (evilmi-simple-get-tag
evilmi-simple-jump)))
+ (plist-put evilmi-plugins 'tuareg-mode '((evilmi-simple-get-tag
evilmi-simple-jump)
+ (evilmi-ocaml-get-tag
evilmi-ocaml-jump)))
;; Python
(autoload 'evilmi-python-get-tag "evil-matchit-python" nil)
@@ -479,7 +479,7 @@ If font-face-under-cursor is NOT nil, the quoted string is
being processed."
;;;###autoload
(defun evilmi-version()
(interactive)
- (message "2.2.1"))
+ (message "2.2.2"))
;;;###autoload
(define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index 386c0168c0..7120125b4a 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
#!/bin/bash
name=evil-matchit
-version=2.2.1
+version=2.2.2
pkg=$name-$version
mkdir $pkg
cp README.org $pkg
- [nongnu] elpa/evil-matchit 8c4f516265 238/244: Support matlab-mode, (continued)
- [nongnu] elpa/evil-matchit 8c4f516265 238/244: Support matlab-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 82c80786e5 240/244: jump between merge conflict markers, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 5c43939d01 212/244: Merge pull request #126 from neojski/more-ocaml-tests, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit cdb9b90381 229/244: extra json support, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d005e0465e 223/244: Merge pull request #130 from nbfalcon/bugfix/evilmi-sdk-simple-jump-whitespace, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ce90eae4bd 243/244: typo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit a0c5bd1fe8 230/244: support quote and export section in org file, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9cdaddd55d 228/244: Merge pull request #132 from aaronjensen/require-evil-macros, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8b71b42603 041/244: better support for sh and c/c++ v1.2.8, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 4846518b59 109/244: support rjsx-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0b0e6d61a6 119/244: clean code,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 8a10046f25 145/244: fix python issue, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0d62d497d1 143/244: Fix typo, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 4435f3ada5 128/244: evil-matchit-org: add :results: :end: drawer, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit a91ea21c4a 141/244: Fix typo in readme, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fb5807c096 129/244: Merge pull request #82 from et2010/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 4f3928db11 157/244: let evil-repeat ignore evilmi jump, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 43be86d8c4 171/244: support css-in-js styled components, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2fc961d94b 122/244: fixed css-mode minor issue, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2001c5be5f 147/244: ocaml: improve validation of keywords, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8fa4c1390d 163/244: can change shortcut from "%" to "m", ELPA Syncer, 2022/01/06