Function: haskell-ts-format
haskell-ts-format is an interactive and natively compiled function
defined in haskell-ts-mode.el.
Signature
(haskell-ts-format START END)
Documentation
Format haskell code.
If region is active, format the code using the comand specified in
haskell-ts-format-command. Otherwise, format the current function.
Key Bindings
haskell-ts-mode-map C-c C-f
Source Code
;; Defined in /nix/store/84k99g1lc4gz6zw2djcsyzr9zviz842h-emacs-packages-deps/share/emacs/site-lisp/elpa/haskell-ts-mode-1.3.5/haskell-ts-mode.el
(defun haskell-ts-format (start end)
"Format haskell code.
If region is active, format the code using the comand specified in
`haskell-ts-format-command'. Otherwise, format the current function."
(interactive
(if (region-active-p)
(list (region-beginning) (region-end))
(haskell-ts-current-function-bound)))
(let ((file (or buffer-file-name (error "Need to be visiting a file")))
(ra (region-active-p)))
(save-excursion
(goto-char start)
(while (looking-at "[ \t]*$")
(goto-char (line-beginning-position 2)))
(setq start (point)))
(shell-command-on-region start
end
(format haskell-ts-format-command file)
nil
t)
(message "Formatted succesefully.")
(unless ra
(pulse-momentary-highlight-region (region-beginning) (region-end)))))