From 17ee0e400bef47c371afcae76037f9ea6a44ad13 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 10 Sep 2018 14:51:14 -0400 Subject: Support Vim, Tmux, Emacs with Stow After moving off of Meta, Dotfiles has a greater responsibility to manage configs. Vim, Tmux, and Emacs are now within Stow's purview. --- .../haskell-mode-20180601.143/ghci-script-mode.el | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180601.143/ghci-script-mode.el (limited to 'configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180601.143/ghci-script-mode.el') diff --git a/configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180601.143/ghci-script-mode.el b/configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180601.143/ghci-script-mode.el new file mode 100644 index 000000000000..2ec905cd14ca --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/haskell-mode-20180601.143/ghci-script-mode.el @@ -0,0 +1,66 @@ +;;; ghci-script-mode.el --- GHCi scripts major mode -*- lexical-binding: t -*- + +;; Copyright (c) 2014 Chris Done. All rights reserved. + +;; This file is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. + +;; This file is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;;; Code: + +(require 'haskell) + +(defvar ghci-script-mode-keywords + ;; The comment syntax can't be described simply in syntax-table. + ;; We could use font-lock-syntactic-keywords, but is it worth it? + '(("^[ \t]*--.*" . font-lock-comment-face) + ("^ *\\([^ \t:]+\\):" (1 font-lock-keyword-face)) + ("^:[a-z{]+ *\\+" . font-lock-keyword-face) + ("^:[a-z{]+ " . font-lock-keyword-face))) + +;;;###autoload +(define-derived-mode ghci-script-mode text-mode "GHCi-Script" + "Major mode for working with .ghci files." + (setq-local adaptive-fill-mode nil) + (setq-local comment-start "-- ") + (setq-local comment-padding 0) + (setq-local comment-start-skip "[-{]-[ \t]*") + (setq-local comment-end "") + (setq-local comment-end-skip "[ \t]*\\(-}\\|\\s>\\)") + (setq-local font-lock-defaults '(ghci-script-mode-keywords t t nil nil)) + (setq-local indent-tabs-mode nil) + (setq-local tab-width 8) + (when (boundp 'electric-indent-inhibit) + (setq electric-indent-inhibit t)) + (setq-local dabbrev-case-fold-search nil) + (setq-local dabbrev-case-distinction nil) + (setq-local dabbrev-case-replace nil) + (setq-local dabbrev-abbrev-char-regexp "\\sw\\|[.]") + (setq haskell-literate nil)) + +;;;###autoload +(add-to-list 'auto-mode-alist '("\\.ghci\\'" . ghci-script-mode)) + +(define-key ghci-script-mode-map (kbd "C-c C-l") 'ghci-script-mode-load) + +(defun ghci-script-mode-load () + "Load the current script file into the GHCi session." + (interactive) + (let ((buffer (haskell-session-interactive-buffer (haskell-session))) + (filename (buffer-file-name))) + (save-buffer) + (with-current-buffer buffer + (set-marker haskell-interactive-mode-prompt-start (point-max)) + (haskell-interactive-mode-run-expr + (concat ":script " filename))))) + +(provide 'ghci-script-mode) -- cgit 1.4.1