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

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

[nongnu] elpa/evil 083586bd64: Simplify evil-ex-parse


From: ELPA Syncer
Subject: [nongnu] elpa/evil 083586bd64: Simplify evil-ex-parse
Date: Tue, 18 Jul 2023 07:00:45 -0400 (EDT)

branch: elpa/evil
commit 083586bd642a9ea8872e08672c94e7eb554fe06b
Author: Axel Forsman <axelsfor@gmail.com>
Commit: Axel Forsman <axelsfor@gmail.com>

    Simplify evil-ex-parse
---
 evil-commands.el | 10 +++++-----
 evil-ex.el       | 18 ++++++++----------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/evil-commands.el b/evil-commands.el
index f8b9cd12ee..8a8599a216 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -2718,7 +2718,7 @@ lines.  This is the default behaviour for Visual-state 
insertion."
                                         (current-column)
                                         vcount))
           evil-insert-skip-empty-lines skip-empty-lines)
-    (evil-insert-state)))
+    (evil-insert-state 1)))
 
 (defun evil-append (count &optional vcount skip-empty-lines)
   "Switch to Insert state just after point.
@@ -2808,7 +2808,7 @@ The insertion will be repeated COUNT times."
   (unwind-protect
       (when evil-auto-indent
         (indent-according-to-mode))
-    (evil-insert-state)))
+    (evil-insert-state 1)))
 
 (evil-define-command evil-open-below (count)
   "Insert a new line below point and switch to Insert state.
@@ -2825,7 +2825,7 @@ The insertion will be repeated COUNT times."
   (unwind-protect
       (when evil-auto-indent
         (indent-according-to-mode))
-    (evil-insert-state)))
+    (evil-insert-state 1)))
 
 (defun evil--insert-line (count vcount non-blank-p)
   "Switch to insert state at the beginning of the current line.
@@ -2854,7 +2854,7 @@ in the next VCOUNT - 1 lines below the current one."
              (list (line-number-at-pos)
                    (if non-blank-p #'evil-first-non-blank 
#'evil-beginning-of-line)
                    vcount)))
-  (evil-insert-state))
+  (evil-insert-state 1))
 
 (defun evil-insert-line (count &optional vcount)
   "Switch to insert state at beginning of current line.
@@ -2892,7 +2892,7 @@ next VCOUNT - 1 lines below the current one."
              (list (line-number-at-pos)
                    #'end-of-line
                    vcount)))
-  (evil-insert-state))
+  (evil-insert-state 1))
 
 (evil-define-command evil-insert-digraph (count)
   "Insert COUNT digraphs."
diff --git a/evil-ex.el b/evil-ex.el
index fa3aada0e2..1b2d7169e2 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -379,19 +379,17 @@ the initial input is the visual region '<,'> or `<,`>. 
The variable
 If STRING is nil, parse the text after point instead.  If SYNTAX is
 non-nil, return a syntax tree instead.  ENTRYPOINT is the start
 symbol, which defaults to `expression'."
-  (let ((parse
-         (lambda ()
-           (let ((result (funcall (evil-parser evil-ex-grammar expression 
range)
-                                  (or entrypoint 'expression) syntax)))
-             (and result
-                  ;; Disallow incomplete matches (ignore trailing WS)
-                  (not (search-forward "[^ \t\n\r]" nil t))
-                  (car result))))))
-    (if (not string) (funcall parse)
+  (if string
       (with-temp-buffer
         (insert string)
         (goto-char (point-min))
-        (funcall parse)))))
+        (evil-ex-parse nil syntax entrypoint))
+    (let ((result (funcall (evil-parser evil-ex-grammar expression range)
+                           (or entrypoint 'expression) syntax)))
+      (and result
+           ;; Disallow incomplete matches (ignore trailing WS)
+           (not (search-forward "[^ \t\n\r]" nil t))
+           (car result)))))
 
 (defun evil-ex-delete-backward-char ()
   "Close the minibuffer if it is empty.



reply via email to

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