aboutsummaryrefslogtreecommitdiff
path: root/evil-ex.el
diff options
context:
space:
mode:
authorTom Dalziel <tom_dl@hotmail.com>2023-08-13 18:03:42 +0100
committerTom Dalziel <tom_dl@hotmail.com>2023-08-13 18:04:39 +0100
commitb7b4961a14cd1a51e9a10564fd6c741567d39891 (patch)
treef62d0a8beaffa1da9e78857deffb873d11adc058 /evil-ex.el
parent1e9b2434264529fe0dd964b68fe89236a4abeac3 (diff)
Urgent revert of recent commits while evil is broken
Some of these commits can be almost immediately restored, once the time is found to do so. Revert "Fix evil-with-delay with dynamic binding" This reverts commit 1e9b2434264529fe0dd964b68fe89236a4abeac3. Revert "Some cleanups" This reverts commit 0cbd61f2de104fab16602d0418605cd0513b16f3. Revert "Misc minor changes" This reverts commit b291039b0c6ffc3b2f3c9f02b8ad2f0041127b12. Revert "Merge evil-with-delay condition and body lambdas" This reverts commit 1b56ffcc102b4c5f8b015e760b5f9cf5932622af. Revert "(evil-with-delay): New macro, extracted from `evil-delay`" This reverts commit 3d7faadf30016a8c20699a5fb1b5731b8a49dcd2. Revert "Make evil-search-wrap-ring-bell work with evil-search" This reverts commit 5e72cf5b6d57b785ea229236bb5c4638db2c9a05. Revert "Stop the '</'> and '[/'] marks from intertwining" This reverts commit 26db9441a13ebedb2481d7ada4c3b5e60ec22795. Revert "Remove redundant `:group` args" This reverts commit 6e30037fdc6a275d78d6b82d89bd8e47bcf4d4e3. Revert "Avoid eval in evil-test-buffer" This reverts commit 27d81ad406d2d3e07591b927357d2354ef5b5c65. Revert "Use lexical-binding everywhere" This reverts commit 44c7f301468c264a781be4ee8ae879fe1b457e60.
Diffstat (limited to 'evil-ex.el')
-rw-r--r--evil-ex.el52
1 files changed, 29 insertions, 23 deletions
diff --git a/evil-ex.el b/evil-ex.el
index f91c1a1..5ae3aa4 100644
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -44,6 +44,7 @@
(require 'evil-common)
(require 'evil-states)
+(require 'evil-types)
(declare-function evil-goto-line "evil-commands")
@@ -76,9 +77,10 @@
#'(evil-ex-char-marker-range $2 $4)))
(line
((\? base) (\? offset) search (\? offset)
- #'(save-excursion
- (goto-line (evil-ex-line $1 $2))
- (evil-ex-line $3 $4)))
+ #'(let ((tmp (evil-ex-line $1 $2)))
+ (save-excursion
+ (goto-line tmp)
+ (evil-ex-line $3 $4))))
(base (\? offset) #'evil-ex-line)
(nil offset #'evil-ex-line))
(base
@@ -304,9 +306,6 @@ The following symbols have reserved meanings within a grammar:
(defvar evil-ex-argument-types nil
"Association list of argument handlers.")
-(defvar evil-ex-commands nil
- "Association list of command bindings and functions.")
-
(defvar evil-ex-reverse-range nil
"Whether the current Ex range was entered reversed.")
@@ -400,9 +399,8 @@ symbol, which defaults to `expression'."
#'delete-backward-char
#'abort-recursive-edit)))
-(cl-defstruct (evil-ex-argument-handler (:type list) (:constructor nil)
- (:copier nil) (:predicate nil))
- (runner nil :read-only t) (completer nil :read-only t))
+(define-obsolete-function-alias
+ 'evil-ex-elisp-completion-at-point #'elisp-completion-at-point "1.15.0")
(defun evil-ex-setup ()
"Initialize Ex minibuffer.
@@ -415,9 +413,10 @@ actions during Ex state."
(defun evil-ex-teardown ()
"Deinitialize Ex minibuffer.
Clean up everything set up by `evil-ex-setup'."
- (let ((runner (evil-ex-argument-handler-runner
- evil--ex-argument-handler)))
- (when runner (funcall runner 'stop))))
+ (when evil--ex-argument-handler
+ (let ((runner (evil-ex-argument-handler-runner
+ evil--ex-argument-handler)))
+ (when runner (funcall runner 'stop)))))
(put 'evil-ex-teardown 'permanent-local-hook t)
(defsubst evil--ex-bang-p (command)
@@ -490,10 +489,13 @@ in case of incomplete or unknown commands."
(defun evil--ex-remove-echo-overlay ()
"Remove echo overlay from Ex minibuffer."
- (delete-overlay evil--ex-echo-overlay)
- (setq evil--ex-echo-overlay nil)
+ (when evil--ex-echo-overlay
+ (delete-overlay evil--ex-echo-overlay)
+ (setq evil--ex-echo-overlay nil))
(remove-hook 'pre-command-hook #'evil--ex-remove-echo-overlay t))
+(define-obsolete-function-alias 'evil-ex-completion #'completion-at-point "1.15.0")
+
(cl-defun evil-ex-completion-at-point ()
"Function used for `completion-at-point-functions' in Ex state."
(cl-flet ((fix-beg (b) (min (save-excursion
@@ -524,6 +526,9 @@ in case of incomplete or unknown commands."
(`((expression) (sexp . ,_))
(when (fboundp 'elisp-completion-at-point) (elisp-completion-at-point))))))
+(define-obsolete-function-alias
+ 'evil-ex-command-completion-at-point #'evil-ex-completion-at-point "1.15.0")
+
(defun evil-ex-completion-table ()
(let ((ex-cmds
(cl-loop
@@ -572,18 +577,10 @@ in case of incomplete or unknown commands."
(p2 (eq (get-text-property 0 'face str2) 'evil-ex-commands)))
(if (eq p1 p2) (string< str1 str2) p1)))))
-(define-obsolete-function-alias 'evil-ex-completion #'completion-at-point "1.15.0")
-
-(define-obsolete-function-alias
- 'evil-ex-command-completion-at-point #'evil-ex-completion-at-point "1.15.0")
-
(defalias 'evil-ex-argument-completion-at-point #'ignore)
(make-obsolete
'evil-ex-argument-completion-at-point #'evil-ex-completion-at-point "1.15.0")
-(define-obsolete-function-alias
- 'evil-ex-elisp-completion-at-point #'elisp-completion-at-point "1.15.0")
-
(defun evil-ex-define-cmd (cmd function)
"Bind the function FUNCTION to the command CMD."
(if (string-match "\\[\\(.*\\)\\]" cmd)
@@ -594,6 +591,15 @@ in case of incomplete or unknown commands."
abbrev full))
(evil--add-to-alist evil-ex-commands cmd function)))
+(defsubst evil-ex-make-argument-handler (runner completer)
+ (list runner completer))
+
+(defun evil-ex-argument-handler-runner (arg-handler)
+ (car arg-handler))
+
+(defun evil-ex-argument-handler-completer (arg-handler)
+ (cadr arg-handler))
+
(defmacro evil-ex-define-argument-type (arg-type doc &rest body)
"Define a new handler for argument-type ARG-TYPE.
DOC is the documentation string. It is followed by a list of keywords
@@ -829,7 +835,7 @@ This function interprets special file names like # and %."
(defun evil-ex-last-visual-range ()
"Return a linewise range of the last visual selection."
- (evil-range evil-visual-mark evil-visual-point 'line))
+ (evil-line-expand evil-visual-mark evil-visual-point))
(defun evil-ex-marker (marker)
"Return MARKER's line number in the current buffer.