emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-matchit 2fc961d94b 122/244: fixed css-mode minor issu


From: ELPA Syncer
Subject: [nongnu] elpa/evil-matchit 2fc961d94b 122/244: fixed css-mode minor issue
Date: Thu, 6 Jan 2022 02:58:55 -0500 (EST)

branch: elpa/evil-matchit
commit 2fc961d94b27e528df1fc4b88d297dd9af8ed6d6
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    fixed css-mode minor issue
---
 evil-matchit-simple.el | 19 +++++++++++--------
 evil-matchit.el        |  7 +++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/evil-matchit-simple.el b/evil-matchit-simple.el
index 82d5cf6c92..7c924c93eb 100644
--- a/evil-matchit-simple.el
+++ b/evil-matchit-simple.el
@@ -31,18 +31,21 @@
 (require 'evil-matchit)
 
 (defun evilmi--simple-find-open-brace (cur-line)
+  (if evilmi-debug (message "evilmi--simple-find-open-brace called => 
cur-line=%s (point)=%d" cur-line (point)))
   (let (rlt)
     ;; javascript code line "(function(...) { ..."
     ;; C code line "} else {"
-    (if (or (string-match "^[ \t]*[\(\}]?[_a-zA-Z0-9]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
-            (string-match "^[ \t]*[\(\}]?[_a-zA-Z0-9]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
-        (setq rlt 1)
+    (cond
+     ;; css-mode use characters ".:-"
+     ((or (string-match "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ *\\(\/\/.*\\)?$" 
cur-line)
+          (string-match "^[ \t]*[\(\}]?[.:_a-zA-Z0-9-]+.*{ 
*\\(\/\*[^/]*\*\/\\)?$" cur-line))
+      (setq rlt 1))
+     (t
       (save-excursion
         (forward-line)
         (setq cur-line (evilmi-sdk-curline))
         (if (string-match "^[ \t]*{ *$" cur-line)
-            (setq rlt 2))
-        ))
+            (setq rlt 2)))))
     rlt))
 
 ;;;###autoload
@@ -53,7 +56,7 @@
          (ch (if tmp (car tmp)))
          rlt)
 
-    (if evilmi-debug (message "evilmi-simple-get-tag called => %s" ch))
+    (if evilmi-debug (message "evilmi-simple-get-tag called => ch=%s 
(point)=%d" ch (point)))
 
     (cond
      ;; In evil-visual-state, the (preceding-char) is actually the character 
under cursor
@@ -75,7 +78,7 @@
 ;;;###autoload
 (defun evilmi-simple-jump (rlt NUM)
   (when rlt
-    (if evilmi-debug (message "evilmi-simple-jump called"))
+    (if evilmi-debug (message "evilmi-simple-jump called (point)=%d" (point)))
 
     ;; In latex-mode `scan-sexps' does NOT work properly between "[]"
     ;; so we have to fallback to evil's API.
@@ -84,7 +87,7 @@
       (evilmi--simple-jump))
 
     ;; hack for javascript
-    (if (string-match "^[ \t]*})\\((.*)\\)?\; *$"
+    (if (string-match-p "^[ \t]*})\\((.*)\\)?\; *$"
                       (evilmi-sdk-curline))
         (line-end-position)
       (1+ (point)))))
diff --git a/evil-matchit.el b/evil-matchit.el
index 1c1899261d..1a26e7b92f 100644
--- a/evil-matchit.el
+++ b/evil-matchit.el
@@ -99,6 +99,7 @@ Set this flag into `t' to always use simple jump.")
 (defun evilmi--is-jump-forward ()
   "Return: (forward-direction font-face-under-cursor character-under-cursor).
 If font-face-under-cursor is NOT nil, the quoted string is being processed."
+  (if evilmi-debug (message "evilmi--is-jump-forward called"))
   (let* ((tmp (evilmi--get-char-under-cursor))
          (ch (car tmp))
          (p (cadr tmp))
@@ -130,6 +131,9 @@ If font-face-under-cursor is NOT nil, the quoted string is 
being processed."
                   fontfaces))))
 
 (defun evilmi--scan-sexps (is-forward)
+  "Get the position of matching tag.
+If IS-FORWARD is t, jump forward; or else jump backward."
+  (if evilmi-debug (message "evilmi--scan-sexps called => %s" is-forward))
   (let* ((start-pos (if is-forward (point) (+ 1 (point))))
          (arg (if is-forward 1 -1))
          (limit (if is-forward (point-max) (point-min)))
@@ -209,6 +213,7 @@ If font-face-under-cursor is NOT nil, the quoted string is 
being processed."
 
 ;; @see 
http://emacs.stackexchange.com/questions/13222/a-elisp-function-to-jump-between-matched-pair
 (defun evilmi--find-position-to-jump (ff is-forward ch)
+  (if evilmi-debug (message "evilmi--find-position-to-jump called => %s %s %s 
%d" ff is-forward ch (point)))
   "Non-nil ff means jumping between quotes"
   (let* ((rlt (if ff (evilmi--find-the-other-quote-char ff is-forward ch)
                 (evilmi--scan-sexps is-forward))))
@@ -225,6 +230,7 @@ If font-face-under-cursor is NOT nil, the quoted string is 
being processed."
 (defun evilmi--simple-jump ()
   "Alternative for evil-jump-item."
   (interactive)
+  (if evilmi-debug (message "evilmi--simple-jump called (point)=%d" (point)))
   (let* ((tmp (evilmi--is-jump-forward))
          (jump-forward (car tmp))
          ;; if ff is not nil, it's jump between quotes
@@ -235,6 +241,7 @@ If font-face-under-cursor is NOT nil, the quoted string is 
being processed."
     (evilmi--tweak-selected-region ff jump-forward)))
 
 (defun evilmi--operate-on-item (num &optional FUNC)
+  (if evilmi-debug (message "evilmi--operate-on-item called => %s (point)=%d" 
num (point)))
   (let* ((plugin (plist-get evilmi-plugins major-mode))
          rlt
          jumped



reply via email to

[Prev in Thread] Current Thread [Next in Thread]