Skip to content

Commit

Permalink
Set properly standard emacs package
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Hondet committed Apr 23, 2024
1 parent 37c5b9c commit 7876c14
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 62 deletions.
3 changes: 1 addition & 2 deletions editors/emacs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.elc
dist/
.cask/
*.tar
68 changes: 28 additions & 40 deletions editors/emacs/Makefile
Original file line number Diff line number Diff line change
@@ -1,52 +1,40 @@
VERSION = 1.0
.POSIX:

CASK =
EMACS = emacs
INSTALL = install

INSTALL_DIR = $(shell opam config var share)/emacs/site-lisp
CURDIR = $(shell pwd)

SRC = $(wildcard *.el)
BUILD_FILES =
VERSION = 1.1.0
NAME = lambdapi

# If not using Cask, build only the site file
ifndef CASK
BUILD_FILES += lambdapi-site-file.elc
endif

.PHONY: build
build: $(SRC)
ifdef CASK
$(CASK) build
else
$(MAKE) $(BUILD_FILES)
endif
EMACS = emacs

.SUFFIXES = .elc .el
.el.elc:
$(EMACS) --batch --eval "(add-to-list 'load-path \"$(CURDIR)\")" \
--eval '(byte-compile-file "$<")'
SRC =
SRC += lambdapi-abbrev.el
SRC += lambdapi-capf.el
SRC += lambdapi-input.el
SRC += lambdapi-layout.el
SRC += lambdapi-mode.el
SRC += lambdapi-pkg.el
SRC += lambdapi-proofs.el
SRC += lambdapi-smie.el
SRC += lambdapi-vars.el

$(NAME)-$(VERSION).tar: $(SRC)
mkdir -p "$(NAME)-$(VERSION)"
cp *.el "$(NAME)-$(VERSION)"
tar --create --file "$(NAME)-$(VERSION)".tar "$(NAME)-$(VERSION)"
rm -r "$(NAME)-$(VERSION)"

.PHONY: install
install: $(SRC) lambdapi-site-file.elc
$(INSTALL) -m 644 -t $(INSTALL_DIR) $^
$(MAKE) clean
install: $(NAME)-$(VERSION).tar
@echo "To install the mode in emacs, use"
@echo "> M-x package-install-file RET $(NAME)-$(VERSION).tar RET"

.PHONY: dist
dist:
ifdef CASK
$(CASK) package
endif
dist: $(NAME)-$(VERSION).tar

.PHONY: test
tests: dist
.PHONY: check
check: dist
./test.sh $(VERSION)

.PHONY: clean
clean:
ifdef CASK
$(CASK) clean-elc
else
find . -name '*.elc' -exec rm -f {} \;
endif
rm -rf "$(NAME)-$(VERSION)"
rm -f "$(NAME)-$(VERSION)".tar
4 changes: 2 additions & 2 deletions editors/emacs/lambdapi-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

;; Authors: Ashish Barnawal, Diego Riviero, Gabriel Hondet, Rodolphe Lepigre
;; Maintainer: Deducteam <[email protected]>
;; Version: 1.0
;; Version: 1.1.0
;; SPDX-License-Identifier: CECILL-2.1
;; Homepage: https://github.com/Deducteam/lambdapi
;; Keywords: languages
;; Compatibility: GNU Emacs 26.1
;; Package-Requires: ((emacs "26.1") (eglot "1.5") (math-symbol-lists "1.2.1") (highlight "20190710.1527"))
;; Package-Requires: ((emacs "26.1") (eglot "1.8") (math-symbol-lists "1.2.1") (highlight "20190710.1527"))

;;; Commentary:

Expand Down
30 changes: 30 additions & 0 deletions editors/emacs/lambdapi-pkg.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
;;; lambdapi-pkg.el --- A major mode to edit Lambdapi files -*- lexical-binding: t; -*-
;;
;; Copyright (C) 2024 Gabriel Hondet
;;
;; Authors: Ashish Barnawal, Diego Riviero, Gabriel Hondet, Rodolphe Lepigre
;; Maintainer: Deducteam <[email protected]>
;; Created: April 23, 2024
;; Modified: April 23, 2024
;; Version: 1.1.0
;; Keywords: languages
;; SPDX-License-Identifier: CECILL-2.1
;; Homepage: https://github.com/Deducteam/lambdapi
;; Package-Requires: ((emacs "26.1") (eglot "1.8") (math-symbol-lists "1.2.1") (highlight "20190710.1527"))
;;
;; This file is not part of GNU Emacs.
;;
;;; Commentary:
;;
;; A major mode for the Lambdapi proof assistant.
;;
;;; Code:

(define-package "lambdapi" "1.1.0"
"A major mode to edit Lambdapi files."
'((eglot "1.8")
(math-symbol-lists "1.2.1")
(highlight "20190710.1527")))

(provide 'lambdapi-pkg)
;;; lambdapi-pkg.el ends here
16 changes: 0 additions & 16 deletions editors/emacs/lambdapi-site-file.el

This file was deleted.

6 changes: 4 additions & 2 deletions editors/emacs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
## Takes the version of the mode as first argument
set -eu
tmp="$(mktemp -d)"
cp "dist/lambdapi-mode-$1.tar" "${tmp}"
make dist
cp "lambdapi-$1.tar" "${tmp}"
(cd "${tmp}" || exit 1
curl https://sanemacs.com/sanemacs.el > sanemacs.el
{
echo '(setq package-check-signature nil)';
echo '(use-package eglot)';
echo '(use-package math-symbol-lists)';
echo '(use-package highlight)';
} >> sanemacs.el
emacs --quick -l sanemacs.el \
--eval "(package-install-file \"lambdapi-mode-$1.tar\")")
--eval "(package-install-file \"lambdapi-$1.tar\")")
rm -rf "${tmp}"

0 comments on commit 7876c14

Please sign in to comment.