[PATCH] devel: two scripts for checking proposed changes

Subject: [PATCH] devel: two scripts for checking proposed changes

Date: Mon, 28 Jun 2021 11:08:10 -0300

To: notmuch@notmuchmail.org

Cc: David Bremner

From: David Bremner


It took me a bit of effort to get the correct oneliner to reindent
elisp from the command line, so I saved the results as
'reindent-elisp'.

'check-notmuch-commit' is an updated version of a script I have been
using (although not always as consistently as I should) before sending
patches to the list.

Although it requires a bit more tooling, encouraging people to use
check-notmuch-commit might reduce the number of round trips to the
list for style nitpicks.
---
 devel/check-notmuch-commit | 20 ++++++++++++++++++++
 devel/reindent-elisp       |  8 ++++++++
 2 files changed, 28 insertions(+)
 create mode 100755 devel/check-notmuch-commit
 create mode 100755 devel/reindent-elisp

diff --git a/devel/check-notmuch-commit b/devel/check-notmuch-commit
new file mode 100755
index 00000000..98a19a64
--- /dev/null
+++ b/devel/check-notmuch-commit
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Usage suggestion:
+#   git rebase -i --exec devel/check-notmuch-commit origin/master
+
+set -e
+make test
+for file in $(git diff --name-only HEAD^); do
+    case $file in
+	*.c|*.h|*.cc|*.hh)
+            uncrustify --replace -c $(dirname "$0")/uncrustify.cfg "$file"
+	    ;;
+	*.el)
+            $(dirname "$0")/reindent-elisp "$file"
+	    ;;
+    esac
+done
+
+git diff --quiet
+
diff --git a/devel/reindent-elisp b/devel/reindent-elisp
new file mode 100755
index 00000000..f6ce3844
--- /dev/null
+++ b/devel/reindent-elisp
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ $# -lt 1 ]; then
+    printf "usage: $0 <path.el>\n"
+    exit 1
+fi
+
+emacs -Q --batch $1 --eval '(indent-region (point-min) (point-max) nil)' -f save-buffer
-- 
2.30.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: