From f4298b02be9d3af8d27bba67dc129b9a1014fc55 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Mon, 13 Feb 2023 21:10:35 -0800 Subject: [PATCH] Add a make install target, and instructions for Emacs. Might be nice to be able to run make install as this is pretty standard. For people who don't like sudo, they can set $PREFIX to a user-writable location of their choice. --- Makefile | 9 ++++++++- README.md | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4edeb02..96401d8 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,11 @@ EXE=fennel-ls SRC=$(wildcard src/*.fnl) SRC+=$(wildcard src/fennel-ls/*.fnl) -.PHONY: clean test +DESTDIR ?= +PREFIX ?= /usr/local +BIN_DIR ?= $(PREFIX)/bin + +.PHONY: clean test install all: $(EXE) @@ -20,3 +24,6 @@ clean: test: # requires busted to be installed FENNEL_PATH="./src/?.fnl;./src/?/init.fnl" $(FENNEL) --correlate test/init.fnl --verbose + +install: $(EXE) + mkdir -p $(DESTDIR)$(BIN_DIR) && cp $< $(DESTDIR)$(BIN_DIR)/ diff --git a/README.md b/README.md index 3a16722..c22fbb2 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,8 @@ You can match my environment to develop with the following steps. 1. Build the binary ```sh -make +make && sudo make install # to install into /usr/local/bin +make install PREFIX=$HOME # if you have ~/bin on your $PATH ``` 2. Configure your editor to use this language server @@ -117,6 +118,13 @@ lspconfig["fennel-ls"].setup( ) ``` +For Emacs, (eglot, built-in to 29+) put this in your config: + +```lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs '(fennel-mode . ("fennel-ls")))) +``` + It should be possible to set up for other clients, but I haven't looked into these steps. If you get it working in any other environments, I'd love to know! It would be great to have instructions on how to set up other editors! ## Caveats