ghc.el 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ;;; ghc.el --- ghc-mod front-end for haskell-mode
  2. ;; Author: Kazu Yamamoto <Kazu@Mew.org>
  3. ;; Created: Sep 25, 2009
  4. ;; Revised:
  5. ;; Put the following code to your "~/.emacs".
  6. ;;
  7. ;; (autoload 'ghc-init "ghc" nil t)
  8. ;; (add-hook 'haskell-mode-hook (lambda () (ghc-init)))
  9. ;; Or
  10. ;; (add-hook 'haskell-mode-hook (lambda () (ghc-init) (flymake-mode)))
  11. ;;; Code:
  12. (defconst ghc-version "1.11.1")
  13. ;; (eval-when-compile
  14. ;; (require 'haskell-mode))
  15. (require 'ghc-comp)
  16. (require 'ghc-doc)
  17. (require 'ghc-info)
  18. (require 'ghc-flymake)
  19. (require 'ghc-command)
  20. (require 'ghc-ins-mod)
  21. (require 'ghc-indent)
  22. (require 'dabbrev)
  23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  24. ;;;
  25. ;;; Customize Variables
  26. ;;;
  27. (defun ghc-find-C-h ()
  28. (if keyboard-translate-table
  29. (aref keyboard-translate-table ?\C-h)
  30. ?\C-h))
  31. (defvar ghc-completion-key "\e\t")
  32. (defvar ghc-document-key "\e\C-d")
  33. (defvar ghc-import-key "\e\C-m")
  34. (defvar ghc-previous-key "\ep")
  35. (defvar ghc-next-key "\en")
  36. (defvar ghc-help-key "\e?")
  37. (defvar ghc-insert-key "\et")
  38. (defvar ghc-sort-key "\es")
  39. (defvar ghc-type-key "\C-c\C-t")
  40. (defvar ghc-info-key "\C-c\C-i")
  41. (defvar ghc-check-key "\C-x\C-s")
  42. (defvar ghc-toggle-key "\C-c\C-c")
  43. (defvar ghc-module-key "\C-c\C-m")
  44. (defvar ghc-expand-key "\C-c\C-e")
  45. (defvar ghc-jump-key "\C-c\C-j")
  46. (defvar ghc-hoogle-key (format "\C-c%c" (ghc-find-C-h)))
  47. (defvar ghc-shallower-key "\C-c<")
  48. (defvar ghc-deeper-key "\C-c>")
  49. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  50. ;;;
  51. ;;; Initializer
  52. ;;;
  53. (defvar ghc-initialized nil)
  54. ;;;###autoload
  55. (defun ghc-init ()
  56. (ghc-abbrev-init)
  57. (ghc-type-init)
  58. (unless ghc-initialized
  59. (define-key haskell-mode-map ghc-completion-key 'ghc-complete)
  60. (define-key haskell-mode-map ghc-document-key 'ghc-browse-document)
  61. (define-key haskell-mode-map ghc-type-key 'ghc-show-type)
  62. (define-key haskell-mode-map ghc-info-key 'ghc-show-info)
  63. (define-key haskell-mode-map ghc-expand-key 'ghc-expand-th)
  64. (define-key haskell-mode-map ghc-jump-key 'ghc-flymake-jump)
  65. (define-key haskell-mode-map ghc-import-key 'ghc-import-module)
  66. (define-key haskell-mode-map ghc-previous-key 'flymake-goto-prev-error)
  67. (define-key haskell-mode-map ghc-next-key 'flymake-goto-next-error)
  68. (define-key haskell-mode-map ghc-help-key 'ghc-flymake-display-errors)
  69. (define-key haskell-mode-map ghc-insert-key 'ghc-insert-template)
  70. (define-key haskell-mode-map ghc-sort-key 'ghc-sort-lines)
  71. (define-key haskell-mode-map ghc-check-key 'ghc-save-buffer)
  72. (define-key haskell-mode-map ghc-toggle-key 'ghc-flymake-toggle-command)
  73. (define-key haskell-mode-map ghc-module-key 'ghc-insert-module)
  74. (define-key haskell-mode-map ghc-hoogle-key 'haskell-hoogle)
  75. (define-key haskell-mode-map ghc-shallower-key 'ghc-make-indent-shallower)
  76. (define-key haskell-mode-map ghc-deeper-key 'ghc-make-indent-deeper)
  77. (ghc-comp-init)
  78. (setq ghc-initialized t)))
  79. (defun ghc-abbrev-init ()
  80. (set (make-local-variable 'dabbrev-case-fold-search) nil))
  81. (provide 'ghc)