Skip to content

Instantly share code, notes, and snippets.

@tmcgilchrist
Created September 16, 2015 05:06
Show Gist options
  • Save tmcgilchrist/f4ee1f2c4c3e28a07310 to your computer and use it in GitHub Desktop.
Save tmcgilchrist/f4ee1f2c4c3e28a07310 to your computer and use it in GitHub Desktop.
(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