More emacs fixups
git-svn-id: http://photonzero.com/dotfiles/trunk@87 23f722f6-122a-0410-8cef-c75bd312dd78
This commit is contained in:
parent
1732d28374
commit
d749c5905d
18 changed files with 8844 additions and 5 deletions
49
.emacs.d/haskell-mode/fontlock.hs
Normal file
49
.emacs.d/haskell-mode/fontlock.hs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
-- Comments are coloured brightly and stand out clearly.
|
||||||
|
|
||||||
|
import qualified Foo as F hiding (toto)
|
||||||
|
import qualified Foo hiding (toto)
|
||||||
|
import qualified Foo as F (toto)
|
||||||
|
import Foo as F hiding (toto)
|
||||||
|
import Foo hiding (toto)
|
||||||
|
import Foo as F (toto)
|
||||||
|
|
||||||
|
hiding = 1
|
||||||
|
qualified = 3
|
||||||
|
as = 2
|
||||||
|
|
||||||
|
repeat :: a -> [a]
|
||||||
|
repeat xs = xs where xs = x:xs -- Keywords are also bright.
|
||||||
|
|
||||||
|
head :: [a] -> a
|
||||||
|
head (x:_) = x
|
||||||
|
head [] = error "PreludeList.head: empty list" -- Strings are coloured softly.
|
||||||
|
|
||||||
|
data Maybe a = Nothing | Just a -- Type constructors, data
|
||||||
|
deriving (Eq, Ord, Read, Show) -- constructors, class names
|
||||||
|
-- and module names are coloured
|
||||||
|
-- closer to ordinary code.
|
||||||
|
|
||||||
|
recognize +++ infix :: Operator Declarations
|
||||||
|
as `well` as = This Form
|
||||||
|
(+) and this one = as well
|
||||||
|
|
||||||
|
instance Show Toto where
|
||||||
|
fun1 arg1 = foo -- FIXME: `fun1' should be highlighted.
|
||||||
|
|
||||||
|
constStr = "hello \
|
||||||
|
\asdgfasgf\
|
||||||
|
\asf"
|
||||||
|
|
||||||
|
{-
|
||||||
|
map :: (a -> b) -> [a] -> [b] -- Commenting out large sections of
|
||||||
|
map f [] = [] -- code can be misleading. Coloured
|
||||||
|
map f (x:xs) = f x : map f xs -- comments reveal unused definitions.
|
||||||
|
-}
|
||||||
|
|
||||||
|
-- Note: the least significant bit is the first element of the list
|
||||||
|
bdigits :: Int -> [Int]
|
||||||
|
bdigits 0 = [0]
|
||||||
|
bdigits 1 = [1]
|
||||||
|
bdigits n | n>1 = n `mod` 2 :
|
||||||
|
|
||||||
|
-- arch-tag: a0d08cc2-4a81-4139-93bc-b3c6be0b5fb2
|
||||||
47
.emacs.d/haskell-mode/haskell-c.el
Normal file
47
.emacs.d/haskell-mode/haskell-c.el
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
;;; haskell-c.el --- Major mode for *.hsc files
|
||||||
|
|
||||||
|
;; Copyright (C) 2007 Stefan Monnier
|
||||||
|
|
||||||
|
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
;; 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 GNU Emacs; see the file COPYING. If not, write to
|
||||||
|
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
;; Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(require 'haskell-mode)
|
||||||
|
(require 'haskell-font-lock)
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.hsc\\'" . haskell-c-mode))
|
||||||
|
|
||||||
|
(defvar haskell-c-font-lock-keywords
|
||||||
|
`(("^#[ \t]*[[:alnum:]]+" (0 font-lock-preprocessor-face))
|
||||||
|
,@haskell-font-lock-symbols))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-derived-mode haskell-c-mode haskell-mode "Haskell-C"
|
||||||
|
"Major mode for Haskell FFI files."
|
||||||
|
(set (make-local-variable 'font-lock-keywords)
|
||||||
|
(cons 'haskell-c-font-lock-keywords
|
||||||
|
(cdr font-lock-keywords))))
|
||||||
|
|
||||||
|
(provide 'haskell-c)
|
||||||
|
;; arch-tag: 51294c41-29f0-4599-9ce8-47fe2e7d3fd5
|
||||||
|
;;; haskell-c.el ends here
|
||||||
183
.emacs.d/haskell-mode/haskell-cabal.el
Normal file
183
.emacs.d/haskell-mode/haskell-cabal.el
Normal file
|
|
@ -0,0 +1,183 @@
|
||||||
|
;;; haskell-cabal.el --- Support for Cabal packages
|
||||||
|
|
||||||
|
;; Copyright (C) 2007, 2008 Stefan Monnier
|
||||||
|
|
||||||
|
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
;; 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 GNU Emacs; see the file COPYING. If not, write to
|
||||||
|
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
;; Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Todo:
|
||||||
|
|
||||||
|
;; - distinguish continued lines from indented lines.
|
||||||
|
;; - indent-line-function.
|
||||||
|
;; - outline-minor-mode.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;; (defun haskell-cabal-extract-fields-from-doc ()
|
||||||
|
;; (require 'xml)
|
||||||
|
;; (require 'cl)
|
||||||
|
;; (let ((section (completing-read
|
||||||
|
;; "Section: "
|
||||||
|
;; '("general-fields" "library" "executable" "buildinfo"))))
|
||||||
|
;; (goto-char (point-min))
|
||||||
|
;; (search-forward (concat "<sect3 id=\"" section "\">")))
|
||||||
|
;; (let* ((xml (xml-parse-region
|
||||||
|
;; (progn (search-forward "<variablelist>") (match-beginning 0))
|
||||||
|
;; (progn (search-forward "</variablelist>") (point))))
|
||||||
|
;; (varlist (remove-if-not 'consp (cddar xml)))
|
||||||
|
;; (syms (mapcar (lambda (entry) (caddr (assq 'literal (assq 'term entry))))
|
||||||
|
;; varlist))
|
||||||
|
;; (fields (mapcar (lambda (sym) (substring-no-properties sym 0 -1)) syms)))
|
||||||
|
;; fields))
|
||||||
|
|
||||||
|
(eval-when-compile (require 'cl))
|
||||||
|
|
||||||
|
(defconst haskell-cabal-general-fields
|
||||||
|
;; Extracted with (haskell-cabal-extract-fields-from-doc "general-fields")
|
||||||
|
'("name" "version" "cabal-version" "license" "license-file" "copyright"
|
||||||
|
"author" "maintainer" "stability" "homepage" "package-url" "synopsis"
|
||||||
|
"description" "category" "tested-with" "build-depends" "data-files"
|
||||||
|
"extra-source-files" "extra-tmp-files"))
|
||||||
|
|
||||||
|
(defconst haskell-cabal-library-fields
|
||||||
|
;; Extracted with (haskell-cabal-extract-fields-from-doc "library")
|
||||||
|
'("exposed-modules"))
|
||||||
|
|
||||||
|
(defconst haskell-cabal-executable-fields
|
||||||
|
;; Extracted with (haskell-cabal-extract-fields-from-doc "executable")
|
||||||
|
'("executable" "main-is"))
|
||||||
|
|
||||||
|
(defconst haskell-cabal-buildinfo-fields
|
||||||
|
;; Extracted with (haskell-cabal-extract-fields-from-doc "buildinfo")
|
||||||
|
'("buildable" "other-modules" "hs-source-dirs" "extensions" "ghc-options"
|
||||||
|
"ghc-prof-options" "hugs-options" "nhc-options" "includes"
|
||||||
|
"install-includes" "include-dirs" "c-sources" "extra-libraries"
|
||||||
|
"extra-lib-dirs" "cc-options" "ld-options" "frameworks"))
|
||||||
|
|
||||||
|
(defvar haskell-cabal-mode-syntax-table
|
||||||
|
(let ((st (make-syntax-table)))
|
||||||
|
;; The comment syntax can't be described simply in syntax-table.
|
||||||
|
;; We could use font-lock-syntactic-keywords, but is it worth it?
|
||||||
|
;; (modify-syntax-entry ?- ". 12" st)
|
||||||
|
(modify-syntax-entry ?\n ">" st)
|
||||||
|
st))
|
||||||
|
|
||||||
|
(defvar haskell-cabal-font-lock-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))
|
||||||
|
("^\\(Library\\)[ \t]*\\({\\|$\\)" (1 font-lock-keyword-face))
|
||||||
|
("^\\(Executable\\)[ \t]+\\([^\n \t]*\\)"
|
||||||
|
(1 font-lock-keyword-face) (2 font-lock-function-name-face))
|
||||||
|
("^\\(Flag\\)[ \t]+\\([^\n \t]*\\)"
|
||||||
|
(1 font-lock-keyword-face) (2 font-lock-constant-face))
|
||||||
|
("^ *\\(if\\)[ \t]+.*\\({\\|$\\)" (1 font-lock-keyword-face))
|
||||||
|
("^ *\\(}[ \t]*\\)?\\(else\\)[ \t]*\\({\\|$\\)"
|
||||||
|
(2 font-lock-keyword-face))))
|
||||||
|
|
||||||
|
(defvar haskell-cabal-buffers nil
|
||||||
|
"List of Cabal buffers.")
|
||||||
|
|
||||||
|
;; (defsubst* inferior-haskell-string-prefix-p (str1 str2)
|
||||||
|
;; "Return non-nil if STR1 is a prefix of STR2"
|
||||||
|
;; (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
|
||||||
|
|
||||||
|
(defun haskell-cabal-find-file ()
|
||||||
|
"Return a buffer visiting the cabal file of the current directory, or nil."
|
||||||
|
(catch 'found
|
||||||
|
;; ;; First look for it in haskell-cabal-buffers.
|
||||||
|
;; (dolist (buf haskell-cabal-buffers)
|
||||||
|
;; (if (inferior-haskell-string-prefix-p
|
||||||
|
;; (with-current-buffer buf default-directory) default-directory)
|
||||||
|
;; (throw 'found buf)))
|
||||||
|
;; Then look up the directory hierarchy.
|
||||||
|
(let ((user (nth 2 (file-attributes default-directory)))
|
||||||
|
;; Abbreviate, so as to stop when we cross ~/.
|
||||||
|
(root (abbreviate-file-name default-directory))
|
||||||
|
files)
|
||||||
|
(while (and root (equal user (nth 2 (file-attributes root))))
|
||||||
|
(if (setq files (directory-files root 'full "\\.cabal\\'"))
|
||||||
|
;; Avoid the .cabal directory.
|
||||||
|
(dolist (file files (throw 'found nil))
|
||||||
|
(unless (file-directory-p file)
|
||||||
|
(throw 'found (find-file-noselect file))))
|
||||||
|
(if (equal root
|
||||||
|
(setq root (file-name-directory
|
||||||
|
(directory-file-name root))))
|
||||||
|
(setq root nil))))
|
||||||
|
nil)))
|
||||||
|
|
||||||
|
(autoload 'derived-mode-p "derived") ; Emacs 21
|
||||||
|
|
||||||
|
(defun haskell-cabal-buffers-clean (&optional buffer)
|
||||||
|
(let ((bufs ()))
|
||||||
|
(dolist (buf haskell-cabal-buffers)
|
||||||
|
(if (and (buffer-live-p buf) (not (eq buf buffer))
|
||||||
|
(with-current-buffer buf (derived-mode-p 'haskell-cabal-mode)))
|
||||||
|
(push buf bufs)))
|
||||||
|
(setq haskell-cabal-buffers bufs)))
|
||||||
|
|
||||||
|
(defun haskell-cabal-unregister-buffer ()
|
||||||
|
(haskell-cabal-buffers-clean (current-buffer)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.cabal\\'" . haskell-cabal-mode))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-derived-mode haskell-cabal-mode fundamental-mode "Haskell-Cabal"
|
||||||
|
"Major mode for Cabal package description files."
|
||||||
|
(set (make-local-variable 'font-lock-defaults)
|
||||||
|
'(haskell-cabal-font-lock-keywords t t nil nil))
|
||||||
|
(add-to-list 'haskell-cabal-buffers (current-buffer))
|
||||||
|
(add-hook 'change-major-mode-hook 'haskell-cabal-unregister-buffer nil 'local)
|
||||||
|
(add-hook 'kill-buffer-hook 'haskell-cabal-unregister-buffer nil 'local)
|
||||||
|
(set (make-local-variable 'comment-start) "-- ")
|
||||||
|
(set (make-local-variable 'comment-start-skip) "\\(^[ \t]*\\)--[ \t]*")
|
||||||
|
(set (make-local-variable 'comment-end) "")
|
||||||
|
(set (make-local-variable 'comment-end-skip) "[ ]*\\(\\s>\\|\n\\)")
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun haskell-cabal-get-setting (name)
|
||||||
|
(save-excursion
|
||||||
|
(let ((case-fold-search t))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(when (re-search-forward
|
||||||
|
(concat "^" (regexp-quote name)
|
||||||
|
":[ \t]*\\(.*\\(\n[ \t]+[ \t\n].*\\)*\\)")
|
||||||
|
nil t)
|
||||||
|
(let ((val (match-string 1))
|
||||||
|
(start 1))
|
||||||
|
(when (match-end 2) ;Multiple lines.
|
||||||
|
;; The documentation is not very precise about what to do about
|
||||||
|
;; the \n and the indentation: are they part of the value or
|
||||||
|
;; the encoding? I take the point of view that \n is part of
|
||||||
|
;; the value (so that values can span multiple lines as well),
|
||||||
|
;; and that only the first char in the indentation is part of
|
||||||
|
;; the encoding, the rest is part of the value (otherwise, lines
|
||||||
|
;; in the value cannot start with spaces or tabs).
|
||||||
|
(while (string-match "^[ \t]\\(?:\\.$\\)?" val start)
|
||||||
|
(setq start (1+ (match-beginning 0)))
|
||||||
|
(setq val (replace-match "" t t val))))
|
||||||
|
val)))))
|
||||||
|
|
||||||
|
(provide 'haskell-cabal)
|
||||||
|
|
||||||
|
;; arch-tag: d455f920-5e4d-42b6-a2c7-4a7e84a05c29
|
||||||
|
;;; haskell-cabal.el ends here
|
||||||
719
.emacs.d/haskell-mode/haskell-decl-scan.el
Normal file
719
.emacs.d/haskell-mode/haskell-decl-scan.el
Normal file
File diff suppressed because it is too large
Load diff
1972
.emacs.d/haskell-mode/haskell-doc.el
Normal file
1972
.emacs.d/haskell-mode/haskell-doc.el
Normal file
File diff suppressed because it is too large
Load diff
633
.emacs.d/haskell-mode/haskell-font-lock.el
Normal file
633
.emacs.d/haskell-mode/haskell-font-lock.el
Normal file
File diff suppressed because it is too large
Load diff
334
.emacs.d/haskell-mode/haskell-ghci.el
Normal file
334
.emacs.d/haskell-mode/haskell-ghci.el
Normal file
|
|
@ -0,0 +1,334 @@
|
||||||
|
;;; haskell-ghci.el --- A GHCi interaction mode
|
||||||
|
|
||||||
|
;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
|
;; Copyright (C) 2001 Chris Webb
|
||||||
|
;; Copyright (C) 1998, 1999 Guy Lapalme
|
||||||
|
|
||||||
|
;; Keywords: inferior mode, GHCi interaction mode, Haskell
|
||||||
|
|
||||||
|
;;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;; 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 GNU Emacs; see the file COPYING. If not, write to the
|
||||||
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
;; Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Purpose:
|
||||||
|
;;
|
||||||
|
;; To send a Haskell buffer to another buffer running a GHCi
|
||||||
|
;; interpreter.
|
||||||
|
;;
|
||||||
|
;; This mode is derived from version 1.1 of Guy Lapalme's
|
||||||
|
;; haskell-hugs.el, which can be obtained from:
|
||||||
|
;;
|
||||||
|
;; http://www.iro.umontreal.ca/~lapalme/Hugs-interaction.html
|
||||||
|
;;
|
||||||
|
;; This in turn was adapted from Chris Van Humbeeck's hugs-mode.el,
|
||||||
|
;; which can be obtained from:
|
||||||
|
;;
|
||||||
|
;; http://www-i2.informatik.rwth-aachen.de/Forschung/FP/Haskell/hugs-mode.el
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; Installation:
|
||||||
|
;;
|
||||||
|
;; To use with Moss and Thorn's haskell-mode.el
|
||||||
|
;;
|
||||||
|
;; http://www.haskell.org/haskell-mode
|
||||||
|
;;
|
||||||
|
;; add this to .emacs:
|
||||||
|
;;
|
||||||
|
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-ghci)
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; Customisation:
|
||||||
|
;;
|
||||||
|
;; The name of the GHCi interpreter is in haskell-ghci-program-name.
|
||||||
|
;;
|
||||||
|
;; Arguments can be sent to the GHCi interpreter when it is started by
|
||||||
|
;; setting haskell-ghci-program-args (empty by default) to a list of
|
||||||
|
;; string args to pass it. This value can be set interactively by
|
||||||
|
;; calling C-c C-s with an argument (i.e. C-u C-c C-s).
|
||||||
|
;;
|
||||||
|
;; `haskell-ghci-hook' is invoked in the *ghci* buffer once GHCi is
|
||||||
|
;; started.
|
||||||
|
;;
|
||||||
|
;; All functions/variables start with `turn-{on,off}-haskell-ghci' or
|
||||||
|
;; `haskell-ghci-'.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(defgroup haskell-ghci nil
|
||||||
|
"Major mode for interacting with an inferior GHCi session."
|
||||||
|
:group 'haskell
|
||||||
|
:prefix "haskell-ghci-")
|
||||||
|
|
||||||
|
(defun turn-on-haskell-ghci ()
|
||||||
|
"Turn on Haskell interaction mode with a GHCi interpreter running in an
|
||||||
|
another Emacs buffer named *ghci*.
|
||||||
|
Maps the following commands in the haskell keymap:
|
||||||
|
\\<haskell-mode-map>\\[haskell-ghci-start-process] to create the GHCi buffer and start a GHCi process in it.
|
||||||
|
\\[haskell-ghci-load-file] to save the current buffer and load it by sending the :load command to GHCi.
|
||||||
|
\\[haskell-ghci-reload-file] to send the :reload command to GHCi without saving the buffer.
|
||||||
|
\\[haskell-ghci-show-ghci-buffer] to show the GHCi buffer and go to it."
|
||||||
|
(local-set-key "\C-c\C-s" 'haskell-ghci-start-process)
|
||||||
|
(local-set-key "\C-c\C-l" 'haskell-ghci-load-file)
|
||||||
|
(local-set-key "\C-c\C-r" 'haskell-ghci-reload-file)
|
||||||
|
(local-set-key "\C-c\C-n" 'haskell-ghci-locate-next-error)
|
||||||
|
(local-set-key "\C-c\C-b" 'haskell-ghci-show-ghci-buffer))
|
||||||
|
|
||||||
|
(defun turn-off-haskell-ghci ()
|
||||||
|
"Turn off Haskell interaction mode with a GHCi interpreter within a buffer."
|
||||||
|
(local-unset-key "\C-c\C-s")
|
||||||
|
(local-unset-key "\C-c\C-l")
|
||||||
|
(local-unset-key "\C-c\C-r")
|
||||||
|
(local-unset-key "\C-c\C-b"))
|
||||||
|
|
||||||
|
(define-derived-mode haskell-ghci-mode comint-mode "Haskell GHCi"
|
||||||
|
"Major mode for interacting with an inferior GHCi session.
|
||||||
|
|
||||||
|
The commands available from within a Haskell script are:
|
||||||
|
\\<haskell-mode-map>\\[haskell-ghci-start-process] to create the GHCi buffer and start a GHCi process in it.
|
||||||
|
\\[haskell-ghci-load-file] to save the current buffer and load it by sending the :load command to GHCi.
|
||||||
|
\\[haskell-ghci-reload-file] to send the :reload command to GHCi without saving the buffer.
|
||||||
|
\\[haskell-ghci-show-ghci-buffer] to show the GHCi buffer and go to it.
|
||||||
|
|
||||||
|
\\<haskell-ghci-mode-map>Commands:
|
||||||
|
\\[comint-send-input] after end of GHCi output sends line as input to GHCi.
|
||||||
|
\\[comint-send-input] before end of GHCI output copies rest of line and sends it to GHCI as input.
|
||||||
|
\\[comint-kill-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing.
|
||||||
|
\\[comint-interrupt-subjob] interrupts the comint or its current subjob if any.
|
||||||
|
\\[comint-stop-subjob] stops, likewise. \\[comint-quit-subjob] sends quit signal.")
|
||||||
|
|
||||||
|
|
||||||
|
;; GHCi interface:
|
||||||
|
|
||||||
|
(require 'comint)
|
||||||
|
(require 'shell)
|
||||||
|
|
||||||
|
(defvar haskell-ghci-process nil
|
||||||
|
"The active GHCi subprocess corresponding to current buffer.")
|
||||||
|
|
||||||
|
(defvar haskell-ghci-process-buffer nil
|
||||||
|
"*Buffer used for communication with GHCi subprocess for current buffer.")
|
||||||
|
|
||||||
|
(defcustom haskell-ghci-program-name "ghci"
|
||||||
|
"*The name of the GHCi interpreter program."
|
||||||
|
:type 'string
|
||||||
|
:group 'haskell-ghci)
|
||||||
|
|
||||||
|
(defcustom haskell-ghci-program-args nil
|
||||||
|
"*A list of string args to pass when starting the GHCi interpreter."
|
||||||
|
:type '(repeat string)
|
||||||
|
:group 'haskell-ghci)
|
||||||
|
|
||||||
|
(defvar haskell-ghci-load-end nil
|
||||||
|
"Position of the end of the last load command.")
|
||||||
|
|
||||||
|
(defvar haskell-ghci-error-pos nil
|
||||||
|
"Position of the end of the last load command.")
|
||||||
|
|
||||||
|
(defvar haskell-ghci-send-end nil
|
||||||
|
"Position of the end of the last send command.")
|
||||||
|
|
||||||
|
(defun haskell-ghci-start-process (arg)
|
||||||
|
"Start a GHCi process and invoke `haskell-ghci-hook' if not nil.
|
||||||
|
Prompt for a list of args if called with an argument."
|
||||||
|
(interactive "P")
|
||||||
|
(if arg
|
||||||
|
;; XXX [CDW] Fix to use more natural 'string' version of the
|
||||||
|
;; XXX arguments rather than a sexp.
|
||||||
|
(setq haskell-ghci-program-args
|
||||||
|
(read-minibuffer (format "List of args for %s:"
|
||||||
|
haskell-ghci-program-name)
|
||||||
|
(prin1-to-string haskell-ghci-program-args))))
|
||||||
|
|
||||||
|
;; Start the GHCi process in a new comint buffer.
|
||||||
|
(message "Starting GHCi process `%s'." haskell-ghci-program-name)
|
||||||
|
(setq haskell-ghci-process-buffer
|
||||||
|
(apply 'make-comint
|
||||||
|
"ghci" haskell-ghci-program-name nil
|
||||||
|
haskell-ghci-program-args))
|
||||||
|
(setq haskell-ghci-process
|
||||||
|
(get-buffer-process haskell-ghci-process-buffer))
|
||||||
|
|
||||||
|
;; Select GHCi buffer temporarily.
|
||||||
|
(set-buffer haskell-ghci-process-buffer)
|
||||||
|
(haskell-ghci-mode)
|
||||||
|
(make-local-variable 'shell-cd-regexp)
|
||||||
|
(make-local-variable 'shell-dirtrackp)
|
||||||
|
|
||||||
|
;; Track directory changes using the `:cd' command.
|
||||||
|
(setq shell-cd-regexp ":cd")
|
||||||
|
(setq shell-dirtrackp t)
|
||||||
|
(add-hook 'comint-input-filter-functions 'shell-directory-tracker nil 'local)
|
||||||
|
|
||||||
|
;; GHCi prompt should be of the form `ModuleName> '.
|
||||||
|
(setq comint-prompt-regexp
|
||||||
|
"^\\*?[[:upper:]][\\._[:alnum:]]*\\( \\*?[[:upper:]][\\._[:alnum:]]*\\)*> ")
|
||||||
|
|
||||||
|
;; History syntax of comint conflicts with Haskell, e.g. !!, so better
|
||||||
|
;; turn it off.
|
||||||
|
(setq comint-input-autoexpand nil)
|
||||||
|
(setq comint-process-echoes nil)
|
||||||
|
(run-hooks 'haskell-ghci-hook)
|
||||||
|
|
||||||
|
;; Clear message area.
|
||||||
|
(message ""))
|
||||||
|
|
||||||
|
(defun haskell-ghci-wait-for-output ()
|
||||||
|
"Wait until output arrives and go to the last input."
|
||||||
|
(while (progn
|
||||||
|
(goto-char comint-last-input-end)
|
||||||
|
(not (re-search-forward comint-prompt-regexp nil t)))
|
||||||
|
(accept-process-output haskell-ghci-process)))
|
||||||
|
|
||||||
|
(defun haskell-ghci-send (&rest string)
|
||||||
|
"Send `haskell-ghci-process' the arguments (one or more strings).
|
||||||
|
A newline is sent after the strings and they are inserted into the
|
||||||
|
current buffer after the last output."
|
||||||
|
(haskell-ghci-wait-for-output) ; wait for prompt
|
||||||
|
(goto-char (point-max)) ; position for this input
|
||||||
|
(apply 'insert string)
|
||||||
|
(comint-send-input)
|
||||||
|
(setq haskell-ghci-send-end (marker-position comint-last-input-end)))
|
||||||
|
|
||||||
|
(defun haskell-ghci-go (load-command cd)
|
||||||
|
"Save the current buffer and load its file into the GHCi process.
|
||||||
|
The first argument LOAD-COMMAND specifies how the file should be
|
||||||
|
loaded: as a new file (\":load \") or as a reload (\":reload \").
|
||||||
|
|
||||||
|
If the second argument CD is non-nil, change directory in the GHCi
|
||||||
|
process to the current buffer's directory before loading the file.
|
||||||
|
|
||||||
|
If the variable `haskell-ghci-command' is set then its value will be
|
||||||
|
sent to the GHCi process after the load command. This can be used for a
|
||||||
|
top-level expression to evaluate."
|
||||||
|
(hack-local-variables) ; in case they've changed
|
||||||
|
(save-buffer)
|
||||||
|
(let ((file (if (string-equal load-command ":load ")
|
||||||
|
(concat "\"" buffer-file-name "\"")
|
||||||
|
""))
|
||||||
|
(dir (expand-file-name default-directory))
|
||||||
|
(cmd (and (boundp 'haskell-ghci-command)
|
||||||
|
haskell-ghci-command
|
||||||
|
(if (stringp haskell-ghci-command)
|
||||||
|
haskell-ghci-command
|
||||||
|
(symbol-name haskell-ghci-command)))))
|
||||||
|
(if (and haskell-ghci-process-buffer
|
||||||
|
(eq (process-status haskell-ghci-process) 'run))
|
||||||
|
;; Ensure the GHCi buffer is selected.
|
||||||
|
(set-buffer haskell-ghci-process-buffer)
|
||||||
|
;; Start Haskell-GHCi process.
|
||||||
|
(haskell-ghci-start-process nil))
|
||||||
|
|
||||||
|
(if cd (haskell-ghci-send (concat ":cd " dir)))
|
||||||
|
;; Wait until output arrives and go to the last input.
|
||||||
|
(haskell-ghci-wait-for-output)
|
||||||
|
(haskell-ghci-send load-command file)
|
||||||
|
;; Error message search starts from last load command.
|
||||||
|
(setq haskell-ghci-load-end (marker-position comint-last-input-end))
|
||||||
|
(setq haskell-ghci-error-pos haskell-ghci-load-end)
|
||||||
|
(if cmd (haskell-ghci-send cmd))
|
||||||
|
;; Wait until output arrives and go to the last input.
|
||||||
|
(haskell-ghci-wait-for-output)))
|
||||||
|
|
||||||
|
(defun haskell-ghci-load-file (cd)
|
||||||
|
"Save a ghci buffer file and load its file.
|
||||||
|
If CD (prefix argument if interactive) is non-nil, change directory in
|
||||||
|
the GHCi process to the current buffer's directory before loading the
|
||||||
|
file. If there is an error, set the cursor at the error line otherwise
|
||||||
|
show the *ghci* buffer."
|
||||||
|
(interactive "P")
|
||||||
|
(haskell-ghci-gen-load-file ":load " cd))
|
||||||
|
|
||||||
|
(defun haskell-ghci-reload-file (cd)
|
||||||
|
"Save a ghci buffer file and load its file.
|
||||||
|
If CD (prefix argument if interactive) is non-nil, change the GHCi
|
||||||
|
process to the current buffer's directory before loading the file.
|
||||||
|
If there is an error, set the cursor at the error line otherwise show
|
||||||
|
the *ghci* buffer."
|
||||||
|
(interactive "P")
|
||||||
|
(haskell-ghci-gen-load-file ":reload " cd))
|
||||||
|
|
||||||
|
(defun haskell-ghci-gen-load-file (cmd cd)
|
||||||
|
"Save a ghci buffer file and load its file or reload depending on CMD.
|
||||||
|
If CD is non-nil, change the process to the current buffer's directory
|
||||||
|
before loading the file. If there is an error, set the cursor at the
|
||||||
|
error line otherwise show the *ghci* buffer."
|
||||||
|
|
||||||
|
;; Execute (re)load command.
|
||||||
|
(save-excursion (haskell-ghci-go cmd cd))
|
||||||
|
|
||||||
|
;; Show *ghci* buffer.
|
||||||
|
(pop-to-buffer haskell-ghci-process-buffer)
|
||||||
|
(goto-char haskell-ghci-load-end)
|
||||||
|
|
||||||
|
;; Did we finish loading without error?
|
||||||
|
(if (re-search-forward
|
||||||
|
"^Ok, modules loaded" nil t)
|
||||||
|
(progn (goto-char (point-max))
|
||||||
|
(recenter 2)
|
||||||
|
(message "There were no errors."))
|
||||||
|
|
||||||
|
;; Something went wrong. If possible, be helpful and pinpoint the
|
||||||
|
;; first error in the file whilst leaving the error visible in the
|
||||||
|
;; *ghci* buffer.
|
||||||
|
(goto-char haskell-ghci-load-end)
|
||||||
|
(haskell-ghci-locate-next-error)))
|
||||||
|
|
||||||
|
|
||||||
|
(defun haskell-ghci-locate-next-error ()
|
||||||
|
"Go to the next error shown in the *ghci* buffer."
|
||||||
|
(interactive)
|
||||||
|
(if (buffer-live-p haskell-ghci-process-buffer)
|
||||||
|
(progn (pop-to-buffer haskell-ghci-process-buffer)
|
||||||
|
(goto-char haskell-ghci-error-pos)
|
||||||
|
(if (re-search-forward
|
||||||
|
"^[^\/]*\\([^:\n]+\\):\\([0-9]+\\)" nil t)
|
||||||
|
(let ((efile (buffer-substring (match-beginning 1)
|
||||||
|
(match-end 1)))
|
||||||
|
(eline (string-to-int
|
||||||
|
(buffer-substring (match-beginning 2)
|
||||||
|
(match-end 2)))))
|
||||||
|
|
||||||
|
(recenter 2)
|
||||||
|
(setq haskell-ghci-error-pos (point))
|
||||||
|
(message "GHCi error on line %d of %s."
|
||||||
|
eline (file-name-nondirectory efile))
|
||||||
|
(if (file-exists-p efile)
|
||||||
|
(progn (find-file-other-window efile)
|
||||||
|
(goto-line eline)
|
||||||
|
(recenter))))
|
||||||
|
|
||||||
|
;; We got an error without a file and line number, so put the
|
||||||
|
;; point at end of the *ghci* buffer ready to deal with it.
|
||||||
|
(goto-char (point-max))
|
||||||
|
(recenter -2)
|
||||||
|
(message "No more errors found.")))
|
||||||
|
(message "No *ghci* buffer found.")))
|
||||||
|
|
||||||
|
(defun haskell-ghci-show-ghci-buffer ()
|
||||||
|
"Go to the *ghci* buffer."
|
||||||
|
(interactive)
|
||||||
|
(if (or (not haskell-ghci-process-buffer)
|
||||||
|
(not (buffer-live-p haskell-ghci-process-buffer)))
|
||||||
|
(haskell-ghci-start-process nil))
|
||||||
|
(pop-to-buffer haskell-ghci-process-buffer))
|
||||||
|
|
||||||
|
(provide 'haskell-ghci)
|
||||||
|
|
||||||
|
;; arch-tag: f0bade4b-288d-4329-9791-98c1e24167ac
|
||||||
|
;;; haskell-ghci.el ends here
|
||||||
316
.emacs.d/haskell-mode/haskell-hugs.el
Normal file
316
.emacs.d/haskell-mode/haskell-hugs.el
Normal file
|
|
@ -0,0 +1,316 @@
|
||||||
|
;;; haskell-hugs.el --- simplistic interaction mode with a
|
||||||
|
|
||||||
|
;; Copyright 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||||
|
;; Copyright 1998, 1999 Guy Lapalme
|
||||||
|
|
||||||
|
;; Hugs interpreter for Haskell developped by
|
||||||
|
;; The University of Nottingham and Yale University, 1994-1997.
|
||||||
|
;; Web: http://www.haskell.org/hugs.
|
||||||
|
;; In standard Emacs terminology, this would be called
|
||||||
|
;; inferior-hugs-mode
|
||||||
|
|
||||||
|
;; Keywords: Hugs inferior mode, Hugs interaction mode
|
||||||
|
;; URL: http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/CONTRIB/haskell-modes/emacs/haskell-hugs.el?rev=HEAD
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;; 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 GNU Emacs; see the file COPYING. If not, write to the
|
||||||
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
;; Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Purpose:
|
||||||
|
;;
|
||||||
|
;; To send a Haskell buffer to another buffer running a Hugs interpreter
|
||||||
|
;; The functions are adapted from the Hugs Mode developed by
|
||||||
|
;; Chris Van Humbeeck <chris.vanhumbeeck@cs.kuleuven.ac.be>
|
||||||
|
;; which used to be available at:
|
||||||
|
;; http://www-i2.informatik.rwth-aachen.de/Forschung/FP/Haskell/hugs-mode.el
|
||||||
|
;;
|
||||||
|
;; Installation:
|
||||||
|
;;
|
||||||
|
;; To use with the Haskell mode of
|
||||||
|
;; Moss&Thorn <http://www.haskell.org/haskell-mode>
|
||||||
|
;; add this to .emacs:
|
||||||
|
;;
|
||||||
|
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-hugs)
|
||||||
|
;;
|
||||||
|
;; Customisation:
|
||||||
|
;; The name of the hugs interpreter is in variable
|
||||||
|
;; haskell-hugs-program-name
|
||||||
|
;; Arguments can be sent to the Hugs interpreter when it is called
|
||||||
|
;; by setting the value of the variable
|
||||||
|
;; haskell-hugs-program-args
|
||||||
|
;; which by default contains '("+.") so that the progress of the
|
||||||
|
;; interpreter is visible without any "^H" in the *hugs* Emacs buffer.
|
||||||
|
;;
|
||||||
|
;; This value can be interactively by calling C-cC-s with an
|
||||||
|
;; argument.
|
||||||
|
;;
|
||||||
|
;; If the command does not seem to respond, see the
|
||||||
|
;; content of the `comint-prompt-regexp' variable
|
||||||
|
;; to check that it waits for the appropriate Hugs prompt
|
||||||
|
;; the current value is appropriate for Hugs 1.3 and 1.4
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; `haskell-hugs-hook' is invoked in the *hugs* once it is started.
|
||||||
|
;;
|
||||||
|
;;; All functions/variables start with
|
||||||
|
;;; `(turn-(on/off)-)haskell-hugs' or `haskell-hugs-'.
|
||||||
|
|
||||||
|
(defgroup haskell-hugs nil
|
||||||
|
"Major mode for interacting with an inferior Hugs session."
|
||||||
|
:group 'haskell
|
||||||
|
:prefix "haskell-hugs-")
|
||||||
|
|
||||||
|
(defun turn-on-haskell-hugs ()
|
||||||
|
"Turn on Haskell interaction mode with a Hugs interpreter running in an
|
||||||
|
another Emacs buffer named *hugs*.
|
||||||
|
Maps the followind commands in the haskell keymap.
|
||||||
|
\\[haskell-hugs-load-file]
|
||||||
|
to save the current buffer and load it by sending the :load command
|
||||||
|
to Hugs.
|
||||||
|
\\[haskell-hugs-reload-file]
|
||||||
|
to send the :reload command to Hugs without saving the buffer.
|
||||||
|
\\[haskell-hugs-show-hugs-buffer]
|
||||||
|
to show the Hugs buffer and go to it."
|
||||||
|
(local-set-key "\C-c\C-s" 'haskell-hugs-start-process)
|
||||||
|
(local-set-key "\C-c\C-l" 'haskell-hugs-load-file)
|
||||||
|
(local-set-key "\C-c\C-r" 'haskell-hugs-reload-file)
|
||||||
|
(local-set-key "\C-c\C-b" 'haskell-hugs-show-hugs-buffer))
|
||||||
|
|
||||||
|
(defun turn-off-haskell-hugs ()
|
||||||
|
"Turn off Haskell interaction mode with a Hugs interpreter within a buffer."
|
||||||
|
(local-unset-key "\C-c\C-s")
|
||||||
|
(local-unset-key "\C-c\C-l")
|
||||||
|
(local-unset-key "\C-c\C-r")
|
||||||
|
(local-unset-key "\C-c\C-b"))
|
||||||
|
|
||||||
|
(define-derived-mode haskell-hugs-mode comint-mode "Haskell Hugs"
|
||||||
|
;; called by haskell-hugs-start-process,
|
||||||
|
;; itself called by haskell-hugs-load-file
|
||||||
|
;; only when the file is loaded the first time
|
||||||
|
"Major mode for interacting with an inferior Hugs session.
|
||||||
|
|
||||||
|
The commands available from within a Haskell script are:
|
||||||
|
\\<haskell-mode-map>\\[haskell-hugs-load-file]
|
||||||
|
to save the current buffer and load it by sending the :load command
|
||||||
|
to Hugs.
|
||||||
|
\\[haskell-hugs-reload-file]
|
||||||
|
to send the :reload command to Hugs without saving the buffer.
|
||||||
|
\\[haskell-hugs-show-hugs-buffer]
|
||||||
|
to show the Hugs buffer and go to it.
|
||||||
|
|
||||||
|
\\<haskell-hugs-mode-map>
|
||||||
|
Commands:
|
||||||
|
Return at end of buffer sends line as input.
|
||||||
|
Return not at end copies rest of line to end and sends it.
|
||||||
|
\\[comint-kill-input] and \\[backward-kill-word] are kill commands,
|
||||||
|
imitating normal Unix input editing.
|
||||||
|
\\[comint-interrupt-subjob] interrupts the comint or its current
|
||||||
|
subjob if any.
|
||||||
|
\\[comint-stop-subjob] stops, likewise.
|
||||||
|
\\[comint-quit-subjob] sends quit signal."
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Hugs-interface
|
||||||
|
|
||||||
|
(require 'comint)
|
||||||
|
(require 'shell)
|
||||||
|
|
||||||
|
(defvar haskell-hugs-process nil
|
||||||
|
"The active Hugs subprocess corresponding to current buffer.")
|
||||||
|
|
||||||
|
(defvar haskell-hugs-process-buffer nil
|
||||||
|
"*Buffer used for communication with Hugs subprocess for current buffer.")
|
||||||
|
|
||||||
|
(defcustom haskell-hugs-program-name "hugs"
|
||||||
|
"*The name of the command to start the Hugs interpreter."
|
||||||
|
:type 'string
|
||||||
|
:group 'haskell-hugs)
|
||||||
|
|
||||||
|
(defcustom haskell-hugs-program-args '("+.")
|
||||||
|
"*A list of string args to send to the hugs process."
|
||||||
|
:type '(repeat string)
|
||||||
|
:group 'haskell-hugs)
|
||||||
|
|
||||||
|
(defvar haskell-hugs-load-end nil
|
||||||
|
"Position of the end of the last load command.")
|
||||||
|
|
||||||
|
(defvar haskell-hugs-send-end nil
|
||||||
|
"Position of the end of the last send command.")
|
||||||
|
|
||||||
|
(defalias 'run-hugs 'haskell-hugs-start-process)
|
||||||
|
|
||||||
|
(defun haskell-hugs-start-process (arg)
|
||||||
|
"Start a Hugs process and invokes `haskell-hugs-hook' if not nil.
|
||||||
|
Prompts for a list of args if called with an argument."
|
||||||
|
(interactive "P")
|
||||||
|
(message "Starting `hugs-process' %s" haskell-hugs-program-name)
|
||||||
|
(if arg
|
||||||
|
(setq haskell-hugs-program-args
|
||||||
|
(read-minibuffer "List of args for Hugs:"
|
||||||
|
(prin1-to-string haskell-hugs-program-args))))
|
||||||
|
(setq haskell-hugs-process-buffer
|
||||||
|
(apply 'make-comint
|
||||||
|
"hugs" haskell-hugs-program-name nil
|
||||||
|
haskell-hugs-program-args))
|
||||||
|
(setq haskell-hugs-process
|
||||||
|
(get-buffer-process haskell-hugs-process-buffer))
|
||||||
|
;; Select Hugs buffer temporarily
|
||||||
|
(set-buffer haskell-hugs-process-buffer)
|
||||||
|
(haskell-hugs-mode)
|
||||||
|
(make-local-variable 'shell-cd-regexp)
|
||||||
|
(make-local-variable 'shell-dirtrackp)
|
||||||
|
(setq shell-cd-regexp ":cd")
|
||||||
|
(setq shell-dirtrackp t)
|
||||||
|
(add-hook 'comint-input-filter-functions 'shell-directory-tracker nil 'local)
|
||||||
|
; ? or module name in Hugs 1.4
|
||||||
|
(setq comint-prompt-regexp "^\? \\|^[[:upper:]][_[:alnum:]\.]*> ")
|
||||||
|
;; comint's history syntax conflicts with Hugs syntax, eg. !!
|
||||||
|
(setq comint-input-autoexpand nil)
|
||||||
|
(run-hooks 'haskell-hugs-hook)
|
||||||
|
(message "")
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun haskell-hugs-wait-for-output ()
|
||||||
|
"Wait until output arrives and go to the last input."
|
||||||
|
(while (progn
|
||||||
|
(goto-char comint-last-input-end)
|
||||||
|
(and
|
||||||
|
(not (re-search-forward comint-prompt-regexp nil t))
|
||||||
|
(accept-process-output haskell-hugs-process)))))
|
||||||
|
|
||||||
|
(defun haskell-hugs-send (&rest string)
|
||||||
|
"Send `haskell-hugs-process' the arguments (one or more strings).
|
||||||
|
A newline is sent after the strings and they are inserted into the
|
||||||
|
current buffer after the last output."
|
||||||
|
;; Wait until output arrives and go to the last input.
|
||||||
|
(haskell-hugs-wait-for-output)
|
||||||
|
;; Position for this input.
|
||||||
|
(goto-char (point-max))
|
||||||
|
(apply 'insert string)
|
||||||
|
(comint-send-input)
|
||||||
|
(setq haskell-hugs-send-end (marker-position comint-last-input-end)))
|
||||||
|
|
||||||
|
(defun haskell-hugs-go (load-command cd)
|
||||||
|
"Save the current buffer and load its file into the Hugs process.
|
||||||
|
The first argument LOAD-COMMAND specifies how the file should be
|
||||||
|
loaded: as a new file (\":load \") or as a reload (\":reload \").
|
||||||
|
|
||||||
|
If the second argument CD is non-nil, change the Haskell-Hugs process to the
|
||||||
|
current buffer's directory before loading the file.
|
||||||
|
|
||||||
|
If the variable `haskell-hugs-command' is set then its value will be sent to
|
||||||
|
the Hugs process after the load command. This can be used for a
|
||||||
|
top-level expression to evaluate."
|
||||||
|
(hack-local-variables) ;; In case they've changed
|
||||||
|
(save-buffer)
|
||||||
|
(let ((file (if (string-equal load-command ":load ")
|
||||||
|
(concat "\"" buffer-file-name "\"")
|
||||||
|
""))
|
||||||
|
(dir (expand-file-name default-directory))
|
||||||
|
(cmd (and (boundp 'haskell-hugs-command)
|
||||||
|
haskell-hugs-command
|
||||||
|
(if (stringp haskell-hugs-command)
|
||||||
|
haskell-hugs-command
|
||||||
|
(symbol-name haskell-hugs-command)))))
|
||||||
|
(if (and haskell-hugs-process-buffer
|
||||||
|
(eq (process-status haskell-hugs-process) 'run))
|
||||||
|
;; Ensure the Hugs buffer is selected.
|
||||||
|
(set-buffer haskell-hugs-process-buffer)
|
||||||
|
;; Start Haskell-Hugs process.
|
||||||
|
(haskell-hugs-start-process nil))
|
||||||
|
|
||||||
|
(if cd (haskell-hugs-send (concat ":cd " dir)))
|
||||||
|
;; Wait until output arrives and go to the last input.
|
||||||
|
(haskell-hugs-wait-for-output)
|
||||||
|
(haskell-hugs-send load-command file)
|
||||||
|
;; Error message search starts from last load command.
|
||||||
|
(setq haskell-hugs-load-end (marker-position comint-last-input-end))
|
||||||
|
(if cmd (haskell-hugs-send cmd))
|
||||||
|
;; Wait until output arrives and go to the last input.
|
||||||
|
(haskell-hugs-wait-for-output)))
|
||||||
|
|
||||||
|
(defun haskell-hugs-load-file (cd)
|
||||||
|
"Save a hugs buffer file and load its file.
|
||||||
|
If CD (prefix argument if interactive) is non-nil, change the Hugs
|
||||||
|
process to the current buffer's directory before loading the file.
|
||||||
|
If there is an error, set the cursor at the error line otherwise show
|
||||||
|
the Hugs buffer."
|
||||||
|
(interactive "P")
|
||||||
|
(haskell-hugs-gen-load-file ":load " cd)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun haskell-hugs-reload-file (cd)
|
||||||
|
"Save a hugs buffer file and load its file.
|
||||||
|
If CD (prefix argument if interactive) is non-nil, change the Hugs
|
||||||
|
process to the current buffer's directory before loading the file.
|
||||||
|
If there is an error, set the cursor at the error line otherwise show
|
||||||
|
the Hugs buffer."
|
||||||
|
(interactive "P")
|
||||||
|
(haskell-hugs-gen-load-file ":reload " cd)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun haskell-hugs-gen-load-file (cmd cd)
|
||||||
|
"Save a hugs buffer file and load its file or reload depending on CMD.
|
||||||
|
If CD is non-nil, change the process to the current buffer's directory
|
||||||
|
before loading the file. If there is an error, set the cursor at the
|
||||||
|
error line otherwise show the Hugs buffer."
|
||||||
|
(save-excursion (haskell-hugs-go cmd cd))
|
||||||
|
;; Ensure the Hugs buffer is selected.
|
||||||
|
(set-buffer haskell-hugs-process-buffer)
|
||||||
|
;; Error message search starts from last load command.
|
||||||
|
(goto-char haskell-hugs-load-end)
|
||||||
|
(if (re-search-forward
|
||||||
|
"^ERROR \"\\([^ ]*\\)\"\\( (line \\([0-9]*\\))\\|\\)" nil t)
|
||||||
|
(let ((efile (buffer-substring (match-beginning 1)
|
||||||
|
(match-end 1)))
|
||||||
|
(eline (if (match-beginning 3)
|
||||||
|
(string-to-int (buffer-substring (match-beginning 3)
|
||||||
|
(match-end 3)))))
|
||||||
|
(emesg (buffer-substring (1+ (point))
|
||||||
|
(save-excursion (end-of-line) (point)))))
|
||||||
|
(pop-to-buffer haskell-hugs-process-buffer) ; show *hugs* buffer
|
||||||
|
(goto-char (point-max))
|
||||||
|
(recenter)
|
||||||
|
(message "Hugs error %s %s"
|
||||||
|
(file-name-nondirectory efile) emesg)
|
||||||
|
(if (file-exists-p efile)
|
||||||
|
(progn (find-file-other-window efile)
|
||||||
|
(if eline (goto-line eline))
|
||||||
|
(recenter)))
|
||||||
|
)
|
||||||
|
(pop-to-buffer haskell-hugs-process-buffer) ; show *hugs* buffer
|
||||||
|
(goto-char (point-max))
|
||||||
|
(message "There were no errors.")
|
||||||
|
(recenter 2) ; show only the end...
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun haskell-hugs-show-hugs-buffer ()
|
||||||
|
"Goes to the Hugs buffer."
|
||||||
|
(interactive)
|
||||||
|
(if (or (not haskell-hugs-process-buffer)
|
||||||
|
(not (buffer-live-p haskell-hugs-process-buffer)))
|
||||||
|
(haskell-hugs-start-process nil))
|
||||||
|
(pop-to-buffer haskell-hugs-process-buffer)
|
||||||
|
)
|
||||||
|
|
||||||
|
(provide 'haskell-hugs)
|
||||||
|
|
||||||
|
;; arch-tag: c2a621e9-d743-4361-a459-983fbf1d4589
|
||||||
|
;;; haskell-hugs.el ends here
|
||||||
1581
.emacs.d/haskell-mode/haskell-indent.el
Normal file
1581
.emacs.d/haskell-mode/haskell-indent.el
Normal file
File diff suppressed because it is too large
Load diff
882
.emacs.d/haskell-mode/haskell-indentation.el
Normal file
882
.emacs.d/haskell-mode/haskell-indentation.el
Normal file
File diff suppressed because it is too large
Load diff
624
.emacs.d/haskell-mode/haskell-mode.el
Normal file
624
.emacs.d/haskell-mode/haskell-mode.el
Normal file
File diff suppressed because it is too large
Load diff
154
.emacs.d/haskell-mode/haskell-simple-indent.el
Normal file
154
.emacs.d/haskell-mode/haskell-simple-indent.el
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
;;; haskell-simple-indent.el --- Simple indentation module for Haskell Mode
|
||||||
|
|
||||||
|
;; Copyright (C) 1998 Heribert Schuetz, Graeme E Moss
|
||||||
|
|
||||||
|
;; Authors:
|
||||||
|
;; 1998 Heribert Schuetz <Heribert.Schuetz@informatik.uni-muenchen.de> and
|
||||||
|
;; Graeme E Moss <gem@cs.york.ac.uk>
|
||||||
|
;; Keywords: indentation files Haskell
|
||||||
|
;; Version: 1.0
|
||||||
|
;; URL: http://www.cs.york.ac.uk/~gem/haskell-mode/simple-indent.html
|
||||||
|
|
||||||
|
;; This file is not part of GNU Emacs.
|
||||||
|
|
||||||
|
;; 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 GNU Emacs; see the file COPYING. If not, write to the
|
||||||
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
;; Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;; Purpose:
|
||||||
|
;;
|
||||||
|
;; To support simple indentation of Haskell scripts.
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; Installation:
|
||||||
|
;;
|
||||||
|
;; To bind TAB to the indentation command for all Haskell buffers, add
|
||||||
|
;; this to .emacs:
|
||||||
|
;;
|
||||||
|
;; (add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
|
||||||
|
;;
|
||||||
|
;; Otherwise, call `turn-on-haskell-simple-indent'.
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; Customisation:
|
||||||
|
;;
|
||||||
|
;; None supported.
|
||||||
|
;;
|
||||||
|
;;
|
||||||
|
;; History:
|
||||||
|
;;
|
||||||
|
;; If you have any problems or suggestions, after consulting the list
|
||||||
|
;; below, email gem@cs.york.ac.uk quoting the version of you are
|
||||||
|
;; using, the version of Emacs you are using, and a small example of
|
||||||
|
;; the problem or suggestion.
|
||||||
|
;;
|
||||||
|
;; Version 1.0:
|
||||||
|
;; Brought over from Haskell mode v1.1.
|
||||||
|
;;
|
||||||
|
;; Present Limitations/Future Work (contributions are most welcome!):
|
||||||
|
;;
|
||||||
|
;; (None so far.)
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;; All functions/variables start with
|
||||||
|
;; `(turn-(on/off)-)haskell-simple-indent'.
|
||||||
|
|
||||||
|
;; Version.
|
||||||
|
(defconst haskell-simple-indent-version "1.2"
|
||||||
|
"`haskell-simple-indent' version number.")
|
||||||
|
(defun haskell-simple-indent-version ()
|
||||||
|
"Echo the current version of `haskell-simple-indent' in the minibuffer."
|
||||||
|
(interactive)
|
||||||
|
(message "Using haskell-simple-indent version %s"
|
||||||
|
haskell-simple-indent-version))
|
||||||
|
|
||||||
|
;; Partly stolen from `indent-relative' in indent.el:
|
||||||
|
(defun haskell-simple-indent ()
|
||||||
|
"Space out to under next visible indent point.
|
||||||
|
Indent points are positions of non-whitespace following whitespace in
|
||||||
|
lines preceeding point. A position is visible if it is to the left of
|
||||||
|
the first non-whitespace of every nonblank line between the position and
|
||||||
|
the current line. If there is no visible indent point beyond the current
|
||||||
|
column, `tab-to-tab-stop' is done instead."
|
||||||
|
(interactive)
|
||||||
|
(let* ((start-column (current-column))
|
||||||
|
(invisible-from nil) ; `nil' means infinity here
|
||||||
|
(indent
|
||||||
|
(catch 'haskell-simple-indent-break
|
||||||
|
(save-excursion
|
||||||
|
(while (progn (beginning-of-line)
|
||||||
|
(not (bobp)))
|
||||||
|
(forward-line -1)
|
||||||
|
(if (not (looking-at "[ \t]*\n"))
|
||||||
|
(let ((this-indentation (current-indentation)))
|
||||||
|
(if (or (not invisible-from)
|
||||||
|
(< this-indentation invisible-from))
|
||||||
|
(if (> this-indentation start-column)
|
||||||
|
(setq invisible-from this-indentation)
|
||||||
|
(let ((end (line-beginning-position 2)))
|
||||||
|
(move-to-column start-column)
|
||||||
|
;; Is start-column inside a tab on this line?
|
||||||
|
(if (> (current-column) start-column)
|
||||||
|
(backward-char 1))
|
||||||
|
(or (looking-at "[ \t]")
|
||||||
|
(skip-chars-forward "^ \t" end))
|
||||||
|
(skip-chars-forward " \t" end)
|
||||||
|
(let ((col (current-column)))
|
||||||
|
(throw 'haskell-simple-indent-break
|
||||||
|
(if (or (= (point) end)
|
||||||
|
(and invisible-from
|
||||||
|
(> col invisible-from)))
|
||||||
|
invisible-from
|
||||||
|
col)))))))))))))
|
||||||
|
(if indent
|
||||||
|
(let ((opoint (point-marker)))
|
||||||
|
(indent-line-to indent)
|
||||||
|
(if (> opoint (point))
|
||||||
|
(goto-char opoint))
|
||||||
|
(set-marker opoint nil))
|
||||||
|
(tab-to-tab-stop))))
|
||||||
|
|
||||||
|
(defvar haskell-simple-indent-old)
|
||||||
|
|
||||||
|
;; The main functions.
|
||||||
|
(defun turn-on-haskell-simple-indent ()
|
||||||
|
"Set `indent-line-function' to a simple indentation function.
|
||||||
|
TAB will now move the cursor to the next indent point in the previous
|
||||||
|
nonblank line. An indent point is a non-whitespace character following
|
||||||
|
whitespace.
|
||||||
|
|
||||||
|
Runs `haskell-simple-indent-hook'.
|
||||||
|
|
||||||
|
Use `haskell-simple-indent-version' to find out what version this is."
|
||||||
|
(set (make-local-variable 'haskell-simple-indent-old) indent-line-function)
|
||||||
|
(set (make-local-variable 'indent-line-function) 'haskell-simple-indent)
|
||||||
|
(run-hooks 'haskell-simple-indent-hook))
|
||||||
|
|
||||||
|
(defun turn-off-haskell-simple-indent ()
|
||||||
|
"Return `indent-line-function' to original value.
|
||||||
|
I.e. the value before `turn-on-haskell-simple-indent' was called."
|
||||||
|
(when (local-variable-p 'haskell-simple-indent-old)
|
||||||
|
(setq indent-line-function haskell-simple-indent-old)
|
||||||
|
(kill-local-variable 'haskell-simple-indent-old)))
|
||||||
|
|
||||||
|
;; Provide ourselves:
|
||||||
|
|
||||||
|
(provide 'haskell-simple-indent)
|
||||||
|
|
||||||
|
;; arch-tag: 18a08122-723b-485e-b958-e1cf8218b816
|
||||||
|
;;; haskell-simple-indent.el ends here
|
||||||
277
.emacs.d/haskell-mode/haskell-site-file.el
Normal file
277
.emacs.d/haskell-mode/haskell-site-file.el
Normal file
|
|
@ -0,0 +1,277 @@
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-c-mode) "haskell-c" "haskell-c.el" (18170
|
||||||
|
;;;;;; 47169))
|
||||||
|
;;; Generated autoloads from haskell-c.el
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.hsc\\'" . haskell-c-mode))
|
||||||
|
|
||||||
|
(autoload 'haskell-c-mode "haskell-c" "\
|
||||||
|
Major mode for Haskell FFI files.
|
||||||
|
|
||||||
|
\(fn)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-cabal-mode) "haskell-cabal" "haskell-cabal.el"
|
||||||
|
;;;;;; (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-cabal.el
|
||||||
|
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.cabal\\'" . haskell-cabal-mode))
|
||||||
|
|
||||||
|
(autoload 'haskell-cabal-mode "haskell-cabal" "\
|
||||||
|
Major mode for Cabal package description files.
|
||||||
|
|
||||||
|
\(fn)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-decl-scan-mode) "haskell-decl-scan" "haskell-decl-scan.el"
|
||||||
|
;;;;;; (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-decl-scan.el
|
||||||
|
|
||||||
|
(autoload 'haskell-decl-scan-mode "haskell-decl-scan" "\
|
||||||
|
Minor mode for declaration scanning for Haskell mode.
|
||||||
|
Top-level declarations are scanned and listed in the menu item \"Declarations\".
|
||||||
|
Selecting an item from this menu will take point to the start of the
|
||||||
|
declaration.
|
||||||
|
|
||||||
|
\\[haskell-ds-forward-decl] and \\[haskell-ds-backward-decl] move forward and backward to the start of a declaration.
|
||||||
|
|
||||||
|
Under XEmacs, the following keys are also defined:
|
||||||
|
|
||||||
|
\\[fume-list-functions] lists the declarations of the current buffer,
|
||||||
|
\\[fume-prompt-function-goto] prompts for a declaration to move to, and
|
||||||
|
\\[fume-mouse-function-goto] moves to the declaration whose name is at point.
|
||||||
|
|
||||||
|
This may link with `haskell-doc' (only for Emacs currently).
|
||||||
|
|
||||||
|
For non-literate and LaTeX-style literate scripts, we assume the
|
||||||
|
common convention that top-level declarations start at the first
|
||||||
|
column. For Bird-style literate scripts, we assume the common
|
||||||
|
convention that top-level declarations start at the third column,
|
||||||
|
ie. after \"> \".
|
||||||
|
|
||||||
|
Anything in `font-lock-comment-face' is not considered for a
|
||||||
|
declaration. Therefore, using Haskell font locking with comments
|
||||||
|
coloured in `font-lock-comment-face' improves declaration scanning.
|
||||||
|
|
||||||
|
To turn on declaration scanning for all Haskell buffers, add this to
|
||||||
|
.emacs:
|
||||||
|
|
||||||
|
(add-hook 'haskell-mode-hook 'turn-on-haskell-decl-scan)
|
||||||
|
|
||||||
|
To turn declaration scanning on for the current buffer, call
|
||||||
|
`turn-on-haskell-decl-scan'.
|
||||||
|
|
||||||
|
Literate Haskell scripts are supported: If the value of
|
||||||
|
`haskell-literate' (automatically set by the Haskell mode of
|
||||||
|
Moss&Thorn) is `bird', a Bird-style literate script is assumed. If it
|
||||||
|
is nil or `tex', a non-literate or LaTeX-style literate script is
|
||||||
|
assumed, respectively.
|
||||||
|
|
||||||
|
Invokes `haskell-decl-scan-mode-hook'.
|
||||||
|
|
||||||
|
\(fn &optional ARG)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-doc-show-type haskell-doc-mode) "haskell-doc"
|
||||||
|
;;;;;; "haskell-doc.el" (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-doc.el
|
||||||
|
|
||||||
|
(autoload 'haskell-doc-mode "haskell-doc" "\
|
||||||
|
Enter `haskell-doc-mode' for showing fct types in the echo area.
|
||||||
|
See variable docstring.
|
||||||
|
|
||||||
|
\(fn &optional ARG)" t nil)
|
||||||
|
|
||||||
|
(defalias 'turn-on-haskell-doc-mode 'haskell-doc-mode)
|
||||||
|
|
||||||
|
(autoload 'haskell-doc-show-type "haskell-doc" "\
|
||||||
|
Show the type of the function near point.
|
||||||
|
For the function under point, show the type in the echo area.
|
||||||
|
This information is extracted from the `haskell-doc-prelude-types' alist
|
||||||
|
of prelude functions and their types, or from the local functions in the
|
||||||
|
current buffer.
|
||||||
|
|
||||||
|
\(fn &optional SYM)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-indent-mode) "haskell-indent" "haskell-indent.el"
|
||||||
|
;;;;;; (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-indent.el
|
||||||
|
|
||||||
|
(autoload 'haskell-indent-mode "haskell-indent" "\
|
||||||
|
``Intelligent'' Haskell indentation mode.
|
||||||
|
This deals with the layout rule of Haskell.
|
||||||
|
\\[haskell-indent-cycle] starts the cycle which proposes new
|
||||||
|
possibilities as long as the TAB key is pressed. Any other key
|
||||||
|
or mouse click terminates the cycle and is interpreted except for
|
||||||
|
RET which merely exits the cycle.
|
||||||
|
Other special keys are:
|
||||||
|
\\[haskell-indent-insert-equal]
|
||||||
|
inserts an =
|
||||||
|
\\[haskell-indent-insert-guard]
|
||||||
|
inserts an |
|
||||||
|
\\[haskell-indent-insert-otherwise]
|
||||||
|
inserts an | otherwise =
|
||||||
|
these functions also align the guards and rhs of the current definition
|
||||||
|
\\[haskell-indent-insert-where]
|
||||||
|
inserts a where keyword
|
||||||
|
\\[haskell-indent-align-guards-and-rhs]
|
||||||
|
aligns the guards and rhs of the region
|
||||||
|
\\[haskell-indent-put-region-in-literate]
|
||||||
|
makes the region a piece of literate code in a literate script
|
||||||
|
|
||||||
|
Invokes `haskell-indent-hook' if not nil.
|
||||||
|
|
||||||
|
\(fn &optional ARG)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-indentation-mode) "haskell-indentation"
|
||||||
|
;;;;;; "haskell-indentation.el" (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-indentation.el
|
||||||
|
|
||||||
|
(autoload 'haskell-indentation-mode "haskell-indentation" "\
|
||||||
|
Haskell indentation mode that deals with the layout rule.
|
||||||
|
It rebinds RET, DEL and BACKSPACE, so that indentations can be
|
||||||
|
set and deleted as if they were real tabs. It supports
|
||||||
|
autofill-mode.
|
||||||
|
|
||||||
|
\(fn &optional ARG)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (haskell-hayoo haskell-hoogle literate-haskell-mode
|
||||||
|
;;;;;; haskell-mode) "haskell-mode" "haskell-mode.el" (19222 37798))
|
||||||
|
;;; Generated autoloads from haskell-mode.el
|
||||||
|
|
||||||
|
(add-to-list 'load-path (or (file-name-directory load-file-name) (car load-path)))
|
||||||
|
|
||||||
|
(autoload 'haskell-mode "haskell-mode" "\
|
||||||
|
Major mode for editing Haskell programs.
|
||||||
|
Blank lines separate paragraphs, comments start with `-- '.
|
||||||
|
\\<haskell-mode-map>
|
||||||
|
Literate scripts are supported via `literate-haskell-mode'.
|
||||||
|
The variable `haskell-literate' indicates the style of the script in the
|
||||||
|
current buffer. See the documentation on this variable for more details.
|
||||||
|
|
||||||
|
Modules can hook in via `haskell-mode-hook'. The following modules
|
||||||
|
are supported with an `autoload' command:
|
||||||
|
|
||||||
|
`haskell-decl-scan', Graeme E Moss
|
||||||
|
Scans top-level declarations, and places them in a menu.
|
||||||
|
|
||||||
|
`haskell-doc', Hans-Wolfgang Loidl
|
||||||
|
Echoes types of functions or syntax of keywords when the cursor is idle.
|
||||||
|
|
||||||
|
`haskell-indentation', Kristof Bastiaensen
|
||||||
|
Intelligent semi-automatic indentation Mk2
|
||||||
|
|
||||||
|
`haskell-indent', Guy Lapalme
|
||||||
|
Intelligent semi-automatic indentation.
|
||||||
|
|
||||||
|
`haskell-simple-indent', Graeme E Moss and Heribert Schuetz
|
||||||
|
Simple indentation.
|
||||||
|
|
||||||
|
Module X is activated using the command `turn-on-X'. For example,
|
||||||
|
`haskell-indent' is activated using `turn-on-haskell-indent'.
|
||||||
|
For more information on a module, see the help for its `X-mode'
|
||||||
|
function. Some modules can be deactivated using `turn-off-X'. (Note
|
||||||
|
that `haskell-doc' is irregular in using `turn-(on/off)-haskell-doc-mode'.)
|
||||||
|
|
||||||
|
Use `haskell-version' to find out what version this is.
|
||||||
|
|
||||||
|
Invokes `haskell-mode-hook'.
|
||||||
|
|
||||||
|
\(fn)" t nil)
|
||||||
|
|
||||||
|
(autoload 'literate-haskell-mode "haskell-mode" "\
|
||||||
|
As `haskell-mode' but for literate scripts.
|
||||||
|
|
||||||
|
\(fn)" t nil)
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.\\(?:[gh]s\\|hi\\)\\'" . haskell-mode))
|
||||||
|
(add-to-list 'auto-mode-alist '("\\.l[gh]s\\'" . literate-haskell-mode))
|
||||||
|
(add-to-list 'interpreter-mode-alist '("runghc" . haskell-mode))
|
||||||
|
(add-to-list 'interpreter-mode-alist '("runhaskell" . haskell-mode))
|
||||||
|
|
||||||
|
(autoload 'haskell-hoogle "haskell-mode" "\
|
||||||
|
Do a Hoogle search for QUERY.
|
||||||
|
|
||||||
|
\(fn QUERY)" t nil)
|
||||||
|
|
||||||
|
(defalias 'hoogle 'haskell-hoogle)
|
||||||
|
|
||||||
|
(autoload 'haskell-hayoo "haskell-mode" "\
|
||||||
|
Do a Hayoo search for QUERY.
|
||||||
|
|
||||||
|
\(fn QUERY)" t nil)
|
||||||
|
|
||||||
|
(defalias 'hayoo 'haskell-hayoo)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads (inferior-haskell-find-haddock inferior-haskell-find-definition
|
||||||
|
;;;;;; inferior-haskell-info inferior-haskell-type inferior-haskell-load-file
|
||||||
|
;;;;;; switch-to-haskell) "inf-haskell" "inf-haskell.el" (19222
|
||||||
|
;;;;;; 37798))
|
||||||
|
;;; Generated autoloads from inf-haskell.el
|
||||||
|
|
||||||
|
(defalias 'run-haskell 'switch-to-haskell)
|
||||||
|
|
||||||
|
(autoload 'switch-to-haskell "inf-haskell" "\
|
||||||
|
Show the inferior-haskell buffer. Start the process if needed.
|
||||||
|
|
||||||
|
\(fn &optional ARG)" t nil)
|
||||||
|
|
||||||
|
(autoload 'inferior-haskell-load-file "inf-haskell" "\
|
||||||
|
Pass the current buffer's file to the inferior haskell process.
|
||||||
|
If prefix arg \\[universal-argument] is given, just reload the previous file.
|
||||||
|
|
||||||
|
\(fn &optional RELOAD)" t nil)
|
||||||
|
|
||||||
|
(autoload 'inferior-haskell-type "inf-haskell" "\
|
||||||
|
Query the haskell process for the type of the given expression.
|
||||||
|
If optional argument `insert-value' is non-nil, insert the type above point
|
||||||
|
in the buffer. This can be done interactively with the \\[universal-argument] prefix.
|
||||||
|
The returned info is cached for reuse by `haskell-doc-mode'.
|
||||||
|
|
||||||
|
\(fn EXPR &optional INSERT-VALUE)" t nil)
|
||||||
|
|
||||||
|
(autoload 'inferior-haskell-info "inf-haskell" "\
|
||||||
|
Query the haskell process for the info of the given expression.
|
||||||
|
|
||||||
|
\(fn SYM)" t nil)
|
||||||
|
|
||||||
|
(autoload 'inferior-haskell-find-definition "inf-haskell" "\
|
||||||
|
Attempt to locate and jump to the definition of the given expression.
|
||||||
|
|
||||||
|
\(fn SYM)" t nil)
|
||||||
|
|
||||||
|
(autoload 'inferior-haskell-find-haddock "inf-haskell" "\
|
||||||
|
Find and open the Haddock documentation of SYM.
|
||||||
|
Make sure to load the file into GHCi or Hugs first by using C-c C-l.
|
||||||
|
Only works for functions in a package installed with ghc-pkg, or
|
||||||
|
whatever the value of `haskell-package-manager-name' is.
|
||||||
|
|
||||||
|
This function needs to find which package a given module belongs
|
||||||
|
to. In order to do this, it computes a module-to-package lookup
|
||||||
|
alist, which is expensive to compute (it takes upwards of five
|
||||||
|
seconds with more than about thirty installed packages). As a
|
||||||
|
result, we cache it across sessions using the cache file
|
||||||
|
referenced by `inferior-haskell-module-alist-file'. We test to
|
||||||
|
see if this is newer than `haskell-package-conf-file' every time
|
||||||
|
we load it.
|
||||||
|
|
||||||
|
\(fn SYM)" t nil)
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
|
;;;### (autoloads nil nil ("haskell-font-lock.el" "haskell-ghci.el"
|
||||||
|
;;;;;; "haskell-hugs.el" "haskell-simple-indent.el" "test.el") (19222
|
||||||
|
;;;;;; 37817 315467))
|
||||||
|
|
||||||
|
;;;***
|
||||||
|
|
||||||
170
.emacs.d/haskell-mode/indent.hs
Normal file
170
.emacs.d/haskell-mode/indent.hs
Normal file
|
|
@ -0,0 +1,170 @@
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
-- Comments with allcaps `FIXME' indicate places where the indentation --
|
||||||
|
-- fails to find the correct indentation, whereas comments with --
|
||||||
|
-- lowercase `fixme' indicate places where impossible indentations --
|
||||||
|
-- are uselessly proposed. --
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- | Fill-paragraph should avoid inserting an | on the following lines.
|
||||||
|
|
||||||
|
-- | However, indented comments should still be indented. For great justice.
|
||||||
|
|
||||||
|
-- * Foo bar bazFoo bar bazFoo bar bazFoo bar bazFoo bar bazFoo bar baz
|
||||||
|
|
||||||
|
{- Here's
|
||||||
|
a more complex comment. Of doom. There is, indeed, great doom here. #-}
|
||||||
|
|
||||||
|
-- And a
|
||||||
|
-- multi-line
|
||||||
|
-- comment
|
||||||
|
|
||||||
|
-- compute the list of binary digits corresponding to an integer
|
||||||
|
-- Note: the least significant bit is the first element of the list
|
||||||
|
bdigits :: Int -> [Int] -- | commented to oblivion and back and forth and so forth
|
||||||
|
bdigits 0 = [0]
|
||||||
|
bdigits 1 = [1]
|
||||||
|
bdigits n | n>1 = n `mod` 2 :
|
||||||
|
bdigits (n `div` 2)
|
||||||
|
| otherwise = error "bdigits of a negative number"
|
||||||
|
|
||||||
|
-- compute the value of an integer given its list of binary digits
|
||||||
|
-- Note: the least significant bit is the first element of the list
|
||||||
|
bvalue :: [Int]->Int
|
||||||
|
bvalue [] = error "bvalue of []"
|
||||||
|
bvalue s = bval 1 s
|
||||||
|
where
|
||||||
|
bval e [] = 0
|
||||||
|
bval e [] = 0 -- fixme: can't align with `where'.
|
||||||
|
bval e (b:bs) | b==0 || b=="dd of " = b*e + bval (2*e) bs
|
||||||
|
| otherwise = error "ill digit" -- Spurious 3rd step.
|
||||||
|
foo
|
||||||
|
|
||||||
|
-- fixme: tab on the line above should insert `bvalue' at some point.
|
||||||
|
|
||||||
|
{- text
|
||||||
|
indentation
|
||||||
|
inside comments
|
||||||
|
-}
|
||||||
|
toto a = ( hello
|
||||||
|
, there -- indentation of leading , and ;
|
||||||
|
-- indentation of this comment.
|
||||||
|
, my friends )
|
||||||
|
|
||||||
|
lili x = do let ofs x = 1
|
||||||
|
print x
|
||||||
|
|
||||||
|
titi b =
|
||||||
|
let -- fixme: can't indent at column 0
|
||||||
|
x = let toto = 1
|
||||||
|
tata = 2 -- fixme: can't indent lower than `toto'.
|
||||||
|
in
|
||||||
|
toto in
|
||||||
|
do expr1
|
||||||
|
{- text
|
||||||
|
- indentation
|
||||||
|
- inside comments
|
||||||
|
-}
|
||||||
|
let foo s = let fro = 1
|
||||||
|
fri = 2 -- fixme: can't indent lower than `fro'.
|
||||||
|
in
|
||||||
|
hello
|
||||||
|
foo2 = bar2 -- fixme: can't align with arg `s' in foo.
|
||||||
|
foo1 = bar2 -- fixme: Can't be column 0.
|
||||||
|
expr2
|
||||||
|
|
||||||
|
tata c =
|
||||||
|
let bar = case foo -- fixme: can't be col 0.
|
||||||
|
of 1 -> blabla
|
||||||
|
2 -> blibli -- fixme: only one possible indentation here.
|
||||||
|
bar = case foo of
|
||||||
|
_ -> blabla
|
||||||
|
bar' = case foo
|
||||||
|
of _ -> blabla
|
||||||
|
toto -> plulu
|
||||||
|
|
||||||
|
turlu d = if test
|
||||||
|
then
|
||||||
|
ifturl
|
||||||
|
else
|
||||||
|
adfaf
|
||||||
|
|
||||||
|
turlu d = if test then
|
||||||
|
ifturl
|
||||||
|
else
|
||||||
|
sg
|
||||||
|
|
||||||
|
turly fg = toto
|
||||||
|
where
|
||||||
|
hello = 2
|
||||||
|
|
||||||
|
|
||||||
|
-- test from John Goerzen
|
||||||
|
|
||||||
|
x myVariableThing = case myVariablething of
|
||||||
|
Just z -> z
|
||||||
|
Nothing -> 0 -- fixme: "spurious" additional indents.
|
||||||
|
|
||||||
|
foo = let x = 1 in toto
|
||||||
|
titi -- FIXME
|
||||||
|
|
||||||
|
foo = let foo x y = toto
|
||||||
|
where
|
||||||
|
toto = 2
|
||||||
|
|
||||||
|
instance Show Toto where
|
||||||
|
foo x 4 = 50
|
||||||
|
|
||||||
|
data Toto = Foo
|
||||||
|
| Bar
|
||||||
|
deriving (Show) -- FIXME
|
||||||
|
|
||||||
|
foo = let toto x = do let bar = 2
|
||||||
|
return 1
|
||||||
|
in 3
|
||||||
|
|
||||||
|
eval env (Llambda x e) = -- FIXME: sole indentation is self???
|
||||||
|
Vfun (\v -> eval (\y -> if (x == y) then v else env y) -- FIXME
|
||||||
|
e) -- FIXME
|
||||||
|
|
||||||
|
foo = case findprop attr props of
|
||||||
|
Just x -> x
|
||||||
|
|
||||||
|
data T = T { granularity :: (Int, Int, Int, Int) -- FIXME: self indentation?
|
||||||
|
, items :: Map (Int, Int, Int, Int) [Item] }
|
||||||
|
|
||||||
|
foo = case foo of
|
||||||
|
[] ->
|
||||||
|
case bar of
|
||||||
|
[] ->
|
||||||
|
return ()
|
||||||
|
(x:xs) -> -- FIXME
|
||||||
|
|
||||||
|
bar = do toto
|
||||||
|
if titi
|
||||||
|
then tutu -- FIXME
|
||||||
|
else tata -- FIXME
|
||||||
|
|
||||||
|
insert :: Ord a => a -> b -> TreeMap a b -> TreeMap a b
|
||||||
|
insert x v Empty = Node 0 x v Empty Empty
|
||||||
|
insert x v (Node d x' v' t1 t2)
|
||||||
|
| x == x' = Node d x v t1 t2
|
||||||
|
| x < x' = Node ? x' v' (insert x v t1 Empty) t2
|
||||||
|
| -- FIXME: wrong indent *if at EOB*
|
||||||
|
|
||||||
|
|
||||||
|
tinsertb x v (Node x' v' d1 t1 d2 t2)
|
||||||
|
| x == x' = (1 + max d1 d2, Node x v d1 t1 d2 t2)
|
||||||
|
| x < x' =
|
||||||
|
case () of
|
||||||
|
_ | d1' <= d2 + 1 => (1 + max d1' d2, Node x' v' d1' t1' d2 t2)
|
||||||
|
-- d1' == d2 + 2: Need to rotate to rebalance. FIXME CRASH
|
||||||
|
else let (Node x'' v'' d1'' t1'' d2'' t2'') = t1'
|
||||||
|
|
||||||
|
test = if True then
|
||||||
|
toto
|
||||||
|
else if False then
|
||||||
|
tata -- FIXME
|
||||||
|
else -- FIXME
|
||||||
|
titi
|
||||||
|
|
||||||
|
-- arch-tag: de0069e3-c0a0-495c-b441-d4ff6e0509b1
|
||||||
722
.emacs.d/haskell-mode/inf-haskell.el
Normal file
722
.emacs.d/haskell-mode/inf-haskell.el
Normal file
File diff suppressed because it is too large
Load diff
157
.emacs.d/highlight-parentheses.el
Normal file
157
.emacs.d/highlight-parentheses.el
Normal file
|
|
@ -0,0 +1,157 @@
|
||||||
|
;;; highlight-parentheses.el --- highlight surrounding parentheses
|
||||||
|
;;
|
||||||
|
;; Copyright (C) 2007, 2009 Nikolaj Schumacher
|
||||||
|
;;
|
||||||
|
;; Author: Nikolaj Schumacher <bugs * nschum de>
|
||||||
|
;; Version: 1.0.1
|
||||||
|
;; Keywords: faces, matching
|
||||||
|
;; URL: http://nschum.de/src/emacs/highlight-parentheses/
|
||||||
|
;; Compatibility: GNU Emacs 22.x, GNU Emacs 23.x
|
||||||
|
;;
|
||||||
|
;; This file is NOT part of GNU Emacs.
|
||||||
|
;;
|
||||||
|
;; This program 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 2
|
||||||
|
;; of the License, or (at your option) any later version.
|
||||||
|
;;
|
||||||
|
;; This program 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 <http://www.gnu.org/licenses/>.
|
||||||
|
;;
|
||||||
|
;;; Commentary:
|
||||||
|
;;
|
||||||
|
;; Add the following to your .emacs file:
|
||||||
|
;; (require 'highlight-parentheses)
|
||||||
|
;;
|
||||||
|
;; Enable `highlight-parentheses-mode'.
|
||||||
|
;;
|
||||||
|
;;; Change Log:
|
||||||
|
;;
|
||||||
|
;; 2009-03-19 (1.0.1)
|
||||||
|
;; Added setter for color variables.
|
||||||
|
;;
|
||||||
|
;; 2007-07-30 (1.0)
|
||||||
|
;; Added background highlighting and faces.
|
||||||
|
;;
|
||||||
|
;; 2007-05-15 (0.9.1)
|
||||||
|
;; Support for defcustom.
|
||||||
|
;;
|
||||||
|
;; 2007-04-26 (0.9)
|
||||||
|
;; Initial Release.
|
||||||
|
;;
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
(eval-when-compile (require 'cl))
|
||||||
|
|
||||||
|
(defgroup highlight-parentheses nil
|
||||||
|
"Highlight surrounding parentheses"
|
||||||
|
:group 'faces
|
||||||
|
:group 'matching)
|
||||||
|
|
||||||
|
(defun hl-paren-set (variable value)
|
||||||
|
(set variable value)
|
||||||
|
(when (fboundp 'hl-paren-color-update)
|
||||||
|
(hl-paren-color-update)))
|
||||||
|
|
||||||
|
(defcustom hl-paren-colors
|
||||||
|
'("firebrick1" "IndianRed1" "IndianRed3" "IndianRed4")
|
||||||
|
"*List of colors for the highlighted parentheses.
|
||||||
|
The list starts with the the inside parentheses and moves outwards."
|
||||||
|
:type '(repeat color)
|
||||||
|
:set 'hl-paren-set
|
||||||
|
:group 'highlight-parentheses)
|
||||||
|
|
||||||
|
(defcustom hl-paren-background-colors nil
|
||||||
|
"*List of colors for the background highlighted parentheses.
|
||||||
|
The list starts with the the inside parentheses and moves outwards."
|
||||||
|
:type '(repeat color)
|
||||||
|
:set 'hl-paren-set
|
||||||
|
:group 'highlight-parentheses)
|
||||||
|
|
||||||
|
(defface hl-paren-face nil
|
||||||
|
"*Face used for highlighting parentheses.
|
||||||
|
Color attributes might be overriden by `hl-paren-colors' and
|
||||||
|
`hl-paren-background-colors'."
|
||||||
|
:group 'highlight-parentheses)
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defvar hl-paren-overlays nil
|
||||||
|
"This buffers currently active overlays.")
|
||||||
|
(make-variable-buffer-local 'hl-paren-overlays)
|
||||||
|
|
||||||
|
(defvar hl-paren-last-point 0
|
||||||
|
"The last point for which parentheses were highlighted.
|
||||||
|
This is used to prevent analyzing the same context over and over.")
|
||||||
|
(make-variable-buffer-local 'hl-paren-last-point)
|
||||||
|
|
||||||
|
(defun hl-paren-highlight ()
|
||||||
|
"Highlight the parentheses around point."
|
||||||
|
(unless (= (point) hl-paren-last-point)
|
||||||
|
(setq hl-paren-last-point (point))
|
||||||
|
(let ((overlays hl-paren-overlays)
|
||||||
|
pos1 pos2
|
||||||
|
(pos (point)))
|
||||||
|
(save-excursion
|
||||||
|
(condition-case err
|
||||||
|
(while (and (setq pos1 (cadr (syntax-ppss pos1)))
|
||||||
|
(cddr overlays))
|
||||||
|
(move-overlay (pop overlays) pos1 (1+ pos1))
|
||||||
|
(when (setq pos2 (scan-sexps pos1 1))
|
||||||
|
(move-overlay (pop overlays) (1- pos2) pos2)
|
||||||
|
))
|
||||||
|
(error nil))
|
||||||
|
(goto-char pos))
|
||||||
|
(dolist (ov overlays)
|
||||||
|
(move-overlay ov 1 1)))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-minor-mode highlight-parentheses-mode
|
||||||
|
"Minor mode to highlight the surrounding parentheses."
|
||||||
|
nil " hl-p" nil
|
||||||
|
(if highlight-parentheses-mode
|
||||||
|
(progn
|
||||||
|
(hl-paren-create-overlays)
|
||||||
|
(add-hook 'post-command-hook 'hl-paren-highlight nil t))
|
||||||
|
(mapc 'delete-overlay hl-paren-overlays)
|
||||||
|
(kill-local-variable 'hl-paren-overlays)
|
||||||
|
(kill-local-variable 'hl-paren-point)
|
||||||
|
(remove-hook 'post-command-hook 'hl-paren-highlight t)))
|
||||||
|
|
||||||
|
;;; overlays ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defun hl-paren-create-overlays ()
|
||||||
|
(let ((fg hl-paren-colors)
|
||||||
|
(bg hl-paren-background-colors)
|
||||||
|
attributes)
|
||||||
|
(while (or fg bg)
|
||||||
|
(setq attributes (face-attr-construct 'hl-paren-face))
|
||||||
|
(when (car fg)
|
||||||
|
(setq attributes (plist-put attributes :foreground (car fg))))
|
||||||
|
(pop fg)
|
||||||
|
(when (car bg)
|
||||||
|
(setq attributes (plist-put attributes :background (car bg))))
|
||||||
|
(pop bg)
|
||||||
|
(dotimes (i 2) ;; front and back
|
||||||
|
(push (make-overlay 0 0) hl-paren-overlays)
|
||||||
|
(overlay-put (car hl-paren-overlays) 'face attributes)))
|
||||||
|
(setq hl-paren-overlays (nreverse hl-paren-overlays))))
|
||||||
|
|
||||||
|
(defun hl-paren-color-update ()
|
||||||
|
(dolist (buffer (buffer-list))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(when hl-paren-overlays
|
||||||
|
(mapc 'delete-overlay hl-paren-overlays)
|
||||||
|
(setq hl-paren-overlays nil)
|
||||||
|
(hl-paren-create-overlays)
|
||||||
|
(let ((hl-paren-last-point -1)) ;; force update
|
||||||
|
(hl-paren-highlight))))))
|
||||||
|
|
||||||
|
(provide 'highlight-parentheses)
|
||||||
|
|
||||||
|
;;; highlight-parentheses.el ends here
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
(add-to-list 'load-path "~/.emacs.d/icicles")
|
(add-to-list 'load-path "~/.emacs.d/icicles")
|
||||||
(add-to-list 'load-path "~/.emacs.d/tabbar")
|
(add-to-list 'load-path "~/.emacs.d/tabbar")
|
||||||
|
|
||||||
|
|
||||||
(fset 'yes-or-no-p 'y-or-n-p)
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
|
||||||
(require 'icicles)
|
(require 'icicles)
|
||||||
|
|
@ -20,6 +21,7 @@
|
||||||
;(require 'highlight-symbol)
|
;(require 'highlight-symbol)
|
||||||
(require 'auto-complete-config)
|
(require 'auto-complete-config)
|
||||||
|
|
||||||
|
|
||||||
;; Hack to get *Messages* in viper-mode.
|
;; Hack to get *Messages* in viper-mode.
|
||||||
;; ;; (must be done after loading viper)
|
;; ;; (must be done after loading viper)
|
||||||
;; ;; Futzing with fundamental-mode doesn't seem to help.
|
;; ;; Futzing with fundamental-mode doesn't seem to help.
|
||||||
|
|
@ -28,7 +30,6 @@
|
||||||
(viper-change-state-to-vi))
|
(viper-change-state-to-vi))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
|
(add-to-list 'ac-dictionary-directories "~/.emacs.d/auto-complete/dict")
|
||||||
(ac-config-default)
|
(ac-config-default)
|
||||||
(setq ac-dwim t)
|
(setq ac-dwim t)
|
||||||
|
|
@ -39,6 +40,7 @@
|
||||||
(setq viper-translate-all-ESC-keysequences nil)
|
(setq viper-translate-all-ESC-keysequences nil)
|
||||||
(setq viper-always t)
|
(setq viper-always t)
|
||||||
(setq viper-vi-style-in-minibuffer nil)
|
(setq viper-vi-style-in-minibuffer nil)
|
||||||
|
(setq-default indent-tabs-mode nil)
|
||||||
;(define-key ac-completing-map "\t" 'ac-fuzzy-complete)
|
;(define-key ac-completing-map "\t" 'ac-fuzzy-complete)
|
||||||
;(define-key ac-completing-map "\r" nil)
|
;(define-key ac-completing-map "\r" nil)
|
||||||
(define-key ac-completing-map (kbd "<escape>") 'ac-stop)
|
(define-key ac-completing-map (kbd "<escape>") 'ac-stop)
|
||||||
|
|
@ -87,7 +89,7 @@
|
||||||
; Basic frame defaults
|
; Basic frame defaults
|
||||||
(let ((background-color "#2F2F2F")
|
(let ((background-color "#2F2F2F")
|
||||||
(foreground-color "LightGrey")
|
(foreground-color "LightGrey")
|
||||||
(fname "Inconsolata-18")
|
(fname "Inconsolata-13")
|
||||||
(fheight 45)
|
(fheight 45)
|
||||||
(fwidth 115))
|
(fwidth 115))
|
||||||
|
|
||||||
|
|
@ -96,7 +98,7 @@
|
||||||
; (set-background-color background-color)
|
; (set-background-color background-color)
|
||||||
; (add-to-list 'default-frame-alist (cons 'background-color background-color))
|
; (add-to-list 'default-frame-alist (cons 'background-color background-color))
|
||||||
; (set-foreground-color foreground-color)
|
; (set-foreground-color foreground-color)
|
||||||
(add-to-list 'default-frame-alist (cons 'foreground-color foreground-color))
|
; (add-to-list 'default-frame-alist (cons 'foreground-color foreground-color))
|
||||||
(add-to-list 'default-frame-alist (cons 'height fheight))
|
(add-to-list 'default-frame-alist (cons 'height fheight))
|
||||||
(add-to-list 'default-frame-alist (cons 'width fwidth))
|
(add-to-list 'default-frame-alist (cons 'width fwidth))
|
||||||
)
|
)
|
||||||
|
|
@ -106,6 +108,23 @@
|
||||||
(color-theme-initialize)
|
(color-theme-initialize)
|
||||||
(color-theme-barak)
|
(color-theme-barak)
|
||||||
(color-theme-barak-extras)
|
(color-theme-barak-extras)
|
||||||
|
(setq font-lock-maximum-decoration 3)
|
||||||
|
|
||||||
|
(load "~/.emacs.d/haskell-mode/haskell-site-file")
|
||||||
|
(add-hook 'haskell-mode-hook 'turn-on-haskell-doc-mode)
|
||||||
|
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
|
||||||
|
;;(add-hook 'haskell-mode-hook 'turn-on-haskell-indent)
|
||||||
|
(add-hook 'haskell-mode-hook 'turn-on-haskell-simple-indent)
|
||||||
|
|
||||||
|
(require 'highlight-parentheses)
|
||||||
|
|
||||||
|
(setq hl-paren-colors
|
||||||
|
'(;"#8f8f8f" ; this comes from Zenburn
|
||||||
|
; and I guess I'll try to make the far-outer parens look like this
|
||||||
|
"orange1" "yellow1" "greenyellow" "green1"
|
||||||
|
"springgreen1" "cyan1" "slateblue1" "magenta1" "purple"))
|
||||||
|
|
||||||
|
(add-hook 'emacs-lisp-mode-hook (lambda () (highlight-parentheses-mode)))
|
||||||
|
|
||||||
(defadvice viper-maybe-checkout (around viper-svn-checkin-fix activate)
|
(defadvice viper-maybe-checkout (around viper-svn-checkin-fix activate)
|
||||||
"Advise viper-maybe-checkout to ignore svn files."
|
"Advise viper-maybe-checkout to ignore svn files."
|
||||||
|
|
|
||||||
|
|
@ -40,9 +40,9 @@
|
||||||
(text-cursor ((t (:background "yellow" :foreground "black"))))
|
(text-cursor ((t (:background "yellow" :foreground "black"))))
|
||||||
(toolbar ((t (nil))))
|
(toolbar ((t (nil))))
|
||||||
(tabbar-default ((t (:background "black" :foreground "grey75"))))
|
(tabbar-default ((t (:background "black" :foreground "grey75"))))
|
||||||
(tabbar-selected (( (:background "grey75" :foreground "black"))))
|
(tabbar-selected ((t (:background "grey75" :foreground "black"))))
|
||||||
|
(tabbar-highlight ((t (:bold t))))
|
||||||
(underline ((nil (:underline nil))))
|
(underline ((nil (:underline nil))))
|
||||||
|
|
||||||
(zmacs-region ((t (:background "snow" :foreground "ble")))))))
|
(zmacs-region ((t (:background "snow" :foreground "ble")))))))
|
||||||
(defun color-theme-barak-extras ()
|
(defun color-theme-barak-extras ()
|
||||||
; Highlight numbers
|
; Highlight numbers
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue