emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/haskell-tng-mode 8f4d7fc 225/385: advice around smartparen


From: ELPA Syncer
Subject: [nongnu] elpa/haskell-tng-mode 8f4d7fc 225/385: advice around smartparens workaround
Date: Tue, 5 Oct 2021 23:59:36 -0400 (EDT)

branch: elpa/haskell-tng-mode
commit 8f4d7fc93e70678eb2e67f47b03123bcbbd7f6b9
Author: Tseen She <ts33n.sh3@gmail.com>
Commit: Tseen She <ts33n.sh3@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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]