@@ -61,58 +61,28 @@ Now openning a `.hs` file should work with `hie-core`.
6161
6262### Using with Emacs
6363
64−The frst step is to install required Emacs packages. If you don't already have [Melpa](https://melpa.org/#/) package installation configured in your `.emacs`, put this stanza at the top.
65−
66−```elisp
67−;;Melpa packages support
68−(require 'package)
69−(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
70− (not (gnutls-available-p))))
71− (proto (if no-ssl "http" "https")))
72− (when no-ssl
73− (warn "\
74−Your version of Emacs does not support SSL connections,
75−which is unsafe because it allows man-in-the-middle attacks.
76−There are two things you can do about this warning:
77−1. Install an Emacs version that does support SSL and be safe.
78−2. Remove this warning from your init file so you won't see it again."))
79− ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
80− (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
81− ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
82− (when (< emacs-major-version 24)
83− ;; For important compatibility libraries like cl-lib
84− (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
85−(package-initialize)
86−;; Remember : to avoid package-not-found errors, refresh the package
87−;; database now and then with M-x package-refresh-contents.
88−```
89−
90−When this is in your `.emacs` and evaluated, `M-x package-refresh-contents` to get the package database downloaded and then `M-x package-list-packages` to display the available packages. Click on a package to install it. You'll need to install the following packages:
91−
92−* `lsp-haskell`
93−* `lsp-ui`
94−* `flycheck`
95−* `yasnippet`
96−
97−When done with this, add the following lines to your `.emacs`:
98−
99−```elisp
100−;; LSP support for Haskell
101−(require 'lsp)
102−(require 'lsp-haskell)
103−(require 'yasnippet)
104−(add-hook 'haskell-mode-hook #'lsp)
105−(setq lsp-haskell-process-path-hie "hie-core")
106−(setq lsp-haskell-process-args-hie '())
107−```
108−
109−Optionally, you may wish to add the following conveniences:
110−
64+If you don't already have [MELPA](https://melpa.org/#/) package installation configured, visit MELPA [getting started](https://melpa.org/#/getting-started) page to get set up. Then, install [`use-package`](https://melpa.org/#/use-package). Finally, add the following lines to your `.emacs`.
11165```elisp
112−;; Enable LSP logging (helpful for debugging)
113−(setq lsp-log-io t)
114−
115−;; Keyboard mappings for goto next/previous error
116−(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
117−(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
66+;; LSP
67+(use-package flycheck
68+ :ensure t
69+ :init
70+ (global-flycheck-mode t))
71+(use-package yasnippet
72+ :ensure t)
73+(use-package lsp-mode
74+ :ensure t
75+ :hook (haskell-mode . lsp)
76+ :commands lsp)
77+(use-package lsp-ui
78+ :ensure t
79+ :commands lsp-ui-mode)
80+(use-package lsp-haskell
81+ :ensure t
82+ :config
83+ (setq lsp-haskell-process-path-hie "hie-core")
84+ (setq lsp-haskell-process-args-hie '())
85+ ;; Comment/uncomment this line to see interactions between lsp client/server.
86+ ;;(setq lsp-log-io t)
87+)
11888```