[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit eb5e0bedc6 021/244: select/delete matching ta
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit eb5e0bedc6 021/244: select/delete matching tags in C v1.0.2 |
Date: |
Thu, 6 Jan 2022 02:58:46 -0500 (EST) |
branch: elpa/evil-matchit
commit eb5e0bedc6aa6be08f3be217ac2fcf25e774fc16
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
select/delete matching tags in C v1.0.2
---
README.org | 26 ++++++++++++++++++--------
evil-matchit-c.el | 24 +++++++++++++++---------
evil-matchit-pkg.el | 2 +-
evil-matchit.el | 4 ++--
pkg.sh | 2 +-
5 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/README.org b/README.org
index 257fb33f89..21a38c423c 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (current version 1.0.1)
+* evil-matchit (current version 1.0.2)
Vim [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] by
Benji Fisher ported into Emacs.
@@ -13,7 +13,7 @@ Alternatively, you can enable evil-matchit-mode along a major
mode by adding `tu
* Why use evil-matchit
- No learning curve. You only need press "%" to jump between matched tags.
That's all!
-- Powerful. For example, if you mix jsp, freemarker, html, jquery template or
any wierd syntax in one file. It still work perfectly.
+- Powerful. For example, if you mix jsp, freemarker, html, jquery template or
any wierd
- Extendable. You can write a plugin for it in 5 minutes.
- Many languages will be supported soon.
- I will provide long term support for it (say next 10 years) because Emacs is
my last editor.
@@ -22,7 +22,7 @@ Alternatively, you can enable evil-matchit-mode along a major
mode by adding `tu
evil-matchit is already uploaded to [[http://marmalade-repo.org/]]. So the
best way to install it is using Emacs' package manager.
* How to use evil-matchit
-Press "%" to jump inside item(s) between tags in evil-normal-mode whose
command name is "evilmi-jump-items".
+Press "%" to jump inside item(s) between tags in evil-normal-mode whose
command name is "evilmi-jump-items". Please note that you *DO NOT* need move
cursor above the tag before jumping, evil-matchit is smart enough to *detect
the beginning of tag automatically*.
Press ",si" to select item(s) wrapped by tags in evil-normal-mode whose
command name is "evilmi-select-items".
@@ -78,10 +78,13 @@ Here is a complete sample:
;; parameter.
;; if NO tag found, the rlt SHOULD be nil
;;
-;; @return the data to be used by evilmi-mylanguage-jump
+;; @return the data to be used by evilmi-mylanguage-jump which should be a list
+;; the first element of the list is the position of cursor before jump
+;; we use it to select/delete tag. The other elements of the list could
+;; be any data type
(defun evilmi-mylanguage-find-tag ()
(let (rlt )
- (setq rlt '("anything-you-like" "anything-you-like" "anything-you-like")
+ (setq rlt '(position-of-open-end "anything-you-like" "anything-you-like")
rlt
)
)
@@ -92,8 +95,15 @@ Here is a complete sample:
;; selecting or deleting text between matching tags and tags
(defun evilmi-mylanguage-jump (rlt NUM)
(message "rlt=%s" rlt)
- ;; just a sample, the data type of rlt is totally controlled by you
- (goto-char (nth 0 rlt))
+ ;; if we need select region between tags (including tags itself)
+ ;; we get the beginning of region by reading the first element of
+ ;; rlt
+ (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
+ 888
)
;; tell evil-matchit how to use above functions
@@ -109,7 +119,7 @@ Tweak your code a little bit to make it a plugin and ask me
to merge it into mai
Please check "evil-matchit-latext.el" for technical details about plugin.
Key points about code quality of plugin:
-- minimum dependency. For example, if your plugin for html template files are
just some web-mode API wrapper, it will break when user don't have web-mode
+- minimum dependency. For example, if your plugin for html template files is
only some web-mode API wrapper, it will break when user don't have web-mode
- support emacs 23
- performance is the first priority
* Contact me
diff --git a/evil-matchit-c.el b/evil-matchit-c.el
index cc4ad231d4..ebdc5d68bf 100644
--- a/evil-matchit-c.el
+++ b/evil-matchit-c.el
@@ -47,20 +47,25 @@
;;;###autoload
(defun evilmi-c-get-tag ()
- (let (rlt
+ (let (p
+ forward-line-num
+ rlt
(cur-line (buffer-substring-no-properties
(line-beginning-position) (line-end-position)))
)
;; only handle open tag
- (when (and (not (memq (following-char) (string-to-list "{[(}}])")))
- (setq rlt (evilmi--c-find-open-brace cur-line))
- )
- (when rlt
- (forward-line (1- rlt))
- (search-forward "{" nil nil)
- (backward-char)
- )
+ (if (not (memq (following-char) (string-to-list "{[(}}])")))
+ (if (setq forward-line-num (evilmi--c-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
)
@@ -69,6 +74,7 @@
;;;###autoload
(defun evilmi-c-jump (rlt NUM)
(if rlt (evil-jump-item))
+ (1+ (point))
)
(provide 'evil-matchit-c)
\ No newline at end of file
diff --git a/evil-matchit-pkg.el b/evil-matchit-pkg.el
index 96bf44091d..b4921f932b 100644
--- a/evil-matchit-pkg.el
+++ b/evil-matchit-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-matchit" "1.0.1"
+(define-package "evil-matchit" "1.0.2"
"Vim matchit ported into Emacs (requires EVIL)")
diff --git a/evil-matchit.el b/evil-matchit.el
index 79456d276b..423512272d 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.0.1
+;; Version: 1.0.2
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -76,7 +76,7 @@
)
(defun evilmi--push-mark (rlt)
- (push-mark (nth 0 rlt) t t)
+ (push-mark (nth 0 rlt) t t)
)
(defun evilmi--init-plugins ()
diff --git a/pkg.sh b/pkg.sh
index 4c7e891ff3..f6d89f7370 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-matchit-1.0.1
+pkg=evil-matchit-1.0.2
mkdir $pkg
cp README.org $pkg
cp *.el $pkg
- [nongnu] branch elpa/evil-matchit created (now f9faa0b9bf), ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 13b95b675d 003/244: evil-jump-item parameter is wierd, v0.0.3, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit a837c1897e 006/244: tweak README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 05f80aacf2 004/244: Declare package dependency on evil, improve package description, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 808f226b2e 002/244: updated doc, v0.0.2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9ed81c8b78 014/244: fixed typo in README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 03f46e4006 001/244: first import, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fc1731e8b2 013/244: updated doc, hotkey set up, v0.0.5, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit eb5e0bedc6 021/244: select/delete matching tags in C v1.0.2,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 748647d518 017/244: dependent on sgml-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit cfcf0d083c 022/244: weak README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 90c8367856 027/244: add sdk v1.2.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 65b474bb02 031/244: Better C/C++, v1.2.2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3b64df7610 005/244: Merge pull request #3 from purcell/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 363b6683ab 033/244: ignore elisp flymake file, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 4f993303e1 044/244: delete leading spaces AND matched tags v1.2.9, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit dd3d90bf95 010/244: Fix malformed header line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 285f5c2413 024/244: udpated doc and screencast, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit c65da39f49 016/244: autoload sgml-mode, ELPA Syncer, 2022/01/06