aboutsummaryrefslogtreecommitdiff
path: root/evil-ex.el
diff options
context:
space:
mode:
authorAxel Forsman <axelsfor@gmail.com>2023-07-18 10:48:18 +0200
committerAxel Forsman <axelsfor@gmail.com>2023-07-18 10:48:18 +0200
commit083586bd642a9ea8872e08672c94e7eb554fe06b (patch)
treeb11980489fbf6668efb2b80a4c6965925abd5d7d /evil-ex.el
parentf84d3453b312bd8ec0a1c092d075bbc3d91e157b (diff)
Simplify evil-ex-parse
Diffstat (limited to 'evil-ex.el')
-rw-r--r--evil-ex.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/evil-ex.el b/evil-ex.el
index fa3aada..1b2d716 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.