Some evil-cp work
This commit is contained in:
parent
f55065d312
commit
48d546c561
26
init.el
26
init.el
@ -448,7 +448,31 @@ directory. Otherwise, run `find-file' on that file."
|
||||
(if (member major-mode '(lisp-mode emacs-lisp-mode
|
||||
lisp-interaction-mode))
|
||||
(evil-cleverparens-mode 1)
|
||||
(electric-pair-local-mode 1))))
|
||||
(electric-pair-local-mode 1)))
|
||||
(defun my/inside-bound-p (beg end bounds)
|
||||
"Return non-nil if BEG and END are inside BOUNDS.
|
||||
BOUNDS should be either nil, in which case this will return nil, or a cons cell
|
||||
of the form (bound-start . bound-end)"
|
||||
(when bounds
|
||||
(cl-destructuring-bind (bs . be) bounds
|
||||
(and (>= beg bs) (<= beg be)
|
||||
(>= end bs) (<= end be)))))
|
||||
(defun my/-fix-evil-cp-delete (oldfun beg end type register yank-handler)
|
||||
"Make `evil-cp-delete' fall back to `evil-delete' if we are inside a
|
||||
string."
|
||||
(if (my/inside-bound-p beg end (bounds-of-thing-at-point 'string))
|
||||
(funcall 'evil-delete beg end type register yank-handler)
|
||||
(funcall oldfun beg end type register yank-handler)))
|
||||
(defun my/-fix-evil-cp-delete-char-or-splice
|
||||
(oldfun beg end type register yank-handler)
|
||||
"Make `evil-cp-delete' fall back to `evil-delete' if we are inside a
|
||||
string."
|
||||
(if (my/inside-bound-p beg end (bounds-of-thing-at-point 'string))
|
||||
(funcall 'evil-delete-char beg end type register)
|
||||
(funcall oldfun beg end type register yank-handler)))
|
||||
(advice-add 'evil-cp-delete)
|
||||
(advice-add 'evil-cp-delete-char-or-splice :around
|
||||
'my/-fix-evil-cp-delete-char-or-splice))
|
||||
|
||||
;; make lisp editing nicer
|
||||
(use-package aggressive-indent
|
||||
|
Loading…
Reference in New Issue
Block a user