1 |
Author: ulm |
2 |
Date: 2009-05-11 16:42:01 +0000 (Mon, 11 May 2009) |
3 |
New Revision: 533 |
4 |
|
5 |
Modified: |
6 |
trunk/ChangeLog |
7 |
trunk/man/ctags.eselect.5 |
8 |
trunk/man/emacs.eselect.5 |
9 |
trunk/modules/ctags.eselect |
10 |
trunk/modules/emacs.eselect |
11 |
Log: |
12 |
Sync emacs and ctags modules from the Emacs SVN repository. |
13 |
|
14 |
Modified: trunk/ChangeLog |
15 |
=================================================================== |
16 |
--- trunk/ChangeLog 2009-05-11 16:34:04 UTC (rev 532) |
17 |
+++ trunk/ChangeLog 2009-05-11 16:42:01 UTC (rev 533) |
18 |
@@ -1,3 +1,10 @@ |
19 |
+2009-05-11 Ulrich Mueller <ulm@g.o> |
20 |
+ |
21 |
+ * modules/emacs.eselect, modules/ctags.eselect: |
22 |
+ * man/emacs.eselect.5, man/ctags.eselect.5: Sync the emacs and |
23 |
+ ctags modules from the Emacs SVN repository (r1275), corresponding |
24 |
+ to the eselect-emacs-1.10 release. |
25 |
+ |
26 |
2009-05-05 Ulrich Mueller <ulm@g.o> |
27 |
|
28 |
* modules/news-tng.eselect (do_list): Display fallback values if |
29 |
@@ -254,12 +261,11 @@ |
30 |
|
31 |
2008-03-24 Ulrich Mueller <ulm@g.o> |
32 |
|
33 |
- * man/emacs.eselect.5, man/ctags.eselect.5: Ditto for man pages. |
34 |
+ * modules/emacs.eselect, modules/ctags.eselect: |
35 |
+ * man/emacs.eselect.5, man/ctags.eselect.5: Import the emacs and |
36 |
+ ctags modules from the Emacs SVN repository (r1030), corresponding |
37 |
+ to the eselect-emacs-1.3 release. |
38 |
|
39 |
- * modules/emacs.eselect, modules/ctags.eselect: Import the |
40 |
- emacs and ctags modules from the Emacs SVN repository (r1030), |
41 |
- corresponding to the eselect-emacs-1.3 release. |
42 |
- |
43 |
2008-01-28 Piotr JaroszyĆski <peper@g.o> |
44 |
|
45 |
* configure.ac, libs/paludis.bash.in: Check for paludis binary at |
46 |
|
47 |
Modified: trunk/man/ctags.eselect.5 |
48 |
=================================================================== |
49 |
--- trunk/man/ctags.eselect.5 2009-05-11 16:34:04 UTC (rev 532) |
50 |
+++ trunk/man/ctags.eselect.5 2009-05-11 16:42:01 UTC (rev 533) |
51 |
@@ -1,14 +1,14 @@ |
52 |
-.\" Copyright 2007-2008 Gentoo Foundation |
53 |
+.\" Copyright 2007-2009 Gentoo Foundation |
54 |
.\" Distributed under the terms of the GNU General Public License v2 |
55 |
.\" $Id$ |
56 |
.\" |
57 |
-.TH ESELECT 5 "December 2008" "Gentoo Linux" eselect |
58 |
+.TH ctags.eselect 5 "May 2009" "Gentoo Linux" eselect |
59 |
.SH NAME |
60 |
ctags.eselect, etags.eselect \- The ctags and etags management module |
61 |
for Gentoo's eselect |
62 |
.SH SYNOPSIS |
63 |
.B eselect ctags |
64 |
-.RB [ help | usage ] |
65 |
+.RB [ help | usage | version ] |
66 |
.br |
67 |
.B eselect ctags list |
68 |
.br |
69 |
@@ -18,6 +18,7 @@ |
70 |
.B eselect ctags show |
71 |
.br |
72 |
.B eselect ctags update |
73 |
+.RB [ ifunset ] |
74 |
.SH DESCRIPTION |
75 |
.B eselect |
76 |
is Gentoo's configuration and management tool. It features modules |
77 |
@@ -66,10 +67,13 @@ |
78 |
exuberant-ctags |
79 |
.SH ACTION: UPDATE |
80 |
.B eselect ctags update |
81 |
+.RB [ ifunset ] |
82 |
.br |
83 |
Update the ctags symlink. For an update only the version is changed, |
84 |
but not the provider (i.e. Emacs vs Exuberant). At the moment only |
85 |
-(X)Emacs offers several concurrent versions. |
86 |
+(X)Emacs offers several concurrent versions. If option |
87 |
+.B ifunset |
88 |
+is given, an existing implementation is not overridden. |
89 |
|
90 |
# eselect ctags update |
91 |
.br |
92 |
|
93 |
Modified: trunk/man/emacs.eselect.5 |
94 |
=================================================================== |
95 |
--- trunk/man/emacs.eselect.5 2009-05-11 16:34:04 UTC (rev 532) |
96 |
+++ trunk/man/emacs.eselect.5 2009-05-11 16:42:01 UTC (rev 533) |
97 |
@@ -1,13 +1,13 @@ |
98 |
-.\" Copyright 2007-2008 Gentoo Foundation |
99 |
+.\" Copyright 2007-2009 Gentoo Foundation |
100 |
.\" Distributed under the terms of the GNU General Public License v2 |
101 |
.\" $Id$ |
102 |
.\" |
103 |
-.TH ESELECT 5 "December 2008" "Gentoo Linux" eselect |
104 |
+.TH emacs.eselect 5 "April 2009" "Gentoo Linux" eselect |
105 |
.SH NAME |
106 |
emacs.eselect \- The Emacs management module for Gentoo's eselect |
107 |
.SH SYNOPSIS |
108 |
.B eselect emacs |
109 |
-.RB [ help | usage ] |
110 |
+.RB [ help | usage | version ] |
111 |
.br |
112 |
.B eselect emacs list |
113 |
.br |
114 |
@@ -17,7 +17,7 @@ |
115 |
.B eselect emacs show |
116 |
.br |
117 |
.B eselect emacs update |
118 |
-.RI [ ifunset ] |
119 |
+.RB [ ifunset ] |
120 |
.SH DESCRIPTION |
121 |
.B eselect |
122 |
is Gentoo's configuration and management tool. It features modules |
123 |
@@ -67,10 +67,10 @@ |
124 |
emacs-22 |
125 |
.SH ACTION: UPDATE |
126 |
.B eselect emacs update |
127 |
-.RI [ ifunset ] |
128 |
+.RB [ ifunset ] |
129 |
.br |
130 |
Update the emacs symlink to the last available version. If option |
131 |
-.I ifunset |
132 |
+.B ifunset |
133 |
is given, an existing implementation is not overridden. |
134 |
|
135 |
# eselect emacs update |
136 |
|
137 |
Modified: trunk/modules/ctags.eselect |
138 |
=================================================================== |
139 |
--- trunk/modules/ctags.eselect 2009-05-11 16:34:04 UTC (rev 532) |
140 |
+++ trunk/modules/ctags.eselect 2009-05-11 16:42:01 UTC (rev 533) |
141 |
@@ -1,4 +1,4 @@ |
142 |
-# Copyright 2005-2008 Gentoo Foundation |
143 |
+# Copyright 2005-2009 Gentoo Foundation |
144 |
# Distributed under the terms of the GNU General Public License v2 |
145 |
# $Id$ |
146 |
# |
147 |
@@ -39,13 +39,12 @@ |
148 |
# currently active Emacs version (selected by emacs.eselect) |
149 |
# The logic here is the same as in emacs.eselect, don't change it! |
150 |
local emacs |
151 |
- if [[ -L "${ROOT}${bindir}/emacs" && \ |
152 |
- -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then |
153 |
- emacs=$(basename $(readlink "${ROOT}${bindir}/emacs") ) |
154 |
- [[ -f "${ROOT}${bindir}/${CTAGS}-${emacs}" ]] && echo ${CTAGS}-${emacs} |
155 |
- elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then |
156 |
- [[ -f "${ROOT}${bindir}/${CTAGS}-xemacs" ]] && echo ${CTAGS}-xemacs |
157 |
- elif [[ ${CTAGS} == etags ]]; then |
158 |
+ if [[ -L ${ROOT}${bindir}/emacs && -e ${ROOT}${bindir}/emacs ]]; then |
159 |
+ emacs=$(basename "$(readlink "${ROOT}${bindir}/emacs")") |
160 |
+ [[ -f ${ROOT}${bindir}/${CTAGS}-${emacs} ]] && echo "${CTAGS}-${emacs}" |
161 |
+ elif [[ -f ${ROOT}${bindir}/xemacs ]]; then |
162 |
+ [[ -f ${ROOT}${bindir}/${CTAGS}-xemacs ]] && echo "${CTAGS}-xemacs" |
163 |
+ elif [[ ${CTAGS} = etags ]]; then |
164 |
# We are called as etags module, but no (X)Emacs is installed. |
165 |
# Return an empty list in this case, because we don't want |
166 |
# exuberant-ctags as default for etags (for ctags it's fine). |
167 |
@@ -54,7 +53,7 @@ |
168 |
fi |
169 |
|
170 |
# Exuberant ctags |
171 |
- [[ -f "${ROOT}${bindir}/exuberant-ctags" ]] && echo exuberant-ctags |
172 |
+ [[ -f ${ROOT}${bindir}/exuberant-ctags ]] && echo exuberant-ctags |
173 |
} |
174 |
|
175 |
remove_symlinks() { |
176 |
@@ -85,19 +84,19 @@ |
177 |
|
178 |
set_symlinks() { |
179 |
# Set symlinks to binary and man page |
180 |
- local target="${1}" targets |
181 |
+ local target=$1 targets |
182 |
# target may be specified by its name or its index |
183 |
if is_number "${target}"; then |
184 |
# numeric index, find the target's name |
185 |
targets=( $(find_targets) ) |
186 |
[[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ |
187 |
|| die -q "Number out of range: ${1}" |
188 |
- target=${targets[$(( ${target} - 1 ))]} |
189 |
+ target=${targets[target-1]} |
190 |
fi |
191 |
|
192 |
# is the target valid, i.e. does a ctags binary with this name exist? |
193 |
- [[ -f "${ROOT}${bindir}/${target}" ]] \ |
194 |
- || die -q "Target \"${1}\" doesn't appear to be valid!" |
195 |
+ [[ -f ${ROOT}${bindir}/${target} ]] \ |
196 |
+ || die -q "Target \"$1\" doesn't appear to be valid!" |
197 |
|
198 |
echo "Switching ${CTAGS} to ${target} ..." |
199 |
remove_symlinks || die -q "Couldn't remove existing symlink" |
200 |
@@ -108,7 +107,7 @@ |
201 |
|
202 |
test_for_root() { |
203 |
# checks if the user has rights to modify /usr/bin/ |
204 |
- [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!" |
205 |
+ [[ -w ${ROOT}${bindir} ]] || die -q "You need root privileges!" |
206 |
} |
207 |
|
208 |
### show action ### |
209 |
@@ -118,14 +117,14 @@ |
210 |
} |
211 |
|
212 |
do_show() { |
213 |
- [[ ${#@} -gt 0 ]] && die -q "Too many parameters" |
214 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
215 |
|
216 |
write_list_start "Current target of ${CTAGS} symlink:" |
217 |
- if [[ -L "${ROOT}${bindir}/${CTAGS}" && \ |
218 |
- -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then |
219 |
+ if [[ -L ${ROOT}${bindir}/${CTAGS} && -e ${ROOT}${bindir}/${CTAGS} ]] |
220 |
+ then |
221 |
write_kv_list_entry \ |
222 |
- $(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) "" |
223 |
- elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then |
224 |
+ "$(basename "$(readlink "${ROOT}${bindir}/${CTAGS}")")" "" |
225 |
+ elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then |
226 |
write_kv_list_entry \ |
227 |
"(not a symlink or target of symlink does not exist)" "" |
228 |
else |
229 |
@@ -140,19 +139,19 @@ |
230 |
} |
231 |
|
232 |
do_list() { |
233 |
- [[ ${#@} -gt 0 ]] && die -q "Too many parameters" |
234 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
235 |
|
236 |
local i targets |
237 |
targets=( $(find_targets) ) |
238 |
|
239 |
+ write_list_start "Available ${CTAGS} symlink targets:" |
240 |
if [[ -n ${targets[@]} ]]; then |
241 |
- for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do |
242 |
+ for (( i = 0; i < ${#targets[@]}; i++ )); do |
243 |
# Display a star to indicate the currently chosen version |
244 |
- [[ ${targets[${i}]} = \ |
245 |
- $(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) ]] \ |
246 |
- && targets[${i}]="${targets[${i}]} $(highlight '*')" |
247 |
+ [[ ${targets[i]} = \ |
248 |
+ $(basename "$(readlink "${ROOT}${bindir}/${CTAGS}")") ]] \ |
249 |
+ && targets[i]="${targets[i]} $(highlight '*')" |
250 |
done |
251 |
- write_list_start "Available ${CTAGS} symlink targets:" |
252 |
write_numbered_list "${targets[@]}" |
253 |
else |
254 |
write_kv_list_entry "(none found)" "" |
255 |
@@ -174,16 +173,16 @@ |
256 |
} |
257 |
|
258 |
do_set() { |
259 |
- [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to" |
260 |
- [[ ${#@} -gt 1 ]] && die -q "Too many parameters" |
261 |
+ [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" |
262 |
+ [[ $# -gt 1 ]] && die -q "Too many parameters" |
263 |
test_for_root |
264 |
|
265 |
- if [[ -e "${ROOT}${bindir}/${CTAGS}" && ! -L "${ROOT}${bindir}/${CTAGS}" ]] |
266 |
+ if [[ -e ${ROOT}${bindir}/${CTAGS} && ! -L ${ROOT}${bindir}/${CTAGS} ]] |
267 |
then |
268 |
die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink" |
269 |
fi |
270 |
|
271 |
- set_symlinks "${1}" || die -q "Couldn't set a new symlink" |
272 |
+ set_symlinks "$1" || die -q "Couldn't set a new symlink" |
273 |
} |
274 |
|
275 |
### update action ### |
276 |
@@ -192,44 +191,53 @@ |
277 |
echo "Automatically update the ${CTAGS} symlink" |
278 |
} |
279 |
|
280 |
+describe_update_options() { |
281 |
+ echo "ifunset : Do not override currently set version" |
282 |
+} |
283 |
+ |
284 |
do_update() { |
285 |
- [[ -z "${1}" || "${1}" == norecursion ]] || die -q "Usage error" |
286 |
- [[ ${#@} -gt 1 ]] && die -q "Too many parameters" |
287 |
+ [[ -z $1 || $1 = ifunset || $1 = --if-unset ]] || die -q "Usage error" |
288 |
+ [[ -z $2 || $2 = norecursion ]] || die -q "Usage error" |
289 |
+ [[ $# -gt 2 ]] && die -q "Too many parameters" |
290 |
test_for_root |
291 |
|
292 |
- local current="" |
293 |
- if [[ -L "${ROOT}${bindir}/${CTAGS}" ]]; then |
294 |
- current=$(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) |
295 |
- if [[ ! -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then |
296 |
- # clean up dead symlinks |
297 |
- remove_symlinks || die -q "Couldn't remove existing symlink" |
298 |
+ if ! [[ $1 == *if*unset \ |
299 |
+ && -L ${ROOT}${bindir}/${CTAGS} && -e ${ROOT}${bindir}/${CTAGS} ]] |
300 |
+ then |
301 |
+ local current="" |
302 |
+ if [[ -L ${ROOT}${bindir}/${CTAGS} ]]; then |
303 |
+ current=$(basename "$(readlink "${ROOT}${bindir}/${CTAGS}")") |
304 |
+ if [[ ! -e ${ROOT}${bindir}/${CTAGS} ]]; then |
305 |
+ # clean up dead symlinks |
306 |
+ remove_symlinks || die -q "Couldn't remove existing symlink" |
307 |
+ fi |
308 |
+ elif [[ -e ${ROOT}${bindir}/${CTAGS} ]]; then |
309 |
+ if ! [[ ${CTAGS} = ctags && $(uname) = FreeBSD ]]; then |
310 |
+ die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink" |
311 |
+ fi |
312 |
+ # On FreeBSD ctags is a real file, installed by freebsd-ubin |
313 |
+ current=nolink |
314 |
fi |
315 |
- elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then |
316 |
- if ! [[ ${CTAGS} == ctags && $(uname) == FreeBSD ]]; then |
317 |
- die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink" |
318 |
- fi |
319 |
- # On FreeBSD ctags is a real file, installed by freebsd-ubin |
320 |
- current=nolink |
321 |
- fi |
322 |
|
323 |
- # For an "update" only the version should be changed, but not the |
324 |
- # provider (i.e. Emacs vs Exuberant). At the moment only (X)Emacs |
325 |
- # offers several concurrent versions. |
326 |
+ # For an "update" only the version should be changed, but not the |
327 |
+ # provider (i.e. Emacs vs Exuberant). At the moment only (X)Emacs |
328 |
+ # offers several concurrent versions. |
329 |
|
330 |
- local i target targets=( $(find_targets) ) |
331 |
- if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then |
332 |
- target=${targets[0]} |
333 |
- [[ "${current}" == ${CTAGS}-*emacs* ]] && current="${CTAGS}-*emacs*" |
334 |
- for i in ${targets[@]}; do |
335 |
- [[ "${i}" == "${current}" ]] && target="${i}" |
336 |
- done |
337 |
- set_symlinks "${target}" || die -q "Couldn't set a new symlink" |
338 |
+ local i target targets=( $(find_targets) ) |
339 |
+ if [[ ${#targets[@]} -gt 0 && ${current} != nolink ]]; then |
340 |
+ target=${targets[0]} |
341 |
+ [[ ${current} == ${CTAGS}-*emacs* ]] && current=${CTAGS}-*emacs* |
342 |
+ for i in ${targets[@]}; do |
343 |
+ [[ ${i} == ${current} ]] && target=${i} |
344 |
+ done |
345 |
+ set_symlinks "${target}" || die -q "Couldn't set a new symlink" |
346 |
+ fi |
347 |
fi |
348 |
|
349 |
# Call "eselect etags update" from the ctags module and vice versa |
350 |
- [[ "${1}" == norecursion ]] && return |
351 |
+ [[ $2 = norecursion ]] && return |
352 |
case ${CTAGS} in |
353 |
- ctags) CTAGS=etags do_update norecursion ;; |
354 |
- etags) CTAGS=ctags do_update norecursion ;; |
355 |
+ ctags) CTAGS=etags do_update "$1" norecursion ;; |
356 |
+ etags) CTAGS=ctags do_update "$1" norecursion ;; |
357 |
esac |
358 |
} |
359 |
|
360 |
Modified: trunk/modules/emacs.eselect |
361 |
=================================================================== |
362 |
--- trunk/modules/emacs.eselect 2009-05-11 16:34:04 UTC (rev 532) |
363 |
+++ trunk/modules/emacs.eselect 2009-05-11 16:42:01 UTC (rev 533) |
364 |
@@ -1,4 +1,4 @@ |
365 |
-# Copyright 2005-2008 Gentoo Foundation |
366 |
+# Copyright 2005-2009 Gentoo Foundation |
367 |
# Distributed under the terms of the GNU General Public License v2 |
368 |
# $Id$ |
369 |
# |
370 |
@@ -49,8 +49,8 @@ |
371 |
|
372 |
# Define INFOPATH environment variable in env file |
373 |
set_infopath() { |
374 |
- [[ -d "${ROOT}${infodir}/${1}" ]] || return 1 |
375 |
- echo "INFOPATH=${infodir}/${1}" > "${ROOT}${envdir}/50emacs" |
376 |
+ [[ -d ${ROOT}${infodir}/$1 ]] || return 1 |
377 |
+ echo "INFOPATH=${infodir}/$1" > "${ROOT}${envdir}/50emacs" |
378 |
} |
379 |
|
380 |
remove_symlinks() { |
381 |
@@ -72,9 +72,9 @@ |
382 |
local target=${1} f |
383 |
for f in ${BINARYLIST}; do |
384 |
# set symlink only if target binary actually exists |
385 |
- if [[ -f "${ROOT}${bindir}/${f}-${target}" ]]; then |
386 |
- ln -s "${f}-${target}" "${ROOT}${bindir}/${f}" || |
387 |
- die "Couldn't set ${f}-${target} ${ROOT}${bindir}/${f} symlink" |
388 |
+ if [[ -f ${ROOT}${bindir}/${f}-${target} ]]; then |
389 |
+ ln -s "${f}-${target}" "${ROOT}${bindir}/${f}" || die \ |
390 |
+ "Couldn't set ${f}-${target} ${ROOT}${bindir}/${f} symlink" |
391 |
fi |
392 |
done |
393 |
} |
394 |
@@ -96,18 +96,18 @@ |
395 |
|
396 |
set_symlinks() { |
397 |
# Set symlinks to binaries and man pages, update info path |
398 |
- local target="${1}" nomain="${2}" targets |
399 |
+ local target=$1 nomain=$2 targets |
400 |
# target may be specified by its name or its index |
401 |
if is_number "${target}"; then |
402 |
# numeric index, find the target's name |
403 |
targets=( $(find_targets) ) |
404 |
[[ ${target} -ge 1 && ${target} -le ${#targets[@]} ]] \ |
405 |
|| die -q "Number out of range: ${1}" |
406 |
- target=${targets[$(( ${target} - 1 ))]} |
407 |
+ target=${targets[target-1]} |
408 |
fi |
409 |
|
410 |
# is the target valid, i.e. does an Emacs binary with this name exist? |
411 |
- [[ -f "${ROOT}${bindir}/${target}" ]] \ |
412 |
+ [[ -f ${ROOT}${bindir}/${target} ]] \ |
413 |
|| die -q "Target \"${1}\" doesn't appear to be valid!" |
414 |
|
415 |
echo "Switching emacs to ${target} ..." |
416 |
@@ -132,7 +132,7 @@ |
417 |
xemacs_info() { |
418 |
# This is just informational to tell that XEmacs has been found, |
419 |
# a wish from graaff |
420 |
- if [[ -e "${ROOT}${bindir}/xemacs" ]]; then |
421 |
+ if [[ -e ${ROOT}${bindir}/xemacs ]]; then |
422 |
echo |
423 |
write_list_start "XEmacs is also installed" |
424 |
fi |
425 |
@@ -140,7 +140,7 @@ |
426 |
|
427 |
vim_info() { |
428 |
# Don't take this too serious |
429 |
- if [[ -e "${ROOT}${bindir}/vi" ]]; then |
430 |
+ if [[ -e ${ROOT}${bindir}/vi ]]; then |
431 |
echo |
432 |
write_list_start "Vi found, your system is in real trouble now! ;)" |
433 |
fi |
434 |
@@ -148,7 +148,7 @@ |
435 |
|
436 |
test_for_root() { |
437 |
# checks if the user has rights to modify /usr/bin/ |
438 |
- [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!" |
439 |
+ [[ -w ${ROOT}${bindir} ]] || die -q "You need root privileges!" |
440 |
} |
441 |
|
442 |
### show action ### |
443 |
@@ -158,14 +158,13 @@ |
444 |
} |
445 |
|
446 |
do_show() { |
447 |
- [[ ${#@} -gt 0 ]] && die -q "Too many parameters" |
448 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
449 |
|
450 |
write_list_start "Current target of Emacs symlink:" |
451 |
- if [[ -L "${ROOT}${bindir}/emacs" && \ |
452 |
- -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then |
453 |
+ if [[ -L ${ROOT}${bindir}/emacs && -e ${ROOT}${bindir}/emacs ]]; then |
454 |
write_kv_list_entry \ |
455 |
- $(basename $(readlink "${ROOT}${bindir}/emacs") ) "" |
456 |
- elif [[ -e "${ROOT}${bindir}/emacs" ]]; then |
457 |
+ "$(basename "$(readlink "${ROOT}${bindir}/emacs")")" "" |
458 |
+ elif [[ -e ${ROOT}${bindir}/emacs ]]; then |
459 |
write_kv_list_entry \ |
460 |
"(not a symlink or target of symlink does not exist)" "" |
461 |
else |
462 |
@@ -182,19 +181,19 @@ |
463 |
} |
464 |
|
465 |
do_list() { |
466 |
- [[ ${#@} -gt 0 ]] && die -q "Too many parameters" |
467 |
+ [[ $# -gt 0 ]] && die -q "Too many parameters" |
468 |
|
469 |
local i targets |
470 |
targets=( $(find_targets) ) |
471 |
|
472 |
+ write_list_start "Available Emacs symlink targets:" |
473 |
if [[ -n ${targets[@]} ]]; then |
474 |
- for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do |
475 |
+ for (( i = 0; i < ${#targets[@]}; i++ )); do |
476 |
# Display a star to indicate the currently chosen version |
477 |
- [[ ${targets[${i}]} = \ |
478 |
- $(basename $(readlink "${ROOT}${bindir}/emacs") ) ]] \ |
479 |
- && targets[${i}]="${targets[${i}]} $(highlight '*')" |
480 |
+ [[ ${targets[i]} = \ |
481 |
+ $(basename "$(readlink "${ROOT}${bindir}/emacs")") ]] \ |
482 |
+ && targets[i]="${targets[i]} $(highlight '*')" |
483 |
done |
484 |
- write_list_start "Available Emacs symlink targets:" |
485 |
write_numbered_list "${targets[@]}" |
486 |
else |
487 |
write_kv_list_entry "(none found)" "" |
488 |
@@ -218,11 +217,11 @@ |
489 |
} |
490 |
|
491 |
do_set() { |
492 |
- [[ -z "${1}" ]] && die -q "You didn't tell me what to set the symlink to" |
493 |
- [[ ${#@} -gt 1 ]] && die -q "Too many parameters" |
494 |
+ [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to" |
495 |
+ [[ $# -gt 1 ]] && die -q "Too many parameters" |
496 |
test_for_root |
497 |
|
498 |
- if [[ -e "${ROOT}${bindir}/emacs" && ! -L "${ROOT}${bindir}/emacs" ]]; then |
499 |
+ if [[ -e ${ROOT}${bindir}/emacs && ! -L ${ROOT}${bindir}/emacs ]]; then |
500 |
die -q "${ROOT}${bindir}/emacs exists but is not a symlink" |
501 |
fi |
502 |
|
503 |
@@ -243,30 +242,31 @@ |
504 |
} |
505 |
|
506 |
do_update() { |
507 |
- [[ -z "${1}" || "${1}" == "ifunset" || "${1}" == "--if-unset" ]] \ |
508 |
- || die -q "Usage error" |
509 |
- [[ ${#@} -gt 1 ]] && die -q "Too many parameters" |
510 |
+ [[ -z $1 || $1 = ifunset || $1 = --if-unset ]] || die -q "Usage error" |
511 |
+ [[ $# -gt 1 ]] && die -q "Too many parameters" |
512 |
test_for_root |
513 |
|
514 |
- if [[ -L "${ROOT}${bindir}/emacs" ]]; then |
515 |
- [[ ${1} == *if*unset \ |
516 |
- && -e $(canonicalise "${ROOT}${bindir}/emacs") ]] \ |
517 |
- && return |
518 |
+ if [[ -L ${ROOT}${bindir}/emacs ]]; then |
519 |
+ if [[ $1 == *if*unset && -e ${ROOT}${bindir}/emacs ]]; then |
520 |
+ do_action ctags update ifunset |
521 |
+ return |
522 |
+ fi |
523 |
# this is not redundant: "update" is called in pkg_postrm() of emacs |
524 |
# and should clean up any dead symlinks if no valid target exists |
525 |
remove_symlinks || die -q "Couldn't remove existing symlink" |
526 |
- elif [[ -e "${ROOT}${bindir}/emacs" ]]; then |
527 |
+ elif [[ -e ${ROOT}${bindir}/emacs ]]; then |
528 |
die -q "${ROOT}${bindir}/emacs exists but is not a symlink" |
529 |
fi |
530 |
|
531 |
local targets=( $(find_targets) ) |
532 |
if [[ ${#targets[@]} -gt 0 ]]; then |
533 |
- set_symlinks ${#targets[@]} || die -q "Couldn't set a new symlink" |
534 |
- elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then |
535 |
- # no Emacs target found -- link ctags, etags etc. to XEmacs versions |
536 |
+ set_symlinks "${targets[${#targets[@]}-1]}" \ |
537 |
+ || die -q "Couldn't set a new symlink" |
538 |
+ elif [[ -f ${ROOT}${bindir}/xemacs ]]; then |
539 |
+ # no Emacs target found - link to XEmacs versions |
540 |
set_symlinks xemacs nomain |
541 |
fi |
542 |
|
543 |
- # ctags symlinks are handled in an own module now |
544 |
+ # ctags and etags symlinks are handled in an own module |
545 |
do_action ctags update |
546 |
} |