From 486e27edd50d7edcec4fbfc415cd8036004259d3 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Wed, 15 Jun 2022 12:31:06 +0100 Subject: Prevent hippie expand line from unbalancing parens --- .emacs.d/lisp/init-completion.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.emacs.d') diff --git a/.emacs.d/lisp/init-completion.el b/.emacs.d/lisp/init-completion.el index 7bc8ce4..6449aef 100644 --- a/.emacs.d/lisp/init-completion.el +++ b/.emacs.d/lisp/init-completion.el @@ -25,6 +25,12 @@ try-expand-line try-complete-lisp-symbol-partially try-complete-lisp-symbol)) + :config + ;; https://www.emacswiki.org/emacs/HippieExpand#h5o-9 + (defadvice he-substitute-string (after he-paredit-fix) + "Remove extra paren when expanding line in paredit." + (if (and paredit-mode (equal (substring str -1) ")")) + (progn (backward-delete-char 1) (forward-char)))) :bind ("C-M-/" . hippie-expand)) -- cgit 1.4.1-2-gfad0