Skip to content

Commit f3c6724

Browse files
committed
Add customizeable blank module template
This resolves haskell#462
1 parent 2c0bc0f commit f3c6724

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

haskell-mode.el

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,27 +1152,19 @@ given a prefix arg."
11521152
collect (replace-regexp-in-string "\\.l?hs$" "" part))))
11531153
(mapconcat 'identity (reverse components) ".")))
11541154

1155+
(defvar haskell-auto-insert-module-format-string
1156+
"-- | \n\nmodule %s where\n\n"
1157+
"Template string that will be inserted in new haskell buffers via `haskell-auto-insert-module-template'.")
1158+
11551159
(defun haskell-auto-insert-module-template ()
11561160
"Insert a module template for the newly created buffer."
11571161
(interactive)
11581162
(when (and (= (point-min)
11591163
(point-max))
11601164
(buffer-file-name))
1161-
(insert
1162-
"-- | "
1163-
"\n"
1164-
"\n"
1165-
"module "
1166-
)
1167-
(let ((name (haskell-guess-module-name)))
1168-
(if (string= name "")
1169-
(insert "")
1170-
(insert name)))
1171-
(insert " where"
1172-
"\n"
1173-
"\n")
1165+
(insert (format haskell-auto-insert-module-format-string (haskell-guess-module-name)))
11741166
(goto-char (point-min))
1175-
(forward-char 4)))
1167+
(end-of-line)))
11761168

11771169
(defun haskell-describe (ident)
11781170
"Describe the given identifier."

0 commit comments

Comments
 (0)