summaryrefslogtreecommitdiff
path: root/language/thai/thailatex/scripts/sync-thailatex.in
diff options
context:
space:
mode:
Diffstat (limited to 'language/thai/thailatex/scripts/sync-thailatex.in')
-rw-r--r--language/thai/thailatex/scripts/sync-thailatex.in46
1 files changed, 46 insertions, 0 deletions
diff --git a/language/thai/thailatex/scripts/sync-thailatex.in b/language/thai/thailatex/scripts/sync-thailatex.in
new file mode 100644
index 0000000000..d4ed85ee12
--- /dev/null
+++ b/language/thai/thailatex/scripts/sync-thailatex.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+# Register/unregister thailatex
+# Written by Theppitak Karoonboonyanan <thep@linux.thai.net>
+# License: GPL
+
+prefix=@prefix@
+
+EMACSLISPDIR=@emacsdir@/site-lisp
+
+do_install()
+{
+ echo "Regenerating TeX ls-R ..."
+ @TEXHASH@
+
+ # add Emacs macro for activating Thai LaTeX filter
+ echo "Installing emacs macro ..."
+ if test -f $EMACSLISPDIR/site-start.el; then
+ sed -i -e '/thai-latex-setup/d' $EMACSLISPDIR/site-start.el
+ fi
+ if test -f $EMACSLISPDIR/thai-latex-setup.el; then
+ echo '(load-library "thai-latex-setup")' >> $EMACSLISPDIR/site-start.el
+ fi
+}
+
+do_uninstall()
+{
+ echo "Regenerating TeX ls-R ..."
+ @TEXHASH@
+
+ # remove Emacs macro for activating Thai LaTeX filter
+ echo "Uninstalling emacs macro ..."
+ if test -f $EMACSLISPDIR/site-start.el; then
+ sed -i -e '/thai-latex-setup/d' $EMACSLISPDIR/site-start.el
+ fi
+}
+
+# Main script
+
+if test -f $EMACSLISPDIR/thai-latex-setup.el; then
+ echo "ThaiLaTeX macro exists, so we will enable it."
+ do_install
+else
+ echo "ThaLaTeX macro no longer exists, so we will disable it."
+ do_uninstall
+fi
+