Revise code comments in smartparens config

This commit is contained in:
Henrik Lissner 2018-07-24 20:08:11 +02:00
parent f58f3c3604
commit a07126f611
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -139,7 +139,8 @@ fundamental-mode) for performance sake."
;; Core Plugins ;; Core Plugins
;; ;;
;; Auto-close delimiters and blocks as you type ;; Auto-close delimiters and blocks as you type. It's more powerful than that,
;; but that is all Doom uses it for.
(def-package! smartparens (def-package! smartparens
:after-call (doom-exit-buffer-hook after-find-file) :after-call (doom-exit-buffer-hook after-find-file)
:commands (sp-pair sp-local-pair sp-with-modes) :commands (sp-pair sp-local-pair sp-with-modes)
@ -155,7 +156,9 @@ fundamental-mode) for performance sake."
sp-max-prefix-length 50 sp-max-prefix-length 50
sp-escape-quotes-after-insert nil) ; not smart enough sp-escape-quotes-after-insert nil) ; not smart enough
;; Slim down on smartparens' opinionated behavior ;; Smartparens' navigation feature is neat, but does not justify how expensive
;; it is. It's also less useful for evil users. This may need to be
;; reactivated for non-evil users though. Needs more testing!
(defun doom|disable-smartparens-navigate-skip-match () (defun doom|disable-smartparens-navigate-skip-match ()
(setq sp-navigate-skip-match nil (setq sp-navigate-skip-match nil
sp-navigate-consider-sgml-tags nil)) sp-navigate-consider-sgml-tags nil))
@ -170,7 +173,7 @@ fundamental-mode) for performance sake."
(add-hook 'minibuffer-setup-hook #'doom|init-smartparens-in-eval-expression) (add-hook 'minibuffer-setup-hook #'doom|init-smartparens-in-eval-expression)
(sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil) (sp-local-pair 'minibuffer-inactive-mode "'" nil :actions nil)
;; smartparenss conflicts with evil-mode's replace state ;; smartparens breaks evil-mode's replace state
(add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode) (add-hook 'evil-replace-state-entry-hook #'turn-off-smartparens-mode)
(add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode) (add-hook 'evil-replace-state-exit-hook #'turn-on-smartparens-mode)
@ -215,6 +218,7 @@ fundamental-mode) for performance sake."
:commands (er/contract-region er/mark-symbol er/mark-word) :commands (er/contract-region er/mark-symbol er/mark-word)
:config :config
(defun doom*quit-expand-region () (defun doom*quit-expand-region ()
"Properly abort an expand-region region."
(when (memq last-command '(er/expand-region er/contract-region)) (when (memq last-command '(er/expand-region er/contract-region))
(er/contract-region 0))) (er/contract-region 0)))
(advice-add #'evil-escape :before #'doom*quit-expand-region) (advice-add #'evil-escape :before #'doom*quit-expand-region)