From c81304d18b869c320b2e6377aff2a011d0f000c5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 16 Jun 2018 11:41:07 +0200 Subject: [PATCH] Enable smartparens in eval-expression This is experimental, so we can have delimiter/quote autopairing while we write lisp into eval-expression. --- core/autoload/editor.el | 2 +- core/core-editor.el | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/autoload/editor.el b/core/autoload/editor.el index 4baa3fc93..f577f78d0 100644 --- a/core/autoload/editor.el +++ b/core/autoload/editor.el @@ -186,7 +186,7 @@ possible, or just one char if that's not possible." (insert-char ?\s (- ocol (current-column)) nil)))) ;; ((and (= n 1) - (not (minibufferp))) + (bound-and-true-p smartparens-mode)) (cond ((and (memq (char-before) (list ?\ ?\t)) (save-excursion (and (> (- (skip-chars-backward " \t" (line-beginning-position))) 0) diff --git a/core/core-editor.el b/core/core-editor.el index 1ce50532b..29a3475d7 100644 --- a/core/core-editor.el +++ b/core/core-editor.el @@ -151,6 +151,12 @@ fundamental-mode) for performance sake." (add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode) (add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode) + (defun doom|init-smartparens-in-eval-expression () + "Enable `smartparens-mode' in the minibuffer, during `eval-expression'." + (when (eq this-command 'eval-expression) + (smartparens-mode))) + (add-hook 'minibuffer-setup-hook #'doom|init-smartparens-in-eval-expression) + (sp-local-pair '(xml-mode nxml-mode php-mode) "" :post-handlers '(("| " "SPC")))