Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] emacs r1259 - eselect-emacs
Date: Mon, 20 Apr 2009 06:57:33
Message-Id: E1LvnRb-0000V1-2i@stork.gentoo.org
1 Author: ulm
2 Date: 2009-04-20 06:57:30 +0000 (Mon, 20 Apr 2009)
3 New Revision: 1259
4
5 Modified:
6 eselect-emacs/ChangeLog
7 eselect-emacs/ctags.eselect
8 eselect-emacs/emacs.eselect
9 Log:
10 Remove unnecessary quotes and other small fixes.
11
12 Modified: eselect-emacs/ChangeLog
13 ===================================================================
14 --- eselect-emacs/ChangeLog 2009-04-19 00:49:34 UTC (rev 1258)
15 +++ eselect-emacs/ChangeLog 2009-04-20 06:57:30 UTC (rev 1259)
16 @@ -1,3 +1,8 @@
17 +2009-04-20 Ulrich Mueller <ulm@g.o>
18 +
19 + * ctags.eselect:
20 + * emacs.eselect: Remove unnecessary quotes and other small fixes.
21 +
22 2009-04-18 Ulrich Mueller <ulm@g.o>
23
24 * ctags.eselect (do_list): Always output a list header, even if
25
26 Modified: eselect-emacs/ctags.eselect
27 ===================================================================
28 --- eselect-emacs/ctags.eselect 2009-04-19 00:49:34 UTC (rev 1258)
29 +++ eselect-emacs/ctags.eselect 2009-04-20 06:57:30 UTC (rev 1259)
30 @@ -39,12 +39,12 @@
31 # currently active Emacs version (selected by emacs.eselect)
32 # The logic here is the same as in emacs.eselect, don't change it!
33 local emacs
34 - if [[ -L "${ROOT}${bindir}/emacs" && \
35 + if [[ -L ${ROOT}${bindir}/emacs && \
36 -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then
37 emacs=$(basename $(readlink "${ROOT}${bindir}/emacs") )
38 - [[ -f "${ROOT}${bindir}/${CTAGS}-${emacs}" ]] && echo ${CTAGS}-${emacs}
39 - elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then
40 - [[ -f "${ROOT}${bindir}/${CTAGS}-xemacs" ]] && echo ${CTAGS}-xemacs
41 + [[ -f ${ROOT}${bindir}/${CTAGS}-${emacs} ]] && echo "${CTAGS}-${emacs}"
42 + elif [[ -f ${ROOT}${bindir}/xemacs ]]; then
43 + [[ -f ${ROOT}${bindir}/${CTAGS}-xemacs ]] && echo "${CTAGS}-xemacs"
44 elif [[ ${CTAGS} == etags ]]; then
45 # We are called as etags module, but no (X)Emacs is installed.
46 # Return an empty list in this case, because we don't want
47 @@ -54,7 +54,7 @@
48 fi
49
50 # Exuberant ctags
51 - [[ -f "${ROOT}${bindir}/exuberant-ctags" ]] && echo exuberant-ctags
52 + [[ -f ${ROOT}${bindir}/exuberant-ctags ]] && echo exuberant-ctags
53 }
54
55 remove_symlinks() {
56 @@ -85,7 +85,7 @@
57
58 set_symlinks() {
59 # Set symlinks to binary and man page
60 - local target="${1}" targets
61 + local target=$1 targets
62 # target may be specified by its name or its index
63 if is_number "${target}"; then
64 # numeric index, find the target's name
65 @@ -96,8 +96,8 @@
66 fi
67
68 # is the target valid, i.e. does a ctags binary with this name exist?
69 - [[ -f "${ROOT}${bindir}/${target}" ]] \
70 - || die -q "Target \"${1}\" doesn't appear to be valid!"
71 + [[ -f ${ROOT}${bindir}/${target} ]] \
72 + || die -q "Target \"$1\" doesn't appear to be valid!"
73
74 echo "Switching ${CTAGS} to ${target} ..."
75 remove_symlinks || die -q "Couldn't remove existing symlink"
76 @@ -108,7 +108,7 @@
77
78 test_for_root() {
79 # checks if the user has rights to modify /usr/bin/
80 - [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!"
81 + [[ -w ${ROOT}${bindir} ]] || die -q "You need root privileges!"
82 }
83
84 ### show action ###
85 @@ -118,14 +118,14 @@
86 }
87
88 do_show() {
89 - [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
90 + [[ $# -gt 0 ]] && die -q "Too many parameters"
91
92 write_list_start "Current target of ${CTAGS} symlink:"
93 - if [[ -L "${ROOT}${bindir}/${CTAGS}" && \
94 + if [[ -L ${ROOT}${bindir}/${CTAGS} && \
95 -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then
96 write_kv_list_entry \
97 $(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) ""
98 - elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then
99 + elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then
100 write_kv_list_entry \
101 "(not a symlink or target of symlink does not exist)" ""
102 else
103 @@ -140,7 +140,7 @@
104 }
105
106 do_list() {
107 - [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
108 + [[ $# -gt 0 ]] && die -q "Too many parameters"
109
110 local i targets
111 targets=( $(find_targets) )
112 @@ -174,16 +174,16 @@
113 }
114
115 do_set() {
116 - [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
117 - [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
118 + [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
119 + [[ $# -gt 1 ]] && die -q "Too many parameters"
120 test_for_root
121
122 - if [[ -e "${ROOT}${bindir}/${CTAGS}" && ! -L "${ROOT}${bindir}/${CTAGS}" ]]
123 + if [[ -e ${ROOT}${bindir}/${CTAGS} && ! -L ${ROOT}${bindir}/${CTAGS} ]]
124 then
125 die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
126 fi
127
128 - set_symlinks "${1}" || die -q "Couldn't set a new symlink"
129 + set_symlinks "$1" || die -q "Couldn't set a new symlink"
130 }
131
132 ### update action ###
133 @@ -193,18 +193,18 @@
134 }
135
136 do_update() {
137 - [[ -z "${1}" || "${1}" == norecursion ]] || die -q "Usage error"
138 - [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
139 + [[ -z $1 || $1 == norecursion ]] || die -q "Usage error"
140 + [[ $# -gt 1 ]] && die -q "Too many parameters"
141 test_for_root
142
143 local current=""
144 - if [[ -L "${ROOT}${bindir}/${CTAGS}" ]]; then
145 + if [[ -L ${ROOT}${bindir}/${CTAGS} ]]; then
146 current=$(basename $(readlink "${ROOT}${bindir}/${CTAGS}") )
147 if [[ ! -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then
148 # clean up dead symlinks
149 remove_symlinks || die -q "Couldn't remove existing symlink"
150 fi
151 - elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then
152 + elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then
153 if ! [[ ${CTAGS} == ctags && $(uname) == FreeBSD ]]; then
154 die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
155 fi
156 @@ -219,15 +219,15 @@
157 local i target targets=( $(find_targets) )
158 if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then
159 target=${targets[0]}
160 - [[ "${current}" == ${CTAGS}-*emacs* ]] && current="${CTAGS}-*emacs*"
161 + [[ ${current} == ${CTAGS}-*emacs* ]] && current="${CTAGS}-*emacs*"
162 for i in ${targets[@]}; do
163 - [[ "${i}" == "${current}" ]] && target="${i}"
164 + [[ ${i} == "${current}" ]] && target=${i}
165 done
166 set_symlinks "${target}" || die -q "Couldn't set a new symlink"
167 fi
168
169 # Call "eselect etags update" from the ctags module and vice versa
170 - [[ "${1}" == norecursion ]] && return
171 + [[ $1 == norecursion ]] && return
172 case ${CTAGS} in
173 ctags) CTAGS=etags do_update norecursion ;;
174 etags) CTAGS=ctags do_update norecursion ;;
175
176 Modified: eselect-emacs/emacs.eselect
177 ===================================================================
178 --- eselect-emacs/emacs.eselect 2009-04-19 00:49:34 UTC (rev 1258)
179 +++ eselect-emacs/emacs.eselect 2009-04-20 06:57:30 UTC (rev 1259)
180 @@ -49,8 +49,8 @@
181
182 # Define INFOPATH environment variable in env file
183 set_infopath() {
184 - [[ -d "${ROOT}${infodir}/${1}" ]] || return 1
185 - echo "INFOPATH=${infodir}/${1}" > "${ROOT}${envdir}/50emacs"
186 + [[ -d ${ROOT}${infodir}/$1 ]] || return 1
187 + echo "INFOPATH=${infodir}/$1" > "${ROOT}${envdir}/50emacs"
188 }
189
190 remove_symlinks() {
191 @@ -72,9 +72,9 @@
192 local target=${1} f
193 for f in ${BINARYLIST}; do
194 # set symlink only if target binary actually exists
195 - if [[ -f "${ROOT}${bindir}/${f}-${target}" ]]; then
196 - ln -s "${f}-${target}" "${ROOT}${bindir}/${f}" ||
197 - die "Couldn't set ${f}-${target} ${ROOT}${bindir}/${f} symlink"
198 + if [[ -f ${ROOT}${bindir}/${f}-${target} ]]; then
199 + ln -s "${f}-${target}" "${ROOT}${bindir}/${f}" || die \
200 + "Couldn't set ${f}-${target} ${ROOT}${bindir}/${f} symlink"
201 fi
202 done
203 }
204 @@ -96,7 +96,7 @@
205
206 set_symlinks() {
207 # Set symlinks to binaries and man pages, update info path
208 - local target="${1}" nomain="${2}" targets
209 + local target=$1 nomain=$2 targets
210 # target may be specified by its name or its index
211 if is_number "${target}"; then
212 # numeric index, find the target's name
213 @@ -107,7 +107,7 @@
214 fi
215
216 # is the target valid, i.e. does an Emacs binary with this name exist?
217 - [[ -f "${ROOT}${bindir}/${target}" ]] \
218 + [[ -f ${ROOT}${bindir}/${target} ]] \
219 || die -q "Target \"${1}\" doesn't appear to be valid!"
220
221 echo "Switching emacs to ${target} ..."
222 @@ -132,7 +132,7 @@
223 xemacs_info() {
224 # This is just informational to tell that XEmacs has been found,
225 # a wish from graaff
226 - if [[ -e "${ROOT}${bindir}/xemacs" ]]; then
227 + if [[ -e ${ROOT}${bindir}/xemacs ]]; then
228 echo
229 write_list_start "XEmacs is also installed"
230 fi
231 @@ -140,7 +140,7 @@
232
233 vim_info() {
234 # Don't take this too serious
235 - if [[ -e "${ROOT}${bindir}/vi" ]]; then
236 + if [[ -e ${ROOT}${bindir}/vi ]]; then
237 echo
238 write_list_start "Vi found, your system is in real trouble now! ;)"
239 fi
240 @@ -148,7 +148,7 @@
241
242 test_for_root() {
243 # checks if the user has rights to modify /usr/bin/
244 - [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!"
245 + [[ -w ${ROOT}${bindir} ]] || die -q "You need root privileges!"
246 }
247
248 ### show action ###
249 @@ -158,14 +158,14 @@
250 }
251
252 do_show() {
253 - [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
254 + [[ $# -gt 0 ]] && die -q "Too many parameters"
255
256 write_list_start "Current target of Emacs symlink:"
257 - if [[ -L "${ROOT}${bindir}/emacs" && \
258 + if [[ -L ${ROOT}${bindir}/emacs && \
259 -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then
260 write_kv_list_entry \
261 $(basename $(readlink "${ROOT}${bindir}/emacs") ) ""
262 - elif [[ -e "${ROOT}${bindir}/emacs" ]]; then
263 + elif [[ -e ${ROOT}${bindir}/emacs ]]; then
264 write_kv_list_entry \
265 "(not a symlink or target of symlink does not exist)" ""
266 else
267 @@ -182,7 +182,7 @@
268 }
269
270 do_list() {
271 - [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
272 + [[ $# -gt 0 ]] && die -q "Too many parameters"
273
274 local i targets
275 targets=( $(find_targets) )
276 @@ -218,11 +218,11 @@
277 }
278
279 do_set() {
280 - [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to"
281 - [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
282 + [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
283 + [[ $# -gt 1 ]] && die -q "Too many parameters"
284 test_for_root
285
286 - if [[ -e "${ROOT}${bindir}/emacs" && ! -L "${ROOT}${bindir}/emacs" ]]; then
287 + if [[ -e ${ROOT}${bindir}/emacs && ! -L ${ROOT}${bindir}/emacs ]]; then
288 die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
289 fi
290
291 @@ -243,19 +243,17 @@
292 }
293
294 do_update() {
295 - [[ -z "${1}" || "${1}" == "ifunset" || "${1}" == "--if-unset" ]] \
296 - || die -q "Usage error"
297 - [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
298 + [[ -z $1 || $1 == ifunset || $1 == --if-unset ]] || die -q "Usage error"
299 + [[ $# -gt 1 ]] && die -q "Too many parameters"
300 test_for_root
301
302 - if [[ -L "${ROOT}${bindir}/emacs" ]]; then
303 - [[ ${1} == *if*unset \
304 - && -e $(canonicalise "${ROOT}${bindir}/emacs") ]] \
305 + if [[ -L ${ROOT}${bindir}/emacs ]]; then
306 + [[ $1 == *if*unset && -e $(canonicalise "${ROOT}${bindir}/emacs") ]] \
307 && return
308 # this is not redundant: "update" is called in pkg_postrm() of emacs
309 # and should clean up any dead symlinks if no valid target exists
310 remove_symlinks || die -q "Couldn't remove existing symlink"
311 - elif [[ -e "${ROOT}${bindir}/emacs" ]]; then
312 + elif [[ -e ${ROOT}${bindir}/emacs ]]; then
313 die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
314 fi
315
316 @@ -263,7 +261,7 @@
317 if [[ ${#targets[@]} -gt 0 ]]; then
318 set_symlinks "${targets[${#targets[@]}-1]}" \
319 || die -q "Couldn't set a new symlink"
320 - elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then
321 + elif [[ -f ${ROOT}${bindir}/xemacs ]]; then
322 # no Emacs target found -- link ctags, etags etc. to XEmacs versions
323 set_symlinks xemacs nomain
324 fi