I've recently started to look into the Blazor framework and noticed there is no available major-mode for editing .razor files, which are essentially a mix of C# and HTML. I then started creating a simple package using polymode for this purpose. I'm trying to follow these directions

The issue I'm having is that I can't install my code as package. On the other hand, if I paste the definitions into my config file everything works as expected.

Does anyone have a clue of what my problem may be?


  • EMACS VERSION: GNU Emacs 28.1 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-06-07
  • Doom core v3.0.0-dev HEAD -> master 33c5f3721 2022-07-09 21:10:40 +0200
  • Doom modules v22.07.0-dev HEAD -> master 33c5f3721 2022-07-09 21:10:40 +0200
  • I'm trying to install the package using the following function call: (package! blazor-mode :recipe (:local-repo "~/blazor-mode"))
  • Did you used the command doom sync from terminal to install? what errors do you have?
    – Ian
    Jul 23, 2022 at 7:57
  • Yes, I've used doom sync (also tried with the -u flag, which updates the packages as well). I can see it interacts with my files (both local and from my github repo) and there are no errors. However, when I open up a .razor file, the syntax highlighting doesn't work and the blazor-mode function is not there. The doom doctor command also doesn't appear to spot any problems with my code Jul 25, 2022 at 13:49
  • Did you added a simple line (use-package blazor-mode) to your ~/.doom.d/config file?
    – Ian
    Jul 26, 2022 at 12:30

1 Answer 1


package! can install a package from a local folder:

(package! package-name :recipe
  (:local-repo "~/path/to/code"))

Regardless, web-mode already supports .razor files! Have you tried enabling the web module?

If the web module doesn't cover razor files, try this snippet to let web-mode handle .razor files:

(add-to-list 'web-mode-engines-alist '("razor" . "\\.razor\\'"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.