File tree 3 files changed +13
-9
lines changed
3 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -404,6 +404,13 @@ same vein as `haskell-indent-spaces'."
404
404
:group 'haskell
405
405
:type '(repeat 'string ))
406
406
407
+ ;;;### autoload
408
+ (defcustom haskell-stylish-on-save nil
409
+ " Whether to run stylish-haskell on the buffer before saving.
410
+ If this is true, `haskell-add-import' will not sort or align the
411
+ imports."
412
+ :group 'haskell
413
+ :type 'boolean )
407
414
408
415
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
409
416
; ; Accessor functions
Original file line number Diff line number Diff line change @@ -820,12 +820,6 @@ Note that negative arguments do not work so well."
820
820
(const " ghc -fno-code" )
821
821
(string :tag " Other command" )))
822
822
823
- ;;;### autoload
824
- (defcustom haskell-stylish-on-save nil
825
- " Whether to run stylish-haskell on the buffer before saving."
826
- :group 'haskell
827
- :type 'boolean )
828
-
829
823
;;;### autoload
830
824
(defcustom haskell-tags-on-save nil
831
825
" Generate tags via hasktags after saving."
Original file line number Diff line number Diff line change 23
23
(require 'haskell-navigate-imports )
24
24
(require 'haskell-complete-module )
25
25
(require 'haskell-sandbox )
26
+ (require 'haskell-customize )
26
27
27
28
(defun haskell-add-import (&optional module )
28
- " Add an import to the import list."
29
+ " Add an import to the import list. Sorts and aligns imports,
30
+ unless `haskell-stylish-on-save' is set, in which case we defer
31
+ to stylish-haskell."
29
32
(interactive )
30
33
(save-excursion
31
34
(goto-char (point-max ))
35
38
(haskell-complete-module-read
36
39
" Module: "
37
40
(haskell-session-all-modules (haskell-modules-session))))))
38
- (haskell-sort-imports )
39
- (haskell-align-imports )))
41
+ (unless haskell-stylish-on-save ( haskell-sort-imports )
42
+ (haskell-align-imports ) )))
40
43
41
44
(defun haskell-import-for-module (module )
42
45
" Get import statements for the given module."
You can’t perform that action at this time.
0 commit comments