author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Sat, 28 Jan 2012 22:20:59 +0200 | |
changeset 860 | 934358ccdc16 |
parent 702 | 0617020b53d8 |
child 1238 | c9e507cde2b7 |
permissions | -rwxr-xr-x |
702
0617020b53d8
Fix shebang for FreeBSD.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
696
diff
changeset
|
1 |
#!/usr/bin/env bash |
386
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
|
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
if [ -z "$1" ]; then |
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
echo "Where config file?" |
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
exit 1 |
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
fi |
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
|
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
cfg=$1 |
3efe37437745
Explore environment for abilities and tup config in ~/.emacs-autogen.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
|
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
10 |
# Set host_os: |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
11 |
# windows, linux, unknown |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
12 |
# host_distro: |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
13 |
# cygwin, debian, unknown |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
14 |
check_platform() { |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
15 |
case `uname -s` in |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
16 |
CYGWIN_NT-*) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
17 |
host_os=windows |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
18 |
host_distro=cygwin |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
19 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
20 |
Linux) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
21 |
host_os=linux |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
22 |
if [ -e /etc/debian_version ]; then |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
23 |
host_distro=debian |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
24 |
else |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
25 |
host_distro=unknown |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
26 |
fi |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
27 |
;; |
622
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
28 |
Darwin) |
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
29 |
host_os=darwin |
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
30 |
;; |
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
31 |
*) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
32 |
host_os=unknown |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
33 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
34 |
esac |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
35 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
36 |
|
694 | 37 |
print_header() { |
38 |
echo |
|
39 |
echo ';; ================================================================' |
|
40 |
echo ";; ${FUNCNAME[1]}." |
|
41 |
echo |
|
42 |
} |
|
43 |
||
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
44 |
check_ispell() { |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
45 |
command -v ispell >/dev/null && return 0 || return 1 |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
46 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
47 |
|
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
48 |
check_aspell() { |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
49 |
command -v aspell >/dev/null && return 0 || return 1 |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
50 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
51 |
|
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
52 |
print_ispell() { |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
53 |
echo '(setq-default ispell-program-name "ispell")' |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
54 |
case $host_distro in |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
55 |
debian) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
56 |
echo '(setq-default ispell-local-dictionary "british")' |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
57 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
58 |
unknown) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
59 |
echo '(setq-default ispell-local-dictionary "default")' |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
60 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
61 |
esac |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
62 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
63 |
|
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
64 |
print_aspell() { |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
65 |
echo '(setq-default ispell-program-name "aspell")' |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
66 |
echo '(setq-default ispell-local-dictionary "en")' |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
67 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
68 |
|
694 | 69 |
print_speller() { |
70 |
print_header |
|
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
71 |
check_ispell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
72 |
ispell_present=$? |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
73 |
check_aspell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
74 |
aspell_present=$? |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
75 |
case $host_os in |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
76 |
windows) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
77 |
case $host_distro in |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
78 |
cygwin) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
79 |
if [ $aspell_present = 0 ]; then |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
80 |
print_aspell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
81 |
elif [ $ispell_present = 0 ]; then |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
82 |
print_ispell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
83 |
fi |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
84 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
85 |
esac |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
86 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
87 |
linux) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
88 |
case $host_distro in |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
89 |
debian) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
90 |
if [ $ispell_present = 0 ]; then |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
91 |
print_ispell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
92 |
elif [ $aspell_present = 0 ]; then |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
93 |
print_aspell |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
94 |
fi |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
95 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
96 |
esac |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
97 |
;; |
622
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
98 |
darwin) |
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
99 |
print_aspell |
596406094fd1
Port to Mac OS X console Emacs 22.1.1.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
604
diff
changeset
|
100 |
;; |
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
101 |
*) |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
102 |
: |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
103 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
104 |
esac |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
105 |
} |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
106 |
|
693
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
107 |
print_man() { |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
108 |
print_header |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
109 |
if man -a man >/dev/null 2>&1; then |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
110 |
echo '(setq Man-switches "-a")' |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
111 |
else |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
112 |
echo '(setq Man-switches "")' |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
113 |
fi |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
114 |
} |
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
115 |
|
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
116 |
# Remove old auto-generated config and fill it by standard header. |
604
9084d12d924d
Fix mode name for elisp files.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
579
diff
changeset
|
117 |
echo ";; -*- mode: emacs-lisp; coding: utf-8; fill-column: 78 -*- |
579
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
118 |
;; |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
119 |
;; For load order see README. |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
120 |
" >$cfg |
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
121 |
|
b71e74cfe817
Improve checker architecture.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
575
diff
changeset
|
122 |
check_platform |
693
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
123 |
print_speller >>$cfg |
694 | 124 |
print_man >>$cfg |
693
0462d1dcbe75
Add '-a' option to Man-switches.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
622
diff
changeset
|
125 |