[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit acd0b7401b 026/244: simple jump algorithm upg
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit acd0b7401b 026/244: simple jump algorithm upgraded v1.1.1 |
Date: |
Thu, 6 Jan 2022 02:58:46 -0500 (EST) |
branch: elpa/evil-matchit
commit acd0b7401b8798bc5aa26a65e2d97566fcc4e496
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
simple jump algorithm upgraded v1.1.1
---
README.org | 5 ++--
evil-matchit-simple.el | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++
evil-matchit.el | 32 +++-----------------
3 files changed, 87 insertions(+), 30 deletions(-)
diff --git a/README.org b/README.org
index f2478a4b0a..21083924d0 100644
--- a/README.org
+++ b/README.org
@@ -111,8 +111,9 @@ Here is a complete sample:
(push-mark (nth 0 rlt) t t)
;; say 999 is the where we jump to
(goto-char 999)
- ;; If you need where is the end of the region, you need return it
- ;; at the end of the function
+ ;; If you need know where is the end of the region for region operation,
+ ;; you need return the end of region at the end of function
+ ;; region operation means selection/deletion of region.
888
)
diff --git a/evil-matchit-simple.el b/evil-matchit-simple.el
new file mode 100644
index 0000000000..960004d368
--- /dev/null
+++ b/evil-matchit-simple.el
@@ -0,0 +1,80 @@
+;;; evil-matchit-simple.el --- simple match plugin of evil-matchit
+
+;; Copyright (C) 2013 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:
+
+(require 'evil-matchit)
+
+(defun evilmi--simple-find-open-brace (cur-line)
+ (let (rlt)
+ (if (string-match "^[ \t]*[a-zA-Z0-9]+.*{ *$" cur-line)
+ (setq rlt 1)
+ (save-excursion
+ (forward-line)
+ (setq cur-line (buffer-substring-no-properties
+ (line-beginning-position) (line-end-position)))
+ (if (string-match "^[ \t]*{ *$" cur-line)
+ (setq rlt 2)
+ )
+ )
+ )
+ rlt
+ )
+ )
+
+;;;###autoload
+(defun evilmi-simple-get-tag ()
+ (let (p
+ forward-line-num
+ rlt
+ (cur-line (buffer-substring-no-properties
+ (line-beginning-position) (line-end-position)))
+ )
+
+ ;; only handle open tag
+ (if (not (memq (following-char) (string-to-list "{[(}}])")))
+ (if (setq forward-line-num (evilmi--simple-find-open-brace cur-line))
+ (when forward-line-num
+ (setq p (line-beginning-position))
+ (forward-line (1- forward-line-num))
+ (search-forward "{" nil nil)
+ (backward-char)
+ (setq rlt (list p))
+ )
+ )
+ (setq rlt (list (point)))
+ )
+ rlt
+ )
+ )
+
+;;;###autoload
+(defun evilmi-simple-jump (rlt NUM)
+ (if rlt (evil-jump-item))
+ (1+ (point))
+ )
+
+(provide 'evil-matchit-simple)
\ No newline at end of file
diff --git a/evil-matchit.el b/evil-matchit.el
index f27ada90c9..eeaeee6e25 100644
--- a/evil-matchit.el
+++ b/evil-matchit.el
@@ -111,6 +111,10 @@
)
'(web-mode html-mode nxml-mode nxhtml-mode sgml-mode))
+ ;; simple matching for languages containing "{(["
+ (autoload 'evilmi-simple-get-tag "evil-matchit-simple" nil t)
+ (autoload 'evilmi-simple-jump "evil-matchit-simple" nil t)
+
;; latex
(autoload 'evilmi-latex-get-tag "evil-matchit-latex" nil t)
(autoload 'evilmi-latex-jump "evil-matchit-latex" nil t)
@@ -200,34 +204,6 @@
evil-matchit-mode turn-on-evil-matchit-mode
"Global minor mode to emulate matchit.vim")
-;; @return (list position-first-char tag-type tag-keyword)
-
-;; {{ simple find/jump
-;; @return (list position-first-char tag-type tag-keyword) or nil
-(defun evilmi-simple-get-tag ()
- (interactive)
- (let ((char (following-char))
- (tag-type -1)
- (tag-keyword "")
- (rlt nil)
- )
-
- (if (memq char (string-to-list "{[("))
- (setq rlt (list (point) 0 (char-to-string char)))
- )
- (if (memq char (string-to-list "}])"))
- (setq rlt (list (point) 1 (char-to-string char)))
- )
- rlt
- )
- )
-
-(defun evilmi-simple-jump (rlt NUM)
- (interactive)
- (evil-jump-item)
- )
-;; }}
-
(provide 'evil-matchit)
;;; evil-matchit.el ends here
- [nongnu] elpa/evil-matchit 574d3c4e45 209/244: emacs 24.4 does not have font-lock-ensure, (continued)
- [nongnu] elpa/evil-matchit 574d3c4e45 209/244: emacs 24.4 does not have font-lock-ensure, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2337748d26 214/244: autoload evilmi-prompt-line-p, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 43a626541d 025/244: support script language, v1.1.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 7ff2b954c0 015/244: user can customize key binding, v0.0.6, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 0dea7ddb67 009/244: better match single character tag, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fbe22f1171 008/244: single file package does not need *-pkg.el, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9df39e73f7 011/244: Merge pull request #7 from purcell/patch-2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3c98cf064f 018/244: new framework v1.0.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3e3652a162 012/244: marmalade need *-pkg.el, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d92883b8c3 007/244: use evil API in html file some times, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit acd0b7401b 026/244: simple jump algorithm upgraded v1.1.1,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit cf584eb62e 020/244: support c like languages, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit d5a7c947e6 023/244: minor wording in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2d038e4d59 019/244: minor tweek of matching algorithm priority, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 1a663b20fd 029/244: #18 minor bug for python, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 210155ee8f 030/244: update developer guide v1.2.1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 369eb7ca8c 032/244: minor typo in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 694e6fba3d 045/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 13c528765e 050/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 642fcdaf52 051/244: README updated, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit b4163c71c3 038/244: support org-mode, ELPA Syncer, 2022/01/06