# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# Pull in useful environment values now (we do this in PROMPT_COMMAND as
# well below, but this ensures we do it at least once for
# non-interactive shells) 
for f in ~/.env.d/*; do source "$f"; done

# If not running interactively, don't do anything else
[ -z "$PS1" ] && return

# Let quilt merge failed patches instead of just rejecting
export QUILT_PATCH_OPTS=--merge

# Use the dutch monetary locale, to get € signs in gnucash
export LC_MONETARY=nl_NL.UTF-8
# Use the dutch paper local, to get A4 by default
export LC_PAPER=nl_NL.UTF-8

#export PYTHONPATH="$HOME/docs/src/django/libs:$HOME/docs/src/upstream/pys60-compat"

export EMAIL="matthijs@stdin.nl"
export GIT_COMMITTER_EMAIL=$EMAIL
export GIT_AUTHOR_EMAIL=$EMAIL

#export JAVA_ROOT=~/docs/java
#export JAVA_BIN="$JAVA_ROOT/bin"
#export JAVA_SRC="$JAVA_ROOT/src"
#export JAVA_DOC="$JAVA_ROOT/doc"

#export JARDIRS="/usr/share/java $JAVA_BIN"
#export JARDIRS="$JAVA_BIN /usr/share/java /usr/lib/java $HOME/src/FullSync/lib"
#export JARS=
#for dir in $JARDIRS; do
#  for file in $dir/*.jar; do
#    export JARS=$JARS:$file;
#  done;
#done;
#export CLASSPATH=$JAVA_BIN:$JARS
#export JAVAC="javac -d $JAVA_BIN -sourcepath $JAVA_SRC"

#alias javac=$JAVAC
#alias javadoc="javadoc -tag invariant:f:\"Invariant:\" -tag require:cm:\"Requires:\" -tag ensure:cm:\"Ensures:\" -sourcepath \"$JAVA_SRC\" -d \"$JAVA_DOC/doc\""

# Required for swt in java
#export LD_LIBRARY_PATH=/usr/lib/jni # HACK: For some reason adding this to ld.so.conf does not work properly

# Required to run questasim
#export LM_LICENSE_FILE=/usr/local/questasim/license.dat

export EDITOR=vim

# Quilt for Debian patches
alias dquilt="QUILT_PATCHES=debian/patches quilt"

# Limit traffic
alias limit='trickle -s -d 400 -t .1 -w 1024  -u 40'

#alias fixgpg='source ~/.keychain/`hostname`-sh-gpg'
#alias gpg='fixgpg;gpg'

# Grep without binary files, .svn dirs, (doxygen) generated docs or dirs
# created by quilt.
alias svngrep='grep --exclude-dir .svn --exclude-dir generated-docs --exclude-dir .pc --exclude-dir patches -I'
alias gitgrep='grep --exclude-dir .git -I'

# don't put duplicate lines in the history. See bash(1) for more options
#export HISTCONTROL=ignoredups

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
fi

if [ -f /etc/debian_chroot ]; then
	export debian_chroot=$(cat /etc/debian_chroot)
fi

# Source some variables at every prompt. This is to make stuff like
# ssh agent, dbus, etc. working in long-running shells (e.g., inside
# screen).
PROMPT_COMMAND='for f in ~/.env.d/*; do source "$f"; done'

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*|screen)
    PROMPT_COMMAND+=';echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
    ;;
*)
    ;;
esac

# Allow gpg commands to query for a passphrase
export GPG_TTY=$(tty)
