#!/bin/bash -e
#
# Update AUCTeX auto-loads.
# Installed by the Debian auctex package.
# $Id: update-auctex-elisp.in,v 1.12 2004/05/18 14:05:52 salve Exp $
#
# Copyright (C) 1997, 98, 99, 2000, 01, 02, 03, 04 by Davide Giovanni
# Maria Salvetti.
#
# 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

FLAVORS=${*:-"emacs21 emacs-snapshot"}

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

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