|
1 | 1 | ;; -*- lexical-binding: t; -*-
|
2 |
| -(require 'tuareg) |
| 2 | +;; (require 'tuareg) |
3 | 3 |
|
4 | 4 | ;; See README
|
5 | 5 | (setq tuareg-indent-align-with-first-arg nil)
|
6 | 6 |
|
7 |
| -(add-hook |
8 |
| - 'tuareg-mode-hook |
9 |
| - (lambda() |
| 7 | +(add-hook 'tuareg-mode-hook #'my-tuareg-mode-setup) |
| 8 | +(defun my-tuareg-mode-setup () |
10 | 9 | (setq show-trailing-whitespace t)
|
11 | 10 | (setq indicate-empty-lines t)
|
12 | 11 |
|
13 | 12 | ;; Enable the representation of some keywords using fonts
|
14 |
| - (when (functionp 'prettify-symbols-mode) |
15 |
| - (prettify-symbols-mode)) |
| 13 | + (prettify-symbols-mode) |
| 14 | + |
| 15 | + (flyspell-prog-mode) ;Spell check strings and comments. |
| 16 | + |
| 17 | + ;; Easy keys to navigate errors after compilation: |
| 18 | + (define-key tuareg-mode-map [(f12)] #'next-error) |
| 19 | + (define-key tuareg-mode-map [(shift f12)] #'previous-error) |
16 | 20 |
|
17 |
| - (when (functionp 'flyspell-prog-mode) |
18 |
| - (flyspell-prog-mode)) |
19 | 21 | ;; See README
|
20 | 22 | ;;(setq tuareg-match-patterns-aligned t)
|
21 | 23 | ;;(electric-indent-mode 0)
|
22 |
| - )) |
23 |
| - |
| 24 | + ) |
24 | 25 |
|
25 |
| -;; Easy keys to navigate errors after compilation: |
26 |
| -(define-key tuareg-mode-map [(f12)] #'next-error) |
27 |
| -(define-key tuareg-mode-map [(shift f12)] #'previous-error) |
28 | 26 |
|
| 27 | +;;;; Use Merlin when available ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
29 | 28 |
|
30 |
| -;; Use Merlin if available |
31 |
| -(when (require 'merlin nil t) |
32 |
| - (setq merlin-command 'opam) |
33 |
| - (add-to-list 'auto-mode-alist '("/\\.merlin\\'" . conf-mode)) |
| 29 | +;; FIXME: Should be included in Merlin's own support code. |
| 30 | +(add-to-list 'auto-mode-alist '("/\\.merlin\\'" . conf-mode)) |
34 | 31 |
|
35 |
| - (when (functionp 'merlin-document) |
36 |
| - (define-key tuareg-mode-map (kbd "\C-c\C-h") #'merlin-document)) |
| 32 | +(with-eval-after-load 'merlin |
| 33 | + (when (fboundp 'merlin-document) |
| 34 | + (with-eval-after-load 'tuareg |
| 35 | + (define-key tuareg-mode-map (kbd "\C-c\C-h") #'merlin-document)))) |
37 | 36 |
|
| 37 | +(when (fboundp 'merlin-mode) |
38 | 38 | ;; Run Merlin if a .merlin file in the parent dirs is detected
|
39 | 39 | (add-hook 'tuareg-mode-hook
|
40 | 40 | (lambda()
|
41 | 41 | (let ((fn (buffer-file-name)))
|
42 | 42 | (if (and fn (locate-dominating-file fn ".merlin"))
|
43 | 43 | (merlin-mode))))))
|
44 | 44 |
|
45 |
| -;; Choose modes for related config. files |
| 45 | +;;;; Choose modes for related config files ;;;;;;;;;;;;;;;;;; |
46 | 46 | (setq auto-mode-alist
|
| 47 | + ;; FIXME: Are these still in use? Which tools are they used for? |
47 | 48 | (append '(("_oasis\\'" . conf-mode)
|
48 | 49 | ("_tags\\'" . conf-mode)
|
49 | 50 | ("_log\\'" . conf-mode))
|
|
0 commit comments