mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 03:20:26 +10:00
Updating Doom Emacs.
This commit is contained in:
@@ -55,10 +55,10 @@ opam install merlin utop ocp-indent dune ocamlformat
|
||||
|
||||
* Configuration
|
||||
+ If =:completion company= is enabled then autocomplete is provided by =merlin=
|
||||
+ When =:tools flycheck= is enabled then =flycheck-ocaml= is activated to do
|
||||
+ When =:checkers syntax= is enabled then =flycheck-ocaml= is activated to do
|
||||
on-the-fly syntax/type checking via =merlin=, otherwise this is only done when
|
||||
the file is saved.
|
||||
+ Spell checking is activated in comments if =:tools flyspell= is active
|
||||
+ Spell checking is activated in comments if =:checkers spell= is active
|
||||
+ A REPL is provided if =utop= is installed and =:tools eval= is active
|
||||
+ If =:editor format= is enabled, the =ocamlformat= executable is available and
|
||||
there is an =.ocamlformat= file present then =format-all-buffer= is bound to
|
||||
@@ -69,8 +69,8 @@ opam install merlin utop ocp-indent dune ocamlformat
|
||||
+ If =:emacs imenu= is enabled then top level symbols (modules, type, functions,
|
||||
etc.) can be looked up using =SPC / i=
|
||||
|
||||
Run =bin/doom refresh= to install all packages and =make doctor= to diagnose
|
||||
missing tools.
|
||||
Run =doom sync= to install all packages and =doom doctor= to diagnose missing
|
||||
tools.
|
||||
|
||||
* Appendix
|
||||
** Commands
|
||||
|
||||
@@ -6,4 +6,6 @@
|
||||
(interactive)
|
||||
(comment-indent-new-line)
|
||||
(when (eq (char-before) ?*)
|
||||
(just-one-space)))
|
||||
(just-one-space))
|
||||
(unless (eq (char-after) 32)
|
||||
(save-excursion (insert " "))))
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
;;; lang/ocaml/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;
|
||||
;;; Packages
|
||||
|
||||
(when (featurep! +lsp)
|
||||
(add-hook! '(tuareg-mode-local-vars-hook reason-mode-local-vars-hook)
|
||||
#'lsp!))
|
||||
@@ -18,10 +21,9 @@
|
||||
(tuareg-opam-update-env (tuareg-opam-current-compiler))
|
||||
|
||||
;; Spell-check comments
|
||||
(when (featurep! :tools flyspell)
|
||||
(when (featurep! :checkers spell)
|
||||
(add-hook 'tuareg-mode-local-vars-hook #'flyspell-prog-mode))
|
||||
|
||||
;; Ensure asterixes in block comments have at least one space of indentation
|
||||
(setq-hook! 'tuareg-mode-hook
|
||||
comment-line-break-function #'+ocaml/comment-indent-new-line)
|
||||
|
||||
@@ -31,7 +33,7 @@
|
||||
|
||||
(use-package! utop
|
||||
:when (featurep! :tools eval)
|
||||
:hook (tuareg-mode . +ocaml-init-utop-h)
|
||||
:hook (tuareg-mode-local-vars . +ocaml-init-utop-h)
|
||||
:init
|
||||
(set-repl-handler! 'tuareg-mode #'utop)
|
||||
(set-eval-handler! 'tuareg-mode #'utop-eval-region)
|
||||
@@ -44,7 +46,7 @@
|
||||
|
||||
(use-package! merlin
|
||||
:unless (featurep! +lsp)
|
||||
:hook (tuareg-mode . +ocaml-init-merlin-h)
|
||||
:hook (tuareg-mode-local-vars . +ocaml-init-merlin-h)
|
||||
:init
|
||||
(defun +ocaml-init-merlin-h ()
|
||||
"Activate `merlin-mode' if the ocamlmerlin executable exists."
|
||||
@@ -53,7 +55,7 @@
|
||||
|
||||
(after! tuareg
|
||||
(set-company-backend! 'tuareg-mode 'merlin-company-backend)
|
||||
(set-lookup-handlers! 'tuareg-mode
|
||||
(set-lookup-handlers! 'tuareg-mode :async t
|
||||
:definition #'merlin-locate
|
||||
:references #'merlin-occurrences
|
||||
:documentation #'merlin-document))
|
||||
@@ -65,7 +67,7 @@
|
||||
"t" #'merlin-type-enclosing)
|
||||
|
||||
(use-package! flycheck-ocaml
|
||||
:when (featurep! :tools flycheck)
|
||||
:when (featurep! :checkers syntax)
|
||||
:hook (merlin-mode . +ocaml-init-flycheck-h)
|
||||
:config
|
||||
(defun +ocaml-init-flycheck-h ()
|
||||
@@ -93,7 +95,7 @@
|
||||
(use-package! ocp-indent
|
||||
;; must be careful to always defer this, it has autoloads that adds hooks
|
||||
;; which we do not want if the executable can't be found
|
||||
:hook (tuareg-mode . +ocaml-init-ocp-indent-h)
|
||||
:hook (tuareg-mode-local-vars . +ocaml-init-ocp-indent-h)
|
||||
:config
|
||||
(defun +ocaml-init-ocp-indent-h ()
|
||||
"Run `ocp-setup-indent', so long as the ocp-indent binary exists."
|
||||
@@ -104,7 +106,7 @@
|
||||
(use-package! ocamlformat
|
||||
:when (featurep! :editor format)
|
||||
:commands ocamlformat
|
||||
:hook (tuareg-mode . +ocaml-init-ocamlformat-h)
|
||||
:hook (tuareg-mode-local-vars . +ocaml-init-ocamlformat-h)
|
||||
:config
|
||||
(set-formatter! 'ocamlformat #'ocamlformat
|
||||
:modes '(caml-mode tuareg-mode))
|
||||
@@ -113,4 +115,9 @@
|
||||
(setq +format-with 'ocp-indent)
|
||||
(when (and (executable-find "ocamlformat")
|
||||
(locate-dominating-file default-directory ".ocamlformat"))
|
||||
(let ((ext (file-name-extension buffer-file-name t)))
|
||||
(cond ((equal ext ".eliom")
|
||||
(setq-local ocamlformat-file-kind 'implementation))
|
||||
((equal ext ".eliomi")
|
||||
(setq-local ocamlformat-file-kind 'interface))))
|
||||
(setq +format-with 'ocamlformat))))
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/ocaml/packages.el
|
||||
|
||||
(package! tuareg)
|
||||
(package! tuareg :pin "c12061eb80")
|
||||
|
||||
(unless (featurep! +lsp)
|
||||
(package! merlin)
|
||||
(package! merlin-eldoc)
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-ocaml)))
|
||||
(package! merlin :pin "37e38e44f5")
|
||||
(package! merlin-eldoc :pin "db7fab1edd")
|
||||
(when (featurep! :checkers syntax)
|
||||
(package! flycheck-ocaml :pin "8707a7bf54")))
|
||||
|
||||
(package! ocp-indent)
|
||||
(package! ocp-indent :pin "9e26c0a269")
|
||||
|
||||
(when (featurep! :tools eval)
|
||||
(package! utop))
|
||||
(package! utop :pin "30c77ce4d7"))
|
||||
|
||||
(when (featurep! :editor format)
|
||||
;; by default quelpa generated a version 0pre0.20180929.192844, which got
|
||||
;; parsed into (0 -1 0 ...), which when compared with version nil (0) in
|
||||
;; package-installed-p always yielded false
|
||||
(package! ocamlformat :recipe
|
||||
(:host github :repo "ocaml-ppx/ocamlformat" :files ("emacs/*.el"))))
|
||||
(:host github :repo "ocaml-ppx/ocamlformat" :files ("emacs/*.el")) :pin "5282e047bb"))
|
||||
|
||||
(package! dune :recipe
|
||||
(:host github :repo "ocaml/dune" :files ("editor-integration/emacs/*.el")))
|
||||
(:host github :repo "ocaml/dune" :files ("editor-integration/emacs/*.el")) :pin "1944d0fb52")
|
||||
|
||||
Reference in New Issue
Block a user