After following the Configuring Your Editor instructions for Emacs on the official OCaml website, I am getting a warning in Emacs after opening an *.ml file. Any help would be appreciated. I am using Emacs version 30.2 on Linux. I can suppress defvaralias warnings, but I’d rather not if this can be fixed somehow.
Warning:
⛔ Warning (defvaralias): Overwriting value of ‘ocaml-eglot-hook’ by aliasing to ‘ocaml-eglot-mode-hook’
Warning stack trace:
Debugger entered: nil
(progn (debug))
(if (eq new-alias 'ocaml-eglot-hook) (progn (debug)))
defvaralias@trace-defvarialias(ocaml-eglot-hook ocaml-eglot-mode-hook)
apply(defvaralias@trace-defvarialias (ocaml-eglot-hook ocaml-eglot-mode-hook))
defvaralias(ocaml-eglot-hook ocaml-eglot-mode-hook)
byte-code("\301\302N\204\f\0\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\313\10\310\211%\210\314\315\312\"\210\316\315\312\317#\210\314\320\321\"\210\316\320\312\317#\210\322\323\301\"\210\324\323\301\317#\210\322\325\300\"\210\324\325\300\317#\210\326\315!\207" [ocaml-eglot-mode-map ocaml-eglot-mode-hook variable-documentation put "Hook run after entering or leaving `ocaml-eglot-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode ocaml-eglot-mode " OCaml-eglot" defalias ocaml-eglot make-obsolete "1.4.0" ocaml-eglot-setup ocaml-eglot--setup defvaralias ocaml-eglot-hook make-obsolete-variable ocaml-eglot-map provide] 6)
ocaml-eglot()
run-hooks(change-major-mode-after-body-hook prog-mode-hook tuareg-load-hook tuareg-mode-hook)
apply(run-hooks change-major-mode-after-body-hook (prog-mode-hook tuareg-load-hook tuareg-mode-hook))
run-mode-hooks(tuareg-mode-hook)
tuareg-mode()
set-auto-mode-0(tuareg-mode nil)
set-auto-mode--apply-alist((("dune-project\\'" . dune-mode) ("dune\\'" . dune-mode) ("\\(?:\\`\\|/\\)dune\\(?:\\.inc\\|\\-project\\|\\-workspace\\)?\\'" . dune-mode) ("\\.ocamlinit\\'" . tuareg-mode) ("[./]opam_?\\'" . tuareg-opam-mode) ("\\.mly\\'" . tuareg-menhir-mode) ("\\.eliomi?\\'" . tuareg-mode) ("\\.ml[ip]?\\'" . tuareg-mode) ("\\.mli\\'" . tuareg-mode) ("\\.ml\\'" . tuareg-mode) ("\\.desktop\\(\\.in\\)?$" . desktop-entry-mode) ("CMakeLists\\.txt\\'" . cmake-mode) ("\\.cmake\\'" . cmake-mode) (".at'" . autotest-mode) ("\\.gpg\\(~\\|\\.~[0-9]+~\\)?\\'" nil epa-file) ("\\.elc\\'" . elisp-byte-code-mode) ("\\.zst\\'" nil jka-compr) ("\\.dz\\'" nil jka-compr) ("\\.xz\\'" nil jka-compr) ("\\.lzma\\'" nil jka-compr) ("\\.lz\\'" nil jka-compr) ("\\.g?z\\'" nil jka-compr) ("\\.bz2\\'" nil jka-compr) ("\\.Z\\'" nil jka-compr) ("\\.vr[hi]?\\'" . vera-mode) ("\\(?:\\.\\(?:rbw?\\|ru\\|rake\\|thor\\|axlsx\\|jbuilder\\|rabl\\|gemspec\\|podspec\\)\\|/\\(?:Gem\\|Rake\\|Cap\\|Thor\\|Puppet\\|Berks\\|Brew\\|Fast\\|Vagrant\\|Guard\\|Pod\\)file\\)\\'" . ruby-mode) ("\\.re?st\\'" . rst-mode) ("/\\(?:Pipfile\\|\\.?flake8\\)\\'" . conf-mode) ("\\.py[iw]?\\'" . python-mode) ("\\.m\\'" . octave-maybe-mode) ("\\.less\\'" . less-css-mode) ("\\.editorconfig\\'" . editorconfig-conf-mode) ("\\.scss\\'" . scss-mode) ("\\.cs\\'" . csharp-mode) ("\\.awk\\'" . awk-mode) ("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode) ("\\.idl\\'" . idl-mode) ("\\.java\\'" . java-mode) ("\\.m\\'" . objc-mode) ("\\.ii\\'" . c++-mode) ("\\.i\\'" . c-mode) ("\\.lex\\'" . c-mode) ("\\.y\\(acc\\)?\\'" . c-mode) ("\\.h\\'" . c-or-c++-mode) ("\\.c\\'" . c-mode) ("\\.\\(CC?\\|HH?\\)\\'" . c++-mode) ("\\.[ch]\\(pp\\|xx\\|\\+\\+\\)\\'" . c++-mode) ("\\.\\(cc\\|hh\\)\\'" . c++-mode) ("\\.\\(bat\\|cmd\\)\\'" . bat-mode) ("\\.[sx]?html?\\(\\.[a-zA-Z_]+\\)?\\'" . mhtml-mode) ...) nil nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer test.ml> "~/projects/cs3110/unit-testing/test.ml" nil nil "~/projects/cs3110/unit-testing/test.ml" (1021339 44))
find-file-noselect("~/projects/cs3110/unit-testing/test.ml" nil nil nil)
find-file("~/projects/cs3110/unit-testing/test.ml")
recentf-open-most-recent-file(2)
recentf-open-most-recent-file-2()
funcall-interactively(recentf-open-most-recent-file-2)
command-execute(recentf-open-most-recent-file-2)
My config (matches official suggestion):
Note: I’m using straight.el configured such that :ensure t isn’t necessary.
(use-package tuareg
:mode (("\\.ocamlinit\\'" . tuareg-mode)))
(use-package ocaml-eglot
:after tuareg
:hook
(tuareg-mode . ocaml-eglot)
(ocaml-eglot . eglot-ensure))