diff --git a/lisp/doom-projects.el b/lisp/doom-projects.el index b59c40903..b3d608551 100644 --- a/lisp/doom-projects.el +++ b/lisp/doom-projects.el @@ -193,7 +193,7 @@ And if it's a function, evaluate it." (put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command) (setq projectile-git-submodule-command nil ;; Include and follow symlinks in file listings. - projectile-git-fd-args (concat "-L -tl " projectile-git-fd-args " --ignore-file .project") + projectile-git-fd-args (concat "-L -tl " projectile-git-fd-args) projectile-indexing-method 'hybrid projectile-generic-command (lambda (_) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index e69e28ec2..067973ddf 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -282,6 +282,8 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e :desc "References (Write)" "w" #'+cc/ccls-show-references-write))) (when (modulep! :tools lsp +eglot) + (set-eglot-client! 'cuda-mode '("clangd")) + ;; Map eglot specific helper (map! :localleader :after cc-mode diff --git a/modules/lang/ocaml/config.el b/modules/lang/ocaml/config.el index 27a57ac21..75beb8645 100644 --- a/modules/lang/ocaml/config.el +++ b/modules/lang/ocaml/config.el @@ -13,6 +13,13 @@ (after! tuareg + (set-formatter! 'ocamlformat + '("ocamlformat" "-" "--name" filepath "--enable-outside-detected-project" + (if (locate-dominating-file default-directory ".ocamlformat") + (pcase (apheleia-formatters-extension-p "eliom" "eliomi") + ("eliom" '("--impl")) + ("eliomi" '("--intf"))) + '("--profile=ocamlformat")))) ;; tuareg-mode has the prettify symbols itself (set-ligatures! 'tuareg-mode :alist (append tuareg-prettify-symbols-basic-alist @@ -91,50 +98,39 @@ (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-local-vars . +ocaml-init-ocp-indent-h) + :hook (tuareg-mode-local-vars . ocp-setup-indent) + :hook (caml-mode-local-vars . ocp-indent-caml-mode-setup) + :init + (defadvice! +ocaml--init-ocp-indent-maybe-h (fn &rest args) + "Run `ocp-setup-indent' only if the ocp-indent binary is found." + :around #'ocp-setup-indent + (when (executable-find ocp-indent-path) + (apply fn args))) :config - (defun +ocaml-init-ocp-indent-h () - "Run `ocp-setup-indent', so long as the ocp-indent binary exists." - (when (executable-find "ocp-indent") - (ocp-setup-indent)))) + ;; HACK: The package adds these hooks, but they're redundant (even + ;; counter-productive) with the hooks I add above. + (remove-hook 'tuareg-mode-hook #'ocp-setup-indent) + (remove-hook 'caml-mode-hook #'ocp-indent-caml-mode-setup)) -(use-package! ocamlformat - :when (modulep! :editor format) - :commands ocamlformat - :hook (tuareg-mode-local-vars . +ocaml-init-ocamlformat-h) - :config - ;; TODO Fix region-based formatting support - (defun +ocaml-init-ocamlformat-h () - (setq-local +format-with 'ocp-indent) - (when (and (executable-find "ocamlformat") - (locate-dominating-file default-directory ".ocamlformat")) - (when buffer-file-name - (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-local +format-with 'ocamlformat)))) - (use-package! opam-switch-mode - :hook (tuareg-mode-local-vars . +ocaml-init-opam-switch-h) - :init - (map! :localleader + :hook (tuareg-mode-local-vars . opam-switch-mode) + :preface + (map! :after tuareg + :localleader :map tuareg-mode-map "w" #'opam-switch-set-switch) - - (defun +ocaml-init-opam-switch-h () + :init + (defadvice! +ocaml--init-opam-switch-mode-maybe-h (fn &rest args) "Activate `opam-switch-mode' if the opam executable exists." - (when (executable-find "opam") - (opam-switch-mode))) + :around #'opam-switch-mode + (when (executable-find opam-switch-program-name) + (apply fn args))) :config ;; Use opam to set environment (setq tuareg-opam-insinuate t) (opam-switch-set-switch (tuareg-opam-current-compiler))) -;; Tree sitter + (eval-when! (modulep! +tree-sitter) - (add-hook! 'tuareg-mode-local-vars-hook #'tree-sitter!)) + (add-hook 'tuareg-mode-local-vars-hook #'tree-sitter!)) diff --git a/modules/lang/ocaml/packages.el b/modules/lang/ocaml/packages.el index bf64fb7e4..289c23feb 100644 --- a/modules/lang/ocaml/packages.el +++ b/modules/lang/ocaml/packages.el @@ -2,27 +2,20 @@ ;;; lang/ocaml/packages.el (package! tuareg :pin "1d53723e39f22ab4ab76d31f2b188a2879305092") - (package! opam-switch-mode :pin "1069e56a662f23ea09d4e05611bdedeb99257012") +(package! ocp-indent :pin "f38578c25d62701847b1bcb45099a9020e2032fe") +(package! dune + :recipe (:host github :repo "ocaml/dune" :files ("editor-integration/emacs/*.el")) + :pin "96ed5fb42f2c534578cb77191887f8d5a7bf5529") (unless (modulep! +lsp) - (package! merlin :pin "b6ff2d4d569c23dd8fa91639d26fb984e9411862") + (package! merlin :pin "9fa77dbe81c893476646d873c5ac5106b94b7107") (package! merlin-eldoc :pin "bf8edc63d85b35e4def352fa7ce4ea39f43e1fd8") - (package! merlin-company :pin "b6ff2d4d569c23dd8fa91639d26fb984e9411862") + (package! merlin-company :pin "9fa77dbe81c893476646d873c5ac5106b94b7107") (when (and (modulep! :checkers syntax) (not (modulep! :checkers syntax +flymake))) (package! flycheck-ocaml :pin "77f8ddbd9bfc3a11957ac7ec7e45d5fa9179b192"))) -(package! ocp-indent :pin "f38578c25d62701847b1bcb45099a9020e2032fe") - (when (modulep! :tools eval) (package! utop :pin "384b3098c8c4a2e26b87167053952b753aa8a63a")) -(when (modulep! :editor format) - (package! ocamlformat - :recipe (:host github :repo "ocaml-ppx/ocamlformat" :files ("emacs/*.el")) - :pin "c43f89bc0ebd536009151814214320bdf3988c50")) - -(package! dune - :recipe (:host github :repo "ocaml/dune" :files ("editor-integration/emacs/*.el")) - :pin "aac3d84f1d5abdf276d72be3dccac23bf99b3c7c")