+ Add basic format functions and script.

Usage:
      cd $mapnik_source/utils/format_source_files
      ./format_source_files.sh
  (TODO: just a starting point to remove tabs,
  needs some more work)
This commit is contained in:
Artem Pavlenko 2010-06-02 11:03:39 +00:00
parent 246731874b
commit 0f597b2809
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,14 @@
#!/bin/bash
# batch format *.{hpp,cpp} files
MAPNIK_DIR="/Users/artem/projects/mapnik"
DIRS="$MAPNIK_DIR/src $MAPNIK_DIR/include $MAPNIK_DIR/bindings $MAPNIK_DIR/utils"
EMACS="emacs"
for file in $(find $DIRS -name '*.cpp' -o -name '*.hpp')
do
$EMACS -batch $file -l $MAPNIK_DIR/utils/format_source_files/mapnik_format.el -f mapnik-format-function
done

View file

@ -0,0 +1,12 @@
(defun mapnik-format-function ()
"Format buffer according to mapnik style (TODO)"
(c-set-style "bsd")
(c-set-offset 'innamespace 0)
(c-set-offset 'template-args-cont 'c-lineup-template-args)
(setq c-basic-offset 4)
(indent-region (point-min) (point-max) nil)
(untabify (point-min) (point-max))
(save-buffer)
)