Skip to content

Commit

Permalink
Experimental "futhark fmt" integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Oct 3, 2024
1 parent 1f78def commit 54246aa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions futhark-fmt.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
;;; futhark-fmt.el --- Format SML source code using the "futhark fmt" program -*- lexical-binding: t -*-

;; Copyright (C) DIKU 2013-2019, University of Copenhagen

;; This file is not part of GNU Emacs.

;;; License:
;; ICS <https://github.com/diku-dk/futhark-mode/blob/master/LICENSE>

;;; Commentary:
;; See futhark-mode.el.

;;; Code:

(require 'reformatter)

(defgroup futhark-fmt nil
"Integration with the \"futhark fmt\" formatting program."
:prefix "futhark-fmt-"
:group 'sml)

(defcustom futhark-fmt-extra-args '()
"Extra arguments to give to \"futhark fmt\"."
:group 'futhark-fmt
:type 'sexp
:safe #'listp)

(defvar futhark-fmt-mode-map (make-sparse-keymap)
"Local keymap used for `futhark-fmt-format-on-save-mode`.")

;;;###autoload (autoload 'futhark-fmt-format-buffer "futhark-fmt" nil t)
;;;###autoload (autoload 'futhark-fmt-format-region "futhark-fmt" nil t)
;;;###autoload (autoload 'futhark-fmt-format-on-save-mode "futhark-fmt" nil t)
(reformatter-define futhark-fmt
:program "futhark"
:args (cons "fmt" futhark-fmt-extra-args)
:group 'futhark-fmt
:lighter " Fmt"
:keymap futhark-fmt-mode-map)

(defalias 'futhark-fmt 'futhark-fmt-format-buffer)

(provide 'futhark-fmt)

;;; futhark-fmt.el ends here
2 changes: 1 addition & 1 deletion futhark-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; URL: https://github.com/diku-dk/futhark-mode
;; Keywords: languages
;; Version: 0.2
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5"))
;; Package-Requires: ((emacs "24.3") (cl-lib "0.5") (reformatter "0.4"))

;; This file is not part of GNU Emacs.

Expand Down

0 comments on commit 54246aa

Please sign in to comment.