mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
28 lines
822 B
Bash
Executable File
28 lines
822 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# To indent and remove tabs, surround the piece of code with:
|
|
# %% @indent-begin
|
|
# %% @indent-end
|
|
#
|
|
# Then run:
|
|
# make indent
|
|
#
|
|
# Please note this script only indents the first occurrence.
|
|
|
|
FILES=$(git grep --name-only @indent-begin src/)
|
|
|
|
for FILENAME in $FILES; do
|
|
echo "==> Indenting $FILENAME..."
|
|
emacs -batch $FILENAME \
|
|
-f "erlang-mode" \
|
|
--eval "(goto-char (point-min))" \
|
|
--eval "(re-search-forward \"@indent-begin\" nil t)" \
|
|
--eval "(setq begin (line-beginning-position))" \
|
|
--eval "(re-search-forward \"@indent-end\" nil t)" \
|
|
--eval "(setq end (line-beginning-position))" \
|
|
--eval "(erlang-indent-region begin end)" \
|
|
--eval "(untabify begin end)" \
|
|
-f "delete-trailing-whitespace" \
|
|
-f "save-buffer"
|
|
done
|