Skip to content

Commit

Permalink
Merge pull request #50 from ndegruchy/main
Browse files Browse the repository at this point in the history
Add Emacs configuration
  • Loading branch information
kristoff-it authored Oct 25, 2024
2 parents 3325bbb + 87452a6 commit e561df3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions editors/emacs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Adding SuperHTML to Emacs via Eglot

With `eglot` being included with the core Emacs distribution since
version 29, you can add various language servers, including SuperHTML,
to Emacs fairly simply. Just ensure that `superhtml` is somewhere in
your `$PATH` and you should be able to use one of the forms below with
minimal modification.

## With `use-package`

```elisp
(use-package eglot
:defer t
:hook ((web-mode . eglot-ensure)
;; Add more modes as needed
)
:config
;; ...
(add-to-list 'eglot-server-programs '((web-mode :language-id "html") . ("superhtml" "lsp"))))
```

## Without `use-package`

```elisp
(require 'eglot)
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
`((web-mode :language-id "html") . ("superhtml" "lsp"))))
```

You can modify the `superhtml` path here as well. If you're not using
`web-mode` then you'll also want to substitute your preferred
mode. The `:language-id` property ensures that HTML is the
content-type passed to the language server, as `eglot` will send the
mode name (minus `-mode`) by default.

0 comments on commit e561df3

Please sign in to comment.