[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil-matchit ff29cd2264 084/244: workaround issue in pytho
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil-matchit ff29cd2264 084/244: workaround issue in python-mode v2.0.2 |
Date: |
Thu, 6 Jan 2022 02:58:51 -0500 (EST) |
branch: elpa/evil-matchit
commit ff29cd22640595bb6669af666c910875358f4ff8
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>
workaround issue in python-mode v2.0.2
- python syntax is trick, have to compromise by disabling simple
jump in certain cases
- fixed issue in evil-simple-jump
- more debug code
---
README.org | 12 +++++++++---
evil-matchit-pkg.el | 2 +-
evil-matchit-python.el | 16 +++++++---------
evil-matchit-simple.el | 18 ++++++++++++------
evil-matchit.el | 27 ++++++++++++++++++++++++---
pkg.sh | 2 +-
screencast.gif | Bin 318351 -> 318351 bytes
7 files changed, 54 insertions(+), 23 deletions(-)
diff --git a/README.org b/README.org
index 7c6c2eb0f4..84cb19dd1a 100644
--- a/README.org
+++ b/README.org
@@ -1,4 +1,4 @@
-* evil-matchit (v2.0.1)
+* evil-matchit (v2.0.2)
Vim [[http://www.vim.org/scripts/script.php?script_id=39][matchit.vim]] by
Benji Fisher ported into Emacs.
@@ -65,7 +65,13 @@ Press "da%" to delete line(s) wrapped by tags including tags
themselves. `M-x ev
All commands support numeric argument like "3%", "5va%" or "9da%"
-Please note "3%" will jump to a line *3 percentage down the file*. It's the
default behavior in original evil-mode . You can `(setq
evilmi-may-jump-by-percentage nil)` to turn off this feature. Then "3%" will
*jump 3 times*.
+"3%" will jump to a line *3 percentage down the file*. It's the default
behavior in original evil-mode . You can `(setq evilmi-may-jump-by-percentage
nil)` to turn off this feature. Then "3%" will *jump 3 times*.
+
+Please note *only* "evil-visual-state" and "evil-normal-state" are officially
supported.
+
+If you need visually select lines, I highly recommend *using
"evilmi-selelct-items" instead*.
+
+This is actually *an advantage* of Emacs, you can tweak the select region
without go into visual state at all.
* Advanced tips
** Use evilmi-select-items instead press '%' in evil-visual-state
@@ -124,7 +130,7 @@ If you embed python language in a html file. You can match
both html tags and py
** Re-define keybinding
You can define your own key bindings instead using evil-matchit default key
binding.
-All you need to do is to define function evilmi-customize-keybinding before
turning on evil-mathcit-mode:
+All you need to do is to define function evilmi-customize-keybinding before
turning on evil-match-mode:
#+BEGIN_SRC elisp
(defun evilmi-customize-keybinding ()
(evil-define-key 'normal evil-matchit-mode-map
diff --git a/evil-matchit-pkg.el b/evil-matchit-pkg.el
index 46d9970267..5ea93698bc 100644
--- a/evil-matchit-pkg.el
+++ b/evil-matchit-pkg.el
@@ -1,2 +1,2 @@
-(define-package "evil-matchit" "2.0.1"
+(define-package "evil-matchit" "2.0.2"
"Vim matchit ported into Emacs (requires EVIL)")
diff --git a/evil-matchit-python.el b/evil-matchit-python.el
index b3c9a38a9f..4b9b7161f7 100644
--- a/evil-matchit-python.el
+++ b/evil-matchit-python.el
@@ -209,9 +209,8 @@
)
(setq rlt (list p tag-type keyword))
- rlt
- )
- )
+ (if (and evilmi-debug rlt) (message "evilmi-python-get-tag called. rlt=%s"
rlt))
+ rlt))
;;;###autoload
(defun evilmi-python-jump (rlt NUM)
@@ -223,10 +222,11 @@
(line-end-position)))
cur-indent
dendent
- where-to-jump-in-theory
- )
+ where-to-jump-in-theory)
+
(setq cur-indent (evilmi--python-calculate-indent cur-line))
+ (if evilmi-debug (message "evilmi-python-jump called. tag-type=%d p=%d"
tag-type p))
;; start from closed tag
(cond
((= 1 tag-type)
@@ -249,8 +249,7 @@
(evilmi--python-move-to-first-open-tag (1- cur-indent))
(setq where-to-jump-in-theory (point))
)
- )
- )
+ ))
)
)
@@ -281,8 +280,7 @@
(if where-to-jump-in-theory (goto-char where-to-jump-in-theory))
(evilmi--python-move-to-next-open-tag keyword cur-indent)
- )
- )
+ ))
where-to-jump-in-theory))
(provide 'evil-matchit-python)
diff --git a/evil-matchit-simple.el b/evil-matchit-simple.el
index 04940ee227..d21118e740 100644
--- a/evil-matchit-simple.el
+++ b/evil-matchit-simple.el
@@ -48,18 +48,21 @@
;;;###autoload
(defun evilmi-simple-get-tag ()
(let (p
+ tmp
ch
forward-line-num
rlt
(cur-line (buffer-substring-no-properties
- (line-beginning-position) (line-end-position)))
- (tag-chars (string-to-list "{[(}}])")))
+ (line-beginning-position) (line-end-position))))
;; Only handle open tag
- (setq ch (evilmi--get-char-under-cursor))
+ (setq tmp (evilmi--get-char-under-cursor))
+ (if tmp (setq ch (car tmp)))
+
+ (if evilmi-debug (message "ch=%d tag-chars=%s" ch tag-chars))
(cond
;; In evil-visual-state, the (preceding-char) is actually the character
under cursor
- ((not (memq ch tag-chars))
+ ((not (evilmi--char-is-simple ch))
(if (setq forward-line-num (evilmi--simple-find-open-brace cur-line))
(when forward-line-num
(setq p (line-beginning-position))
@@ -71,12 +74,16 @@
(t
;; use evil's own evilmi--simple-jump
(setq rlt (list (point)))))
+
+ (if (and evilmi-debug rlt) (message "evilmi-simple-get-tag called rlt=%s"
rlt))
rlt))
;;;###autoload
(defun evilmi-simple-jump (rlt NUM)
(let (cur-line)
(when rlt
+ (if evilmi-debug (message "evilmi-simple-jump called"))
+
(evilmi--simple-jump)
(setq cur-line (buffer-substring-no-properties
(line-beginning-position)
@@ -84,8 +91,7 @@
;; hack for javascript
(if (string-match "^[ \t]*})(.*)\; *$" cur-line)
(line-end-position)
- (1+ (point))
- )
+ (1+ (point)))
)
))
diff --git a/evil-matchit.el b/evil-matchit.el
index 58075e2239..7f82b6f3db 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.0.1
+;; Version: 2.0.2
;; Keywords: matchit vim evil
;; Package-Requires: ((evil "1.0.7"))
;;
@@ -56,11 +56,32 @@ If this flag is nil, then 50 means jump 50 times.")
(defvar evilmi-quote-chars (string-to-list "'\"/"))
(defvar evilmi-debug nil)
+(defun evilmi--char-is-simple (ch)
+ (let (rlt)
+ (setq rlt
+ (or (memq ch evilmi-forward-chars)
+ (memq ch evilmi-backward-chars)
+ ;; sorry we could not jump between ends of string in python-mode
+ (memq ch evilmi-quote-chars)))
+
+ (when (and (memq major-mode '(python-mode))
+ ;; in evil-visual-state, (point) could equal to
(line-end-position)
+ (>= (point) (1- (line-end-position))))
+ ;; handle follow python code,
+ ;;
+ ;; if true:
+ ;; a = "hello world"
+ ;;
+ ;; If current cursor is at end of line , rlt should be nil!
+ ;; or else, matching algorithm can't work in above python sample
+ (setq rlt nil))
+ rlt))
+
(defun evilmi--get-char-at-position (pos)
(let (ch)
;; evil load
(setq ch (char-after pos))
- (if evilmi-debug (message "evilmi-debug called. Return: %s" (string ch)))
+ (if evilmi-debug (message "evilmi--get-char-at-position called. Return:
%s" (string ch)))
ch))
(defun evilmi--get-char-under-cursor ()
@@ -438,7 +459,7 @@ If font-face-under-cursor is NOT nil, the quoted string is
being processed"
))
;;;###autoload
-(defun evilmi-version() (interactive) (message "2.0.1"))
+(defun evilmi-version() (interactive) (message "2.0.2"))
;;;###autoload
(define-minor-mode evil-matchit-mode
diff --git a/pkg.sh b/pkg.sh
index 996632db83..561a6b3657 100755
--- a/pkg.sh
+++ b/pkg.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-pkg=evil-matchit-2.0.1
+pkg=evil-matchit-2.0.2
mkdir $pkg
cp README.org $pkg
cp *.el $pkg
diff --git a/screencast.gif b/screencast.gif
index 48bb05fa54..baf5b0efdf 100644
Binary files a/screencast.gif and b/screencast.gif differ
- [nongnu] elpa/evil-matchit 642fcdaf52 051/244: README updated, (continued)
- [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
- [nongnu] elpa/evil-matchit 11ba040ab0 055/244: support json-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 5bc34a6bd5 060/244: minor ruby bug, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit fcf6b25407 063/244: fortran, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 338a10ccd6 066/244: fixed: by default shortcut % is disabled, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8540a4c12a 068/244: supports inner text object, v1.5.0, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8b4db43dc2 075/244: Merge pull request #44 from thegreatape/master, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit af40d309c6 078/244: documentation, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 89fd968ac2 080/244: spacemacs use enh-ruby-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit ff29cd2264 084/244: workaround issue in python-mode v2.0.2,
ELPA Syncer <=
- [nongnu] elpa/evil-matchit 63846fc4c0 089/244: Add melpa badge, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 62d948743e 092/244: updated README, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 98c045d352 094/244: Merge pull request #61 from robbyoconnor/patch-2, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 94e359e30c 095/244: Fix embedded major-mode detection in org-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit c675e740a7 101/244: can simple jump in latex-mode, #70, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 34c51f68fd 102/244: jump in diff-mode, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 64791bc376 105/244: clean code, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 51d46747e3 108/244: support Facebook React JSX, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit 8a56092b38 110/244: can handle `render()` in jsx, code cleaned, ELPA Syncer, 2022/01/06
- [nongnu] elpa/evil-matchit bed39041b1 123/244: support markdown, ELPA Syncer, 2022/01/06