aboutsummaryrefslogtreecommitdiff
path: root/evil-common.el
diff options
context:
space:
mode:
authorVasilij Schneidermann <v.schneidermann@gmail.com>2017-02-14 23:36:27 +0100
committerEivind Fonn <evfonn@gmail.com>2017-02-15 13:07:33 +0100
commit9e166de9a2faafeafaa22888d4e787bc0c36e86a (patch)
treec9f0632f16db25a68a2a5f4135ab6c5879366e38 /evil-common.el
parent78750cd5e729e3d9545d5d31cd04ffa0599c4acf (diff)
Require cl-lib instead of cl
Diffstat (limited to 'evil-common.el')
-rw-r--r--evil-common.el90
1 files changed, 44 insertions, 46 deletions
diff --git a/evil-common.el b/evil-common.el
index 4651db1..0e28aa7 100644
--- a/evil-common.el
+++ b/evil-common.el
@@ -3208,52 +3208,50 @@ must be regular expressions and `evil-up-block' is used.
If the selection is exclusive, whitespace at the end or at the
beginning of the selection until the end-of-line or beginning-of-line
is ignored."
- (lexical-let
- ((open open) (close close))
- ;; we need special linewise exclusive selection
- (unless inclusive (setq inclusive 'exclusive-line))
- (cond
- ((and (characterp open) (characterp close))
- (let ((thing #'(lambda (&optional cnt)
- (evil-up-paren open close cnt)))
- (bnd (or (bounds-of-thing-at-point 'evil-string)
- (bounds-of-thing-at-point 'evil-comment)
- ;; If point is at the opening quote of a string,
- ;; this must be handled as if point is within the
- ;; string, i.e. the selection must be extended
- ;; around the string. Otherwise
- ;; `evil-select-block' might do the wrong thing
- ;; because it accidentally moves point inside the
- ;; string (for inclusive selection) when looking
- ;; for the current surrounding block. (re #364)
- (and (= (point) (or beg (point)))
- (save-excursion
- (goto-char (1+ (or beg (point))))
- (or (bounds-of-thing-at-point 'evil-string)
- (bounds-of-thing-at-point 'evil-comment)))))))
- (if (not bnd)
- (evil-select-block thing beg end type count inclusive)
- (or (evil-with-restriction (car bnd) (cdr bnd)
- (condition-case nil
- (evil-select-block thing beg end type count inclusive)
- (error nil)))
- (save-excursion
- (setq beg (or beg (point))
- end (or end (point)))
- (goto-char (car bnd))
- (let ((extbeg (min beg (car bnd)))
- (extend (max end (cdr bnd))))
- (evil-select-block thing
- extbeg extend
- type
- count
- inclusive
- (or (< extbeg beg) (> extend end))
- t)))))))
- (t
- (evil-select-block #'(lambda (&optional cnt)
- (evil-up-block open close cnt))
- beg end type count inclusive)))))
+ ;; we need special linewise exclusive selection
+ (unless inclusive (setq inclusive 'exclusive-line))
+ (cond
+ ((and (characterp open) (characterp close))
+ (let ((thing #'(lambda (&optional cnt)
+ (evil-up-paren open close cnt)))
+ (bnd (or (bounds-of-thing-at-point 'evil-string)
+ (bounds-of-thing-at-point 'evil-comment)
+ ;; If point is at the opening quote of a string,
+ ;; this must be handled as if point is within the
+ ;; string, i.e. the selection must be extended
+ ;; around the string. Otherwise
+ ;; `evil-select-block' might do the wrong thing
+ ;; because it accidentally moves point inside the
+ ;; string (for inclusive selection) when looking
+ ;; for the current surrounding block. (re #364)
+ (and (= (point) (or beg (point)))
+ (save-excursion
+ (goto-char (1+ (or beg (point))))
+ (or (bounds-of-thing-at-point 'evil-string)
+ (bounds-of-thing-at-point 'evil-comment)))))))
+ (if (not bnd)
+ (evil-select-block thing beg end type count inclusive)
+ (or (evil-with-restriction (car bnd) (cdr bnd)
+ (condition-case nil
+ (evil-select-block thing beg end type count inclusive)
+ (error nil)))
+ (save-excursion
+ (setq beg (or beg (point))
+ end (or end (point)))
+ (goto-char (car bnd))
+ (let ((extbeg (min beg (car bnd)))
+ (extend (max end (cdr bnd))))
+ (evil-select-block thing
+ extbeg extend
+ type
+ count
+ inclusive
+ (or (< extbeg beg) (> extend end))
+ t)))))))
+ (t
+ (evil-select-block #'(lambda (&optional cnt)
+ (evil-up-block open close cnt))
+ beg end type count inclusive))))
(defun evil-select-quote-thing (thing beg end type count &optional inclusive)
"Selection THING as if it described a quoted object.