branch: elpa/vm
commit c9e71137b11bd188b77a15b559452d21c169766a
Author: Mark Diekhans <[email protected]>
Commit: Mark Diekhans <[email protected]>

    Add make targets for various elisp linting tools. Only package-lint is 
currently useful
---
 Makefile.in            | 65 +++++++++++++++++++++++++++++++++++++++++---------
 dev/docs/dev-guide.org | 22 +++++++++++++++++
 dev/docs/releasing.org | 18 ++++++++++++--
 lisp/vm.el             |  4 ++--
 4 files changed, 94 insertions(+), 15 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 987d02eb623..f85d73dc8b5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -9,6 +9,7 @@ XARGS = @XARGS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+EMACS_PROG = @EMACS_PROG@
 
 prefix = @prefix@
 srcdir = @srcdir@
@@ -66,10 +67,58 @@ distclean:
        -$(RM) -f Makefile vm-load.el config.status config.log
        -$(RM) -rf autom4te.cache
 
-push:
-       $(BZR) push
+##############################################################################
+# linting
+#
+PACKAGE_INIT = --eval "(progn (require 'package) (package-initialize))"
+
+# byte compile check
+byte-compile-lint:
+       rm -f list/*.elc
+       $(EMACS_PROG) -batch -Q -L lisp \
+           --eval '(setq byte-compile-error-on-warn t)' \
+           -f batch-byte-compile lisp/*.el
+
+# native compile check
+native-compile-lint:
+       rm -rf eln.tmp
+       @mkdir -p eln.tmp
+       $(EMACS_PROG) -batch -Q -L lisp \
+           --eval '(setq native-comp-async-report-warnings-errors nil)' \
+           --eval '(setq byte-compile-error-on-warn nil)' \
+           --eval '(dolist (f (directory-files "lisp" t "\\.el$$")) (let ((out 
(concat "eln.tmp/" (file-name-nondirectory f) ".eln"))) (message "Native 
compiling %s..." f) (native-compile f out)))'
+       rm -rf eln.tmp
+
+# check with build-in elint
+elint-lint:
+       $(EMACS_PROG) -batch -Q -l `pwd`/lisp \
+           --eval '(mapc (lambda (f) (message "Checking %s" f) (elint-file f)) 
\
+                         (directory-files "lisp" t "\\.el$$"))'
+
+# check package file with external package-lint
+package-lint:
+       $(EMACS_PROG) -batch -L lisp $(PACKAGE_INIT) \
+           --eval "(require 'package-lint)" \
+           -f package-lint-batch-and-exit lisp/vm.el
+
+# check reqular expressions with external relint
+relint-lint:
+       $(EMACS_PROG) -batch -L lisp $(PACKAGE_INIT) \
+           --eval "(require 'relint)" \
+           -f relint-batch lisp/*.el
+
+
+# check with external elisp-lint
+ELINT_CONFIG = --eval '(setq-default fill-column 80)'
+elisp-lint:
+       $(EMACS_PROG) -batch -L `pwd`/lisp $(PACKAGE_INIT) $(ELINT_CONFIG) \
+           --eval "(require 'elisp-lint)" \
+           -f elisp-lint-files-batch `pwd`/lisp/*.el
+
+.PHONY: byte-compile-lint native-compile-lint elint package-lint relint-lint 
elisp-lint
 
 ##############################################################################
+# xemacs package (not tested)
 PKGDIR =  $(shell pwd)/,,package/
 PKGINFO = $(PKGDIR)/lisp/vm/_pkg.el
 xemacs-package:
@@ -79,9 +128,9 @@ xemacs-package:
          exit 1; \
        fi
        -$(RM) -rf ,,package
-       cd lisp && $(make) PACKAGEDIR=$(PKGDIR)/lisp/vm install-pkg
-       cd info && $(make) infodir=$(PKGDIR)/info install-pkg
-       cd src && $(make) infodir=$(PKGDIR)/bin install-pkg
+       cd lisp && $(MAKE) PACKAGEDIR=$(PKGDIR)/lisp/vm install-pkg
+       cd info && $(MAKE) infodir=$(PKGDIR)/info install-pkg
+       cd src && $(MAKE) infodir=$(PKGDIR)/bin install-pkg
        echo ";;;###autoload" > $(PKGINFO)
        echo "(package-provide 'vm'" > $(PKGINFO)
        echo "         :version $(PACKAGE_VERSION)" >> $(PKGINFO)
@@ -93,12 +142,6 @@ xemacs-package:
        cd ,,package; $(TAR) -cvzf ../vm-pkg.tar.gz *
 
 ##############################################################################
-release::
-       ./release.sh
-
-snapshot::
-       ./release.sh snapshot
-
 tags::
        etags lisp/*.el contrib/*.el info/*.texinfo NEWS example.vm INSTALL 
Makefile.in lisp/Makefile.in info/Makefile.in src/Makefile.in 
pixmaps/Makefile.in
 
diff --git a/dev/docs/dev-guide.org b/dev/docs/dev-guide.org
new file mode 100644
index 00000000000..abde2dcce8d
--- /dev/null
+++ b/dev/docs/dev-guide.org
@@ -0,0 +1,22 @@
+
+* code linting
+** byte and native compile check
+make byte-compile-lint
+make native-compile-lint
+
+** package-lint of vm.el (external package-lint)
+make package-lint
+
+** regular expresion lint (external relint)
+make relint-lint
+
+** elint
+make elint-lint
+*** This is current very broken:
+gets Lisp nesting exceeds `max-lisp-eval-depth': 1601
+
+
+** elisp-lint (external package elisp-lint)
+make elisp-lint
+*** lots of errors, many false positives.
+
diff --git a/dev/docs/releasing.org b/dev/docs/releasing.org
index f0ec2cf66cc..fcec7d979bf 100644
--- a/dev/docs/releasing.org
+++ b/dev/docs/releasing.org
@@ -1,6 +1,13 @@
 Releasing VM
 
-* release is done initial in fork
+* use package-lint to check vm.el packages
+requires package-lint
+  make package-lint
+or 
+  M-x package-lint-current-buffer
+note lint will not be clean, due to xemacs references
+
+* release is built initial in fork
 then merge to make official
 
 * version update
@@ -9,16 +16,23 @@ then merge to make official
 - version in configure.ac AC_INIT
 - lisp/vm.el Version:
   
-* last test
+* test build
 - make distclean
 - autoconf
 - configure
 - make
 
+* pre-release testing from repo:
+(package-vc-install 
+  '(vm :url "file:////Users/markd/projs/emacs/vm/vm-markd"
+       :lisp-dir "lisp"))
+
+
 * commit and tag
 - tag is in the form '3.0.0'
 - a branch are only made if changes are needed relative to a tag
 
+
 * pre-release testing from fork:
 (package-vc-install
   '(vm :url"https://gitlab.com/USER/vm.git";
diff --git a/lisp/vm.el b/lisp/vm.el
index d477d25b28a..9f20996d66f 100644
--- a/lisp/vm.el
+++ b/lisp/vm.el
@@ -1,4 +1,4 @@
-;;; vm.el --- VM mail reader -*- lexical-binding: t -*-
+;;; vm.el --- VM mail reader -*- lexical-binding: t; -*-
 ;;
 ;; This file is part of VM
 ;;
@@ -62,7 +62,7 @@
 (eval-when-compile (require 'cl-lib))
 (require 'package)
 
-;; keep vm-min-emacs-version in sync with above Package-Requires 
+;; keep vm-min-emacs-version in sync with above Package-Requires
 (defconst vm-min-emacs-version "28.1"
   "Minimum Emacs version supported by VM.")
 

Reply via email to