Use separate function for evil-delete-backward-char-and-join (#244)

This commit is contained in:
James Nguyen 2019-08-06 19:14:31 -07:00
parent c27071c3ff
commit d226a50061
1 changed files with 10 additions and 1 deletions

View File

@ -41,13 +41,22 @@
(hungry-delete-backward 1)
(apply f args)))
(defun evil-collection-hungry-delete-for-join (f &rest args)
"Wrapper function to run `hungry-delete-backward' if
`hungry-delete-mode' is on."
(interactive)
(if (and (bound-and-true-p hungry-delete-mode)
(fboundp 'hungry-delete-backward))
(hungry-delete-backward 1)
(funcall f args)))
;;;###autoload
(defun evil-collection-hungry-delete-setup ()
"Set up `evil' bindings for `hungry-delete'."
(advice-add 'evil-delete-backward-char
:around #'evil-collection-hungry-delete)
(advice-add 'evil-delete-backward-char-and-join
:around #'evil-collection-hungry-delete))
:around #'evil-collection-hungry-delete-for-join))
(provide 'evil-collection-hungry-delete)
;;; evil-collection-hungry-delete.el ends here