branch: elpa/haskell-tng-mode commit 8f4d7fc93e70678eb2e67f47b03123bcbbd7f6b9 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
advice around smartparens workaround --- haskell-tng-contrib-smartparens.el | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/haskell-tng-contrib-smartparens.el b/haskell-tng-contrib-smartparens.el index a8ffc11..7945f5d 100644 --- a/haskell-tng-contrib-smartparens.el +++ b/haskell-tng-contrib-smartparens.el @@ -17,14 +17,11 @@ (sp-local-pair 'haskell-tng-mode (car pair) (cdr pair) :post-handlers '(("| " "SPC")))) -;; TODO use advise instead of redefining the function -;; WORKAROUND smartparens indenting all the time -(defun sp--indent-region (start end &optional column) - (unless (or - (bound-and-true-p haskell-tng-mode) - (bound-and-true-p aggressive-indent-mode)) - (cl-letf (((symbol-function 'message) #'ignore)) - (indent-region start end column)))) +(advice-add #'sp--indent-region :around #'haskell-tng--contrib-sp-indent) +(defun haskell-tng--contrib-sp-indent (f &rest args) + "Disables `sp--indent-region' locally." + (unless (eq major-mode 'haskell-tng-mode) + (apply f args))) (add-hook 'haskell-tng-mode-hook