diff --git a/editors/emacs/.gitignore b/editors/emacs/.gitignore index f050d1f9c..ef8cdbb02 100644 --- a/editors/emacs/.gitignore +++ b/editors/emacs/.gitignore @@ -1,3 +1,2 @@ *.elc -dist/ -.cask/ +*.tar diff --git a/editors/emacs/Makefile b/editors/emacs/Makefile index 14565e0a7..6c4d8534b 100644 --- a/editors/emacs/Makefile +++ b/editors/emacs/Makefile @@ -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 diff --git a/editors/emacs/lambdapi-mode.el b/editors/emacs/lambdapi-mode.el index c9bd8c150..da165e217 100644 --- a/editors/emacs/lambdapi-mode.el +++ b/editors/emacs/lambdapi-mode.el @@ -4,12 +4,12 @@ ;; Authors: Ashish Barnawal, Diego Riviero, Gabriel Hondet, Rodolphe Lepigre ;; Maintainer: Deducteam -;; 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: diff --git a/editors/emacs/lambdapi-pkg.el b/editors/emacs/lambdapi-pkg.el new file mode 100644 index 000000000..557cc0be0 --- /dev/null +++ b/editors/emacs/lambdapi-pkg.el @@ -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 +;; 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 diff --git a/editors/emacs/lambdapi-site-file.el b/editors/emacs/lambdapi-site-file.el deleted file mode 100644 index e614cd3fe..000000000 --- a/editors/emacs/lambdapi-site-file.el +++ /dev/null @@ -1,16 +0,0 @@ -;; -*- lexical-binding: t; -*- -;; -;; Serves as site-file.el, that is, if `lambdapi-mode' is not installed through -;; melpa, this file should be loaded explicitly to replace the autoloads. -;; - -(autoload 'lambdapi-legacy-mode "lambdapi-mode" - "A mode for editing LambdaPi files (in legacy syntax)." t nil) -(add-to-list 'auto-mode-alist '("\\.dk\\'" . lambdapi-legacy-mode)) - -(autoload 'lambdapi-mode "lambdapi-mode" - "A mode for editing LambdaPi files." t nil) -(add-to-list 'auto-mode-alist '("\\.lp\\'" . lambdapi-mode)) - -(autoload 'lambdapi-completion-at-point "lambdapi-capf" - "Completion of symbol at point for lambdapi." t nil) diff --git a/editors/emacs/test.sh b/editors/emacs/test.sh index e27c943aa..dd3fb5a4b 100755 --- a/editors/emacs/test.sh +++ b/editors/emacs/test.sh @@ -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}"