-
Notifications
You must be signed in to change notification settings - Fork 2
/
haiku-pe2qe.sh
85 lines (77 loc) · 1.53 KB
/
haiku-pe2qe.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
pesettings=`finddir B_USER_SETTINGS_DIRECTORY`/pe/settings
fgmap=(
"alt comment:"
"alt error:"
"alt keyword:"
"alt number:"
"alt operator:"
"alt separator:"
"altprocessor:"
"attribute:"
"char constant:html-entity"
"comment:comment html-comment"
"error:"
"highlight:highlight"
"invisibles:"
"keyword:keyword preprocess"
"low:window-border"
"mark:status"
"number:number"
"operator:function"
"preprocessor:"
"selection:selection"
"separator:"
"string:string string-q html-string"
"system identifier:type"
"tag:tag"
"tagstring:html-tag"
"text:default mode-line minibuf"
"user identifier:variable"
)
bgmap=(
"low:default"
"selection:mode-line window-border region-hilite"
)
map_pe_fg () {
for item in "${fgmap[@]}"; do
if [ "$1" = "${item%:*}" ]; then
echo "${item#*:}"
return
fi
done
}
map_pe_bg () {
for item in "${bgmap[@]}"; do
if [ "$1" = "${item%:*}" ]; then
echo "${item#*:}"
return
fi
done
}
out_style () {
echo "set_style(\"$1\", \"$2\", \"$3\")"
}
echo "// map Pe settings to QEmacs"
echo "// generated by $(basename "$0") on `date`"
while read line; do
token="${line%=*}"
value="${line#*=}"
case "$token" in
*color)
name="${token% color}"
qenames="$(map_pe_fg "$name")"
for qename in ${qenames}; do
#echo "color: $name -> $qename" >&2
out_style "$qename" "color" "$value"
done
qenames="$(map_pe_bg "$name")"
for qename in ${qenames}; do
#echo "bgcolor: $name -> $qename" >&2
out_style "$qename" "background-color" "$value"
done
;;
*)
;;
esac
done < "$pesettings"