-#!/bin/bash
+#!/usr/bin/env bash
### run-codespell - run codespell on Emacs
## Copyright (C) 2023-2025 Free Software Foundation, Inc.
emacs_run_codespell ()
{
git ls-files |\
- grep -v -E -e '^(lib|m4)/.*' |\
- grep -v -E -e '^admin/(charsets|codespell|unidata)/.*' |\
- grep -v -E -e '^doc/lispref/spellfile$' |\
- grep -v -E -e '^doc/misc/texinfo.tex$' |\
- grep -v -E -e '^doc/translations/.*' |\
- grep -v -E -e '^etc/(AUTHORS|HELLO|publicsuffix.txt)$' |\
- grep -v -E -e '^etc/refcards/(cs|de|fr|pl|pt|sk)-.+.tex$' |\
- grep -v -E -e '^etc/tutorials/TUTORIAL\..+' |\
- grep -v -E -e '^leim/(MISC|SKK)-DIC/.*' |\
- grep -v -E -e '^lisp/language/ethio-util.el' |\
- grep -v -E -e '^lisp/ldefs-boot.el' |\
- grep -v -E -e '^lisp/leim/.*' |\
- grep -v -E -e '^test/lisp/erc/resources/.*' |\
- grep -v -E -e '^test/lisp/net/puny-resources/IdnaTestV2.txt' |\
- grep -v -E -e '^test/manual/(etags|indent)/.*' |\
- grep -v -E -e '^test/src/regex-resources/.*' |\
+ grep --line-buffered -v -E -e "^(lib|m4)/.*|\
+^admin/(charsets|codespell|unidata)/.*|\
+^doc/lispref/spellfile$|\
+^doc/misc/texinfo.tex$|\
+^doc/translations/.*|\
+^etc/(AUTHORS|HELLO|publicsuffix.txt)$|\
+^etc/refcards/(cs|de|fr|pl|pt|sk)-.+.tex$|\
+^etc/tutorials/TUTORIAL\..+|\
+^leim/(MISC|SKK)-DIC/.*|\
+^lisp/language/ethio-util.el|\
+^lisp/ldefs-boot.el|\
+^lisp/leim/.*|\
+^test/lisp/erc/resources/.*|\
+^test/lisp/net/puny-resources/IdnaTestV2.txt|\
+^test/manual/(etags|indent)/.*|\
+^test/src/regex-resources/.*" |\
xargs codespell \
--config "$CODESPELL_RC" \
--exclude-file "$CODESPELL_EXCLUDE" \