File tree Expand file tree Collapse file tree 3 files changed +13
-9
lines changed Expand file tree Collapse file tree 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'."
404404 :group 'haskell
405405 :type '(repeat 'string ))
406406
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 )
407414
408415; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
409416; ; 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."
820820 (const " ghc -fno-code" )
821821 (string :tag " Other command" )))
822822
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-
829823;;;### autoload
830824(defcustom haskell-tags-on-save nil
831825 " Generate tags via hasktags after saving."
Original file line number Diff line number Diff line change 2323(require 'haskell-navigate-imports )
2424(require 'haskell-complete-module )
2525(require 'haskell-sandbox )
26+ (require 'haskell-customize )
2627
2728(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."
2932 (interactive )
3033 (save-excursion
3134 (goto-char (point-max ))
3538 (haskell-complete-module-read
3639 " Module: "
3740 (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 ) )))
4043
4144(defun haskell-import-for-module (module )
4245 " Get import statements for the given module."
You can’t perform that action at this time.
0 commit comments