dev: merge from master

This commit is contained in:
Matt Nish-Lapidus 2024-08-14 09:21:46 -04:00
commit 34c3722f99
4 changed files with 39 additions and 48 deletions

View file

@ -193,7 +193,7 @@ And if it's a function, evaluate it."
(put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command) (put 'projectile-git-submodule-command 'initial-value projectile-git-submodule-command)
(setq projectile-git-submodule-command nil (setq projectile-git-submodule-command nil
;; Include and follow symlinks in file listings. ;; 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-indexing-method 'hybrid
projectile-generic-command projectile-generic-command
(lambda (_) (lambda (_)

View file

@ -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))) :desc "References (Write)" "w" #'+cc/ccls-show-references-write)))
(when (modulep! :tools lsp +eglot) (when (modulep! :tools lsp +eglot)
(set-eglot-client! 'cuda-mode '("clangd"))
;; Map eglot specific helper ;; Map eglot specific helper
(map! :localleader (map! :localleader
:after cc-mode :after cc-mode

View file

@ -13,6 +13,13 @@
(after! tuareg (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 ;; tuareg-mode has the prettify symbols itself
(set-ligatures! 'tuareg-mode :alist (set-ligatures! 'tuareg-mode :alist
(append tuareg-prettify-symbols-basic-alist (append tuareg-prettify-symbols-basic-alist
@ -91,50 +98,39 @@
(use-package! ocp-indent (use-package! ocp-indent
;; must be careful to always defer this, it has autoloads that adds hooks :hook (tuareg-mode-local-vars . ocp-setup-indent)
;; which we do not want if the executable can't be found :hook (caml-mode-local-vars . ocp-indent-caml-mode-setup)
:hook (tuareg-mode-local-vars . +ocaml-init-ocp-indent-h) :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 :config
(defun +ocaml-init-ocp-indent-h () ;; HACK: The package adds these hooks, but they're redundant (even
"Run `ocp-setup-indent', so long as the ocp-indent binary exists." ;; counter-productive) with the hooks I add above.
(when (executable-find "ocp-indent") (remove-hook 'tuareg-mode-hook #'ocp-setup-indent)
(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 (use-package! opam-switch-mode
:hook (tuareg-mode-local-vars . +ocaml-init-opam-switch-h) :hook (tuareg-mode-local-vars . opam-switch-mode)
:init :preface
(map! :localleader (map! :after tuareg
:localleader
:map tuareg-mode-map :map tuareg-mode-map
"w" #'opam-switch-set-switch) "w" #'opam-switch-set-switch)
:init
(defun +ocaml-init-opam-switch-h () (defadvice! +ocaml--init-opam-switch-mode-maybe-h (fn &rest args)
"Activate `opam-switch-mode' if the opam executable exists." "Activate `opam-switch-mode' if the opam executable exists."
(when (executable-find "opam") :around #'opam-switch-mode
(opam-switch-mode))) (when (executable-find opam-switch-program-name)
(apply fn args)))
:config :config
;; Use opam to set environment ;; Use opam to set environment
(setq tuareg-opam-insinuate t) (setq tuareg-opam-insinuate t)
(opam-switch-set-switch (tuareg-opam-current-compiler))) (opam-switch-set-switch (tuareg-opam-current-compiler)))
;; Tree sitter
(eval-when! (modulep! +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!))

View file

@ -2,27 +2,20 @@
;;; lang/ocaml/packages.el ;;; lang/ocaml/packages.el
(package! tuareg :pin "1d53723e39f22ab4ab76d31f2b188a2879305092") (package! tuareg :pin "1d53723e39f22ab4ab76d31f2b188a2879305092")
(package! opam-switch-mode :pin "1069e56a662f23ea09d4e05611bdedeb99257012") (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) (unless (modulep! +lsp)
(package! merlin :pin "b6ff2d4d569c23dd8fa91639d26fb984e9411862") (package! merlin :pin "9fa77dbe81c893476646d873c5ac5106b94b7107")
(package! merlin-eldoc :pin "bf8edc63d85b35e4def352fa7ce4ea39f43e1fd8") (package! merlin-eldoc :pin "bf8edc63d85b35e4def352fa7ce4ea39f43e1fd8")
(package! merlin-company :pin "b6ff2d4d569c23dd8fa91639d26fb984e9411862") (package! merlin-company :pin "9fa77dbe81c893476646d873c5ac5106b94b7107")
(when (and (modulep! :checkers syntax) (when (and (modulep! :checkers syntax)
(not (modulep! :checkers syntax +flymake))) (not (modulep! :checkers syntax +flymake)))
(package! flycheck-ocaml :pin "77f8ddbd9bfc3a11957ac7ec7e45d5fa9179b192"))) (package! flycheck-ocaml :pin "77f8ddbd9bfc3a11957ac7ec7e45d5fa9179b192")))
(package! ocp-indent :pin "f38578c25d62701847b1bcb45099a9020e2032fe")
(when (modulep! :tools eval) (when (modulep! :tools eval)
(package! utop :pin "384b3098c8c4a2e26b87167053952b753aa8a63a")) (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")