summaryrefslogtreecommitdiffhomepage
path: root/lib/skels
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-17 04:44:03 +0100
committerjao <jao@gnu.org>2022-09-17 04:44:03 +0100
commit80de850c99561eadb198a9405353ca663dcfea82 (patch)
tree5b56fc91ddcde75b111da48484767726d2dafaea /lib/skels
parente01de415c020d900e347833a24ee45bb8fe222be (diff)
downloadelibs-80de850c99561eadb198a9405353ca663dcfea82.tar.gz
elibs-80de850c99561eadb198a9405353ca663dcfea82.tar.bz2
jao-skell: better guessing of haskell module name
Diffstat (limited to 'lib/skels')
-rw-r--r--lib/skels/jao-skel-haskell.el24
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/skels/jao-skel-haskell.el b/lib/skels/jao-skel-haskell.el
index 01a9936..0c3c17d 100644
--- a/lib/skels/jao-skel-haskell.el
+++ b/lib/skels/jao-skel-haskell.el
@@ -1,4 +1,5 @@
-;;; jao-skel-haskell.el --- skeleton for haskell source files -*- lexical-binding: t; -*-
+;; jao-skel-haskell.el --- skeleton for haskell -*- lexical-binding: t; -*-
+
;; Copyright (C) 2003, 2004, 2005, 2009, 2010, 2012, 2022 Jose A Ortega Ruiz
;; Author: Jose A Ortega Ruiz <jao@member.fsf.org>
@@ -19,31 +20,23 @@
;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
-;;; Commentary:
-
-;;
-
;;; Code:
(require 'jao-skel)
(require 'jao-compilation)
+(require 'haskell-mode nil t)
-;;; Auxiliar
-(defun jao-skel--read-haskell-module ()
- (let* ((ddir (jao-compilation-root))
- (mbase (and ddir (concat (replace-regexp-in-string "/" "." ddir)
- ".")))
- (m (read-string "Module prefix (empty for no module): "
- (concat (or mbase "") (jao-skel-basename)))))
- (or m "")))
+(defun jao-skel-haskell--guess-module ()
+ (if (fboundp 'haskell-guess-module-name)
+ (haskell-guess-module-name)
+ (read-string "Module: " (jao-skel-basename))))
(defconst jao-skel--haskell-line (make-string 78 ?-))
-;;; Skeletons
(define-skeleton jao-skel-haskell-file
"Haskell hs file header"
"Brief description: "
- '(setq v (jao-skel--read-haskell-module))
+ '(setq v (jao-skel-haskell--guess-module))
jao-skel--haskell-line \n
"-- |" \n
"-- Module: " v \n
@@ -63,7 +56,6 @@
"module " v " where " \n \n \n)
(jao-skel-install "\\.hs\\'" 'jao-skel-haskell-file)
-;; (jao-skel-install "\\.lhs\\'" 'jao-skel-lit-haskell-file)
(provide 'jao-skel-haskell)