Eldev is make
(and then some) for Emacs Lisp development.
curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/eldev | sh
The eldev
executable will be installed in ~/.local/bin
.
~/projects$ mkdir emacs-simple-calculator
~/projects$ cd emacs-simple-calculator
~/projects/emacs-simple-calculator$ git init
simple-calculator.el
:
;;; simple-calculator.el --- Simple Calculator -*- lexical-binding: t -*-
;; Copyright (C) 2022 Some One
;; Author: Some One <[email protected]>
;; URL: https://github.com/someone/emacs-simple-calculator
;; Version: 0.1.0
;; Package-Requires: ((emacs "27.1"))
;; Keywords: examples
;; This file is not part of GNU Emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; For a full copy of the GNU General Public License
;; see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; [This will contain a description of the package]
;;; Code:
(defun simple-calculator-add (a b)
(+ a b))
(provide 'simple-calculator)
;;; simple-calculator.el ends here
~/projects/emacs-simple-calculator$ eldev init --non-interactive
Created file ‘Eldev’ for this project
Modified file ‘.gitignore’
In the file Eldev
, uncomment the gnu-elpa
and melpa
sources:
; -*- mode: emacs-lisp; lexical-binding: t -*-
;; Uncomment some calls below as needed for your project.
(eldev-use-package-archive 'gnu-elpa)
;(eldev-use-package-archive 'nongnu-elpa)
(eldev-use-package-archive 'melpa)
simple-calculator-test.el
:
(require 'simple-calculator)
(require 'buttercup)
(describe "A calculator"
(it "adds two numbers"
(expect (simple-calculator-add 1 2) :to-be 3)))
~/projects/emacs-simple-calculator$ eldev test
Loading /home/user/projects/emacs-simple-calculator/simple-calculator.el (source)...
[1/1] Installing package ‘buttercup’ (1.28) from ‘melpa-stable’...
Running 1 specs.
A calculator
adds two numbers (0.05ms)
Ran 1 specs, 0 failed, in 0.10ms.
Using watchexec:
~/projects/emacs-simple-calculator$ watchexec eldev test
If you’re using FlyCheck with ELisp, a temporary file gets written to the current folder whenever flycheck runs, which cannot be moved to the system temporary directory. Prevent unnecessary test runs with:
~/projects/emacs-simple-calculator$ watchexec --ignore 'flycheck_*' eldev test