diff options
| author | Axel Forsman <axelsfor@gmail.com> | 2023-07-18 10:48:18 +0200 |
|---|---|---|
| committer | Axel Forsman <axelsfor@gmail.com> | 2023-07-18 10:48:18 +0200 |
| commit | 083586bd642a9ea8872e08672c94e7eb554fe06b (patch) | |
| tree | b11980489fbf6668efb2b80a4c6965925abd5d7d /evil-ex.el | |
| parent | f84d3453b312bd8ec0a1c092d075bbc3d91e157b (diff) | |
Simplify evil-ex-parse
Diffstat (limited to 'evil-ex.el')
| -rw-r--r-- | evil-ex.el | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -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. |
