Created
September 16, 2015 05:06
-
-
Save tmcgilchrist/f4ee1f2c4c3e28a07310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(eval-after-load "haskell-mode" | |
;; Replace the haskell-mode version with this version, | |
;; this will line up all imports as if they're all qualified | |
;; eg this | |
;; | |
;; import Data.Monoid | |
;; import Data.Text | |
;; | |
;; becomes | |
;; | |
;; import Data.Monoid | |
;; import Data.Text | |
;; | |
'(defun haskell-align-imports-fill (padding line) | |
"Fill an import line using the padding worked out from all statements." | |
(if (eq (car padding) 6) | |
(setcar padding (+ 6 10)) ) | |
(mapconcat #'identity | |
(cl-mapcar (lambda (pad part) | |
(if (> (length part) 0) | |
(concat part (make-string (- pad (length part)) ? )) | |
(make-string pad ? ))) | |
padding | |
line) | |
" "))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment