forked from alex-eg/sex
emacs: load the server beside sex-mode
This commit is contained in:
41
Readme.org
41
Readme.org
@@ -123,6 +123,23 @@ Alex
|
||||
Hello, Alex!
|
||||
#+end_src
|
||||
|
||||
* Editor
|
||||
[[file:sex-mode.el][sex-mode.el]] is the editing mode, [[file:sex-lsp.el][sex-lsp.el]] is the language-server client.
|
||||
The install form under "sex-mode.el" below fetches both, and its ~:config~
|
||||
line loads the client.
|
||||
|
||||
With that line, either client starts ~sex-lsp~. The hook is
|
||||
~eglot-ensure~ or ~lsp-deferred~. Eldoc, xref,
|
||||
and diagnostics are the ordinary LSP ones. ~sexpand~, ~sexpand-defun~,
|
||||
~sexpand-region~, and ~sexpand-buffer~ show the generated C in a C
|
||||
buffer. Without a server they call ~sexc --expand-lines~.
|
||||
|
||||
~sex-c-backend~ set to ~clangd~, as that form does, asks the server for
|
||||
C headers too: completion, prototypes, and definitions of names Sex
|
||||
itself does not declare. Flags are a one-line ~sex-cflags~ file, or
|
||||
~sex-cflags~ in Emacs, the same words that go after ~sexc~'s ~--~.
|
||||
Leave out ~:custom~, ~:hook~, and ~:config~ for the editing mode alone.
|
||||
|
||||
* Features
|
||||
** Full C interoperability
|
||||
Just ~(include "Your/Favourite/Library.h")~ and use it as you would
|
||||
@@ -319,13 +336,21 @@ To harness the power of sex-mode, add the following lines to your
|
||||
~$HOME/.config/emacs/init.el~:
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package sex-mode
|
||||
:ensure nil
|
||||
:quelpa
|
||||
(sex-mode :fetcher git
|
||||
:url "https://git.kotobank.ch/alex-eg/sex.git"
|
||||
:files ("sex-mode.el")
|
||||
:upgrade t))
|
||||
(use-package sex-mode
|
||||
:ensure nil
|
||||
:quelpa
|
||||
(sex-mode :fetcher git
|
||||
:url "https://git.kotobank.ch/alex-eg/sex.git"
|
||||
:files ("sex-mode.el" "sex-lsp.el")
|
||||
:upgrade t)
|
||||
:custom (sex-c-backend 'clangd)
|
||||
:hook (sex-mode . eglot-ensure) ; if you use eglot
|
||||
:hook (sex-mode . lsp-deferred) ; if you use lsp-mode
|
||||
:config (require 'sex-lsp))
|
||||
#+end_src
|
||||
|
||||
~.sex~ files then open in ~sex-mode~.
|
||||
~.sex~ files then open in ~sex-mode~. The ~:config~ line loads the
|
||||
client and registers it with whichever of eglot and lsp-mode is
|
||||
installed. The hook is what starts one of them: ~lsp-deferred~ or
|
||||
~eglot-ensure~. Without ~:custom~, ~:hook~, and ~:config~, only the
|
||||
editing mode is loaded.
|
||||
|
||||
Reference in New Issue
Block a user