Permalink
Browse files

Modified emacs-format.sh script so that it does not need to be run

from the root of the source tree. It does mean bash is required
though.

We should probably just use clang-format instead of this script...
  • Loading branch information...
delcypher committed Jan 30, 2014
1 parent bdc13b6 commit 1d89673988c7d86fc3bca1d0ab9a7497366bab04
Showing with 3 additions and 3 deletions.
  1. +3 −3 scripts/emacs-format.sh
View
@@ -1,11 +1,11 @@
-#!/bin/sh
+#!/usr/bin/env bash
# File: my-indent Opens a set of files in emacs and executes the
# emacs-format-function. Assumes the function named
# emacs-format-function is defined in the file named
# emacs-format-file.
-loadpath=`pwd`
+loadpath=$(cd "${BASH_SOURCE[0]%/*}"; pwd)
if [ $# = 0 ]
then
echo "my-indent requires at least one argument." 1>&2
@@ -29,7 +29,7 @@ do
exit 1
fi
echo "Indenting $1 with emacs in batch mode"
- emacs -batch $1 -l $loadpath/scripts/emacs-format-file -f emacs-format-function
+ emacs -batch $1 -l $loadpath/emacs-format-file -f emacs-format-function
echo
shift 1
done

0 comments on commit 1d89673

Please sign in to comment.