#!/bin/bash -e
#
# Update AucTeX auto-loads.
# Installed by the Debian auctex package.
# $Id: update-auctex-elisp.in,v 1.5 2000/01/20 14:33:49 salve Exp $
#
# Copyright  Davide G. M. Salvetti <salve@debian.org>, 1997, 1998, 1999.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to: The Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
#
# On Debian GNU/Linux System you can find a copy of the GNU General Public
# License in "/usr/share/common-licenses/GPL".

set -o posix

for FLAVOR in emacs19 emacs20; do
    if [ -x /usr/bin/$FLAVOR ]; then
	$FLAVOR --no-site-file --no-init-file --batch \
	        --load=/usr/share/emacs/site-lisp/tex-site.el \
                --funcall=TeX-auto-generate-global
    fi
done

if [ -x /usr/bin/mule2 ]; then
    mule2 --no-site-file --no-init-file --batch \
	  --load=/usr/share/emacs/site-lisp/tex-site.el \
          --eval '(set-file-coding-system-for-read *iso-2022-int-1*)' \
          --funcall=TeX-auto-generate-global
fi

rm -f $(find /var/lib/auctex/ -type f -name \*.el)
