haskell/haskell-mode — pull request #126 by alexanderkjeldaas (2013-02-24 07:04:01+00:00)
Title: Haskell header sorting improvements.

Example:
import Snap.Internal.Http.Types hiding (addHeader,
setContentType,
setHeader)
import qualified Snap.Internal.Http.Types as H
import Snap.Internal.Parsing
import Snap.Internal.Types (evalSnap)
import Snap.Iteratee hiding (map)
import Snap.Core hiding ( addHeader
, setContentType
, setHeader )
import qualified Snap.Types.Headers as H

Also, remove the need to have point on a line starting with ^import
for sorting to work. Instead we use a regexp that indicate what
is "out-of-bounds" and restrict the region to sort to that area.

Unfortunately, the regexp that cover multiple lines requires a regexp
engine that chooses the longest match for a string, something that
emacs does not do by default. Thus this patch includes a
generalization of the sort-regexp-fields from emacs' sort.el in
general-sort.el. We use this version with the 'posix-search-forward
regexp function which returns the longest match.