Skip to content

Customizable module template #462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MichaelXavier opened this issue Feb 10, 2015 · 2 comments · Fixed by #466
Closed

Customizable module template #462

MichaelXavier opened this issue Feb 10, 2015 · 2 comments · Fixed by #466

Comments

@MichaelXavier
Copy link
Contributor

I wanted to see if you'd take a PR to change haskell-auto-insert-module-template to use a customizeable var. At my work we use a different indentation for module headings so while I use this feature, I always have to manually reformat. I was thinking the var could be in format style: "--|\nimport %s where\n". Here's the relevant code.

(defun haskell-auto-insert-module-template ()

If you would take a PR, should I keep the same function name, or make it haskell-apply-auto-insert-template, or if not, what would you like the var named?

@ivan-m
Copy link
Contributor

ivan-m commented Feb 11, 2015

As an alternate way of doing things, I instead use skeleton-mode rather than haskell-auto-insert-module-template (I actually didn't even know the latter existed):

(require 'skeleton)
(require 'autoinsert)

;; Skeletons
(define-skeleton haskell-module-skeleton
  "Haskell hs file header"
  "Brief description: "
  "{- \|\n"
  '(setq module-name (haskell-guess-module-name))
  "   Module      : " module-name "\n"
  "   Description : " str | (concat "The \"" module-name "\" module") "\n"
  "   Copyright   : (c) Ivan Lazar Miljenovic\n"
  "   License     : 3-Clause BSD-style\n"
  "   Maintainer  : [email protected]\n"
  "\n"
  "   " _ "\n"
  "\n"
  " -}\n"
  "module " module-name " where\n\n")

(add-to-list 'auto-insert-alist '("\\.hs\\'" . haskell-module-skeleton))

@chrisdone
Copy link
Member

Making it customizable by a format string seems fine. The PR should preserve the existing behaviour with a default customization which matches what it already does.

MichaelXavier added a commit to MichaelXavier/haskell-mode that referenced this issue Feb 13, 2015
MichaelXavier added a commit to MichaelXavier/haskell-mode that referenced this issue Feb 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants