diff options
| author | Axel Forsman <axelsfor@gmail.com> | 2023-01-15 22:38:07 +0100 |
|---|---|---|
| committer | Axel Forsman <axelsfor@gmail.com> | 2023-01-15 22:46:30 +0100 |
| commit | 49fc382e97f1900c228749fa592fd31408d5eb51 (patch) | |
| tree | b50a8066c6bc9b43c3019a4c0e8a73425a6d32ef /evil-macros.el | |
| parent | 29a5d464e973b66abae20e6c4b402a366547c7a5 (diff) | |
Re-add return-type evil-operator-range argument
It was removed by commit 29a5d464e973b66abae20e6c4b402a366547c7a5,
however this broke the evil-surround package.
Diffstat (limited to 'evil-macros.el')
| -rw-r--r-- | evil-macros.el | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/evil-macros.el b/evil-macros.el index 5e57f61..4631a99 100644 --- a/evil-macros.el +++ b/evil-macros.el @@ -563,24 +563,26 @@ Optional keyword arguments are: (setq evil-inhibit-operator-value nil))))) ;; this is used in the `interactive' specification of an operator command -(defun evil-operator-range () - "Read a motion from the keyboard and return its buffer positions." - (let* ((evil-ex-p (and (not (minibufferp)) (evil-ex-p))) +(defun evil-operator-range (&optional return-type) + "Read a motion from the keyboard and return its buffer positions. +The return value is a list (BEG END), or (BEG END TYPE) if +RETURN-TYPE is non-nil." + (let* ((ex-p (and (not (minibufferp)) (evil-ex-p))) (motion (or evil-operator-range-motion - (when evil-ex-p 'evil-line))) + (when ex-p 'evil-line))) (type evil-operator-range-type) range count) (setq evil-this-type-modified nil) (evil-save-echo-area (cond ;; Ex mode - ((and evil-ex-p evil-ex-range) + ((and ex-p evil-ex-range) (setq range evil-ex-range)) ;; Visual selection - ((and (not evil-ex-p) (evil-visual-state-p)) + ((and (not ex-p) (evil-visual-state-p)) (setq range (evil-visual-range))) ;; active region - ((and (not evil-ex-p) (region-active-p)) + ((and (not ex-p) (region-active-p)) (setq range (evil-range (region-beginning) (region-end) (or evil-this-type 'exclusive)))) @@ -636,7 +638,10 @@ Optional keyword arguments are: (setq evil-operator-range-beginning (evil-range-beginning range) evil-operator-range-end (evil-range-end range) evil-operator-range-type (evil-type range)) - range)) + (if return-type + (list (car range) (cadr range) (evil-type range)) + (setcdr (cdr range) nil) + range))) (defmacro evil-define-type (type doc &rest body) "Define type TYPE. |
