branch: elpa/haskell-tng-mode commit fe9d65d7d2d25784132b08af534c5c0a0db3ca17 Author: Tseen She <ts33n....@gmail.com> Commit: Tseen She <ts33n....@gmail.com>
helper for yatemplates --- haskell-tng-contrib.el | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/haskell-tng-contrib.el b/haskell-tng-contrib.el index 1c9499f..25fa70c 100644 --- a/haskell-tng-contrib.el +++ b/haskell-tng-contrib.el @@ -5,8 +5,8 @@ ;;; Commentary: ;; -;; Untested / untestable commands that are either contributed by the community -;; or require an external process to exist on PATH. +;; Untested / untestable commands that may require an external process to exist +;; on PATH. ;; ;;; Code: @@ -52,5 +52,20 @@ (re-search-forward (rx point (group (+ (not space))) space)) (kill-new (match-string 1)))) +;;;###autoload +(defun haskell-tng-filename-to-modulename () + "Infers the ModuleName for the current file based on filesystem layout." + (mapconcat + 'identity + (reverse + (seq-take-while + (lambda (e) (let (case-fold-search) + (string-match-p (rx bos upper) e))) + (reverse + (split-string + (file-name-sans-extension buffer-file-name) + "\\/")))) + ".")) + (provide 'haskell-tng-contrib) ;;; haskell-tng-contrib.el ends here