>From ac6f1d111e8a3bb3acaa99090ff25dde10e2de02 Mon Sep 17 00:00:00 2001 From: Morgan Smith Date: Mon, 4 Dec 2023 09:09:40 -0500 Subject: [PATCH 1/5] scripts: Add lint script --- TODO | 2 +- emacsy/emacsy.h | 4 ++++ scripts/lint.sh | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100755 scripts/lint.sh diff --git a/TODO b/TODO index 5a449f7..5238097 100644 --- a/TODO +++ b/TODO @@ -9,7 +9,7 @@ source code and separate texinfo documentation. This setup is now functional and needs lots of work and cleaning up. * Cleanup examples -Run GNU indent, use struct_ref etc (see Guimax) instead of `wud*2'. +use struct_ref etc (see Guimax) instead of `wud*2'. Also see guimax branch @ https://gitlab.com/janneke/emacsy-webkit-gtk * Self-doc/help system diff --git a/emacsy/emacsy.h b/emacsy/emacsy.h index f8b0a12..908616e 100644 --- a/emacsy/emacsy.h +++ b/emacsy/emacsy.h @@ -23,9 +23,11 @@ #ifndef __EMACSY_H #define __EMACSY_H 1 +/* *INDENT-OFF* */ #ifdef __cplusplus extern "C" { #endif +/* *INDENT-ON* */ #include @@ -112,8 +114,10 @@ SCM scm_c_string_to_symbol (char const* str); /* Ref @var{name} from emacsy module. */ SCM scm_c_emacsy_ref (char const* name); +/* *INDENT-OFF* */ #ifdef __cplusplus } #endif +/* *INDENT-ON* */ #endif // __EMACSY_H diff --git a/scripts/lint.sh b/scripts/lint.sh new file mode 100755 index 0000000..4176c23 --- /dev/null +++ b/scripts/lint.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Time-stamp: <2023-12-04 Mon 09:15> +# Copyright (C) 2023 by Morgan Smith + +top_srcdir=$(dirname "$0")/.. + +c_source=$(find "$top_srcdir" -name "*.[ch]") +scm_source=$(find "$top_srcdir" -name "*.scm") + +# eliminate trailing whitespace +sed --in-place 's/[[:space:]]\+$//' $c_source $scm_source + +# replace tabs with 2 spaces +sed --in-place 's/\t/ /' $c_source $scm_source + +# run indent +indent --no-tabs --indent-level2 $c_source -- 2.41.0