[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit df642d953d 139/244: add a few APIs
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit df642d953d 139/244: add a few APIs |
Date: |
Thu, 6 Jan 2022 02:58:56 -0500 (EST) |
branch: elpa/evil-matchit
commit df642d953d76560f44bc8c6ed4f6453ab74e4aa0
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
add a few APIs
---
README.org | 6 +++++-
evil-matchit-sdk.el | 25 +++++++++++++++++++++++++
evil-matchit.el | 21 +++++----------------
pkg.sh | 2 +-
4 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/README.org b/README.org
index 1fcc604402..e84d747c2b 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.2.6)
+* evil-matchit (v2.2.7)
[[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]]
@@ -163,6 +163,10 @@ You can turn on =evilmi-always-simple-jump= to match
brackets at first.
Thus you disable our *advanced algorithm* which I highly recommend.
Some people may prefer simpler algorithm in =python-mode.
+** APIs you can use
+- evilmi-current-font-among-fonts-p
+- evilmi-in-comment-p
+- evilmi-in-string-or-doc-p
* Developer guide
** Write Emacs Lisp to support new language
Simple. You only need define two functions and tell evil-matchit in which
major-mode they should be used.
diff --git a/evil-matchit-sdk.el b/evil-matchit-sdk.el
index ce7e6fdd06..9ba651ddeb 100644
--- a/evil-matchit-sdk.el
+++ b/evil-matchit-sdk.el
@@ -260,6 +260,31 @@ after calling this function."
where-to-jump-in-theory))
+
+;;;###autoload
+(defun evilmi-current-font-among-fonts-p (pos fonts)
+ "If current font at POS is among FONTS."
+ (let* ((fontfaces (get-text-property pos 'face)))
+ (when (not (listp fontfaces))
+ (setf fontfaces (list fontfaces)))
+ (delq nil
+ (mapcar (lambda (f)
+ (member f fonts))
+ fontfaces))))
+
+;;;###autoload
+(defun evilmi-in-comment-p (pos)
+ "Check character at POS is comment by comparing font face."
+ (evilmi-current-font-among-fonts-p pos '(font-lock-comment-face
+ font-lock-comment-delimiter-face)))
+
+
+;;;###autoload
+(defun evilmi-in-string-or-doc-p (pos)
+ "Check character at POS is string or docuemnt by comparing font face."
+ (evilmi-current-font-among-fonts-p pos '(font-lock-string-face
+ font-lock-doc-face)))
+
(defun evilmi-count-matches (regexp str)
(let* ((count 0)
(start 0))
diff --git a/evil-matchit.el b/evil-matchit.el
index 3b8f9f91bd..f61526dd6b 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.6
+;; Version: 2.2.7
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -43,6 +43,7 @@
;;; Code:
(require 'evil)
+(require 'evil-matchit-sdk)
(defvar evilmi-plugins '(emacs-lisp-mode
((evilmi-simple-get-tag evilmi-simple-jump)))
@@ -118,18 +119,6 @@ If font-face-under-cursor is NOT nil, the quoted string is
being processed."
(if evilmi-debug (message "evilmi--is-jump-forward return (%s %s %s)" rlt
ff (string ch)))
(list rlt ff ch)))
-(defun evilmi--in-comment-p (pos)
- "Check the code at POS is comment by comparing font face."
- (let* ((fontfaces (get-text-property pos 'face)))
- (when (not (listp fontfaces))
- (setf fontfaces (list fontfaces)))
- (delq nil
- (mapcar #'(lambda (f)
- ;; learn this trick from flyspell
- (or (eq f 'font-lock-comment-face)
- (eq f 'font-lock-comment-delimiter-face)))
- fontfaces))))
-
(defun evilmi--scan-sexps (is-forward)
"Get the position of matching tag.
If IS-FORWARD is t, jump forward; or else jump backward."
@@ -151,7 +140,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
((= b 93) 91)))
(rlt start-pos))
(cond
- ((evilmi--in-comment-p (point))
+ ((evilmi-in-comment-p (point))
;; Matching tag in comment.
;; Use own algorithm instead of `scan-sexps'
;; because `scan-sexps' not work in some major-mode
@@ -161,7 +150,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
(> lvl 0))
(setq start-pos (+ start-pos arg))
(goto-char start-pos)
- (if (evilmi--in-comment-p start-pos)
+ (if (evilmi-in-comment-p start-pos)
(cond
((= (following-char) b)
(setq lvl (1+ lvl)))
@@ -501,7 +490,7 @@ If IS-FORWARD is t, jump forward; or else jump backward."
;;;###autoload
(defun evilmi-version()
(interactive)
- (message "2.2.6"))
+ (message "2.2.7"))
;;;###autoload
(define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index b33e06ad72..a366632053 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,6 +1,6 @@
#!/bin/bash
name=evil-matchit
-version=2.2.6
+version=2.2.7
pkg=$name-$version
mkdir $pkg
cp README.org $pkg
- [nongnu] elpa/evil-matchit acb89199d0 074/244: Fix matching chaining off end blocks, (continued)
- [nongnu] elpa/evil-matchit acb89199d0 074/244: Fix matching chaining off end blocks, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 296c31f93d 073/244: Fix matching multiple arguments and varibles with underscores in do/end blocks., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 9a1b6ac1f9 076/244: can jump between brackets in visual-state #42, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 11352e24ff 083/244: support more pattern in lua-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit e831d42aa5 085/244: relax regex for python matching, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 3c9d97f3d3 090/244: Merge pull request #60 from robbyoconnor/patch-1, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 14e23187df 093/244: Put the melpa badges on the same line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8b80b3df94 098/244: correct inner text-object in python-mode v2.1.2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 1a5c4454a7 111/244: support verilog, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ceb13ad1b3 131/244: use more generic when processing C, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit df642d953d 139/244: add a few APIs,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 5ff747a1ef 125/244: When jumping find the first matching keyword in the current line, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 18cf34bc62 150/244: Update evil-matchit-verilog.el, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit f87f03bbf4 169/244: add generic rule to jump between brackets, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 00ab601346 161/244: support "define_method(method) do |*args|", ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 77c4a0a1d9 175/244: Ocaml: double semicolon matches let., ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 2ea15db747 185/244: improve ruby matching algorithm (fixed item 1 of #114), ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit e44de538b9 196/244: clean code & doc, ELPA Syncer, 2022/01/06
- [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