summaryrefslogtreecommitdiff
path: root/japanese/diclookup-emacs20/files/setup-diclookup.sh
blob: ecde9f684544cdc23e7a5c7e5318cfacb50b8335 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
/usr/bin/dialog --title "ja-diclookup setup" --clear \
	--yesno "\n\
You have to install appropreate startup code for diclookup-mule. \n\
This setup script automatically it to: \n\
PREFIX_DIR/share/mule/19.34/site-lisp/site-start.el. \n\n\
Are you sure?" -1 -1
RETVAL=$?
# RETVAL=0 for yes, 1 for no, 255 for ESC.

if [ "X${RETVAL}" = "X0" ] ; then # answer is `Yes'. hack diclookup-mule.

# Hack PREFIX_DIR/share/mule/19.34/site-lisp/site-start.el
rm -f /tmp/hack-site-start.el
echo "(defun hack-site-start ()" >> /tmp/hack-site-start.el
echo "  (interactive)" >> /tmp/hack-site-start.el
echo "  (message \"Updating site-start.el.  \")" >> /tmp/hack-site-start.el
echo "  (let* ((args command-line-args-left)" >> /tmp/hack-site-start.el
echo "	 (fname (expand-file-name (nth 0 args)))" >> /tmp/hack-site-start.el
echo "	 (dir (nth 1 args)))" >> /tmp/hack-site-start.el
echo "    (setq command-line-args-left (cdr (cdr command-line-args-left)))" >> /tmp/hack-site-start.el
echo "    (set-buffer (get-buffer-create \" *x*\"))" >> /tmp/hack-site-start.el
echo "    (erase-buffer)" >> /tmp/hack-site-start.el
echo "    (if (file-exists-p fname)" >> /tmp/hack-site-start.el
echo "	(insert-file-contents fname))" >> /tmp/hack-site-start.el
echo "    (goto-char (point-min))" >> /tmp/hack-site-start.el
echo "    (if (search-forward \";;; diclookup-mule: Online dictionary\" nil t)" >> /tmp/hack-site-start.el
echo "	(message \"No changes made.\")" >> /tmp/hack-site-start.el
echo "      (goto-char (point-max))" >> /tmp/hack-site-start.el
echo "      (insert \"\n;;; diclookup-mule: Online dictionary\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(autoload 'online-dictionary \\\"diclookup-mule\\\" \")" >> /tmp/hack-site-start.el
echo "      (insert \"\\\"Online dictionary.\\\" t nil)\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(autoload 'od:lookup-pattern-edit \\\"diclookup-mule\\\" \")" >> /tmp/hack-site-start.el
echo "      (insert \"\\\"Look up a word.\\\" t nil)\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-chujiten-flag t)	; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-dictfile-list '(\\\"od-chujiten\\\" \\\"od-kojien\\\" \\\"od-readers\\\" \\\"od-crown\\\")) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq dserver-server-list '(\\\"localhost\\\")) ; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(setq od-frame-geometry \\\"+0-0\\\" od-hide-frame \")" >> /tmp/hack-site-start.el
echo "      (insert \"'make-invisible) ; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(add-hook 'od-really-quit-hook 'od-delete-frame) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"(define-key-after menu-bar-file-menu [dictionary] \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (insert \"	'(\\\"Online Dictionary\\\" . online-dictionary) 'calendar) \")" >> /tmp/hack-site-start.el
echo "      (insert \"; diclookup-mule\n\")" >> /tmp/hack-site-start.el
echo "      (write-file fname))))" >> /tmp/hack-site-start.el

mule -batch -q -l /tmp/hack-site-start.el -f hack-site-start \
		PREFIX_DIR/share/mule/19.34/site-lisp/site-start.el ;
rm -f /tmp/hack-site-start.el

/usr/bin/dialog --title "ja-diclookup setup" --clear \
	--msgbox "\n\
original file is saved in PREFIX_DIR/share/mule/19.34/site-lisp/site-start.el.bak" -1 -1

else
/usr/bin/dialog --title "ja-diclookup setup" --clear \
	--msgbox "\n\
For setup, documents under PREFIX_DIR/lib/dserver will be helpful." -1 -1
fi