Gentoo Archives: gentoo-commits

From: "Ulrich Mueller (ulm)" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] eselect r396 - in trunk: man modules
Date: Tue, 24 Mar 2009 21:09:57
Message-Id: E1LmDsf-0001xC-QN@stork.gentoo.org
1 Author: ulm
2 Date: 2009-03-24 21:09:53 +0000 (Tue, 24 Mar 2009)
3 New Revision: 396
4
5 Modified:
6 trunk/man/ctags.eselect.5
7 trunk/man/emacs.eselect.5
8 trunk/modules/ctags.eselect
9 trunk/modules/emacs.eselect
10 Log:
11 Sync from eselect-emacs-1.8 version.
12
13 Modified: trunk/man/ctags.eselect.5
14 ===================================================================
15 --- trunk/man/ctags.eselect.5 2008-10-29 14:31:45 UTC (rev 395)
16 +++ trunk/man/ctags.eselect.5 2009-03-24 21:09:53 UTC (rev 396)
17 @@ -1,29 +1,37 @@
18 -.\" Copyright 1999-2008 Gentoo Foundation
19 +.\" Copyright 2007-2008 Gentoo Foundation
20 .\" Distributed under the terms of the GNU General Public License v2
21 .\" $Id$
22 .\"
23 -.TH "ESELECT" "5" "May 2008" "Gentoo Linux" "eselect"
24 -.SH "NAME"
25 +.TH ESELECT 5 "December 2008" "Gentoo Linux" eselect
26 +.SH NAME
27 ctags.eselect, etags.eselect \- The ctags and etags management module
28 for Gentoo's eselect
29 -.SH "SYNOPSIS"
30 -\fBeselect ctags\fR [\fBhelp\fR|\fBusage\fR]
31 +.SH SYNOPSIS
32 +.B eselect ctags
33 +.RB [ help | usage ]
34 .br
35 -\fBeselect ctags list\fR
36 +.B eselect ctags list
37 .br
38 -\fBeselect ctags set\fR \fItarget\fR
39 +.B eselect ctags set
40 +.I target
41 .br
42 -\fBeselect ctags show\fR
43 +.B eselect ctags show
44 .br
45 -\fBeselect ctags update\fR
46 -.SH "DESCRIPTION"
47 -\fBeselect\fR is Gentoo's configuration and management tool. It features
48 -modules that care for the individual administrative tasks.
49 +.B eselect ctags update
50 +.SH DESCRIPTION
51 +.B eselect
52 +is Gentoo's configuration and management tool. It features modules
53 +that care for the individual administrative tasks.
54
55 -The \fBctags\fR and \fBetags\fR eselect modules share a common syntax,
56 -therefore this man page collectively refers to them as \fBctags\fR.
57 -.SH "ACTION: LIST"
58 -\fBeselect ctags list\fR
59 +The
60 +.B ctags
61 +and
62 +.B etags
63 +eselect modules share a common syntax, therefore this man page
64 +collectively refers to them as
65 +.BR ctags .
66 +.SH ACTION: LIST
67 +.B eselect ctags list
68 .br
69 List all installed ctags versions.
70
71 @@ -33,31 +41,34 @@
72 .br
73 [1] ctags-emacs-22 *
74 [2] exuberant-ctags
75 -.SH "ACTION: SET"
76 -\fBeselect ctags set\fR \fItarget\fR
77 +.SH ACTION: SET
78 +.B eselect ctags set
79 +.I target
80 .br
81 -Activates the selected ctags version. \fItarget\fR can be either an
82 -identification number given by \fBeselect ctags list\fR or the name of
83 -one installed version.
84 +Activate the selected ctags version.
85 +.I target
86 +can be either an identification number given by
87 +.B eselect ctags list
88 +or the name of one installed version.
89
90 # eselect ctags set 2
91 .br
92 Switching ctags to exuberant-ctags ...
93 -.SH "ACTION: SHOW"
94 -\fBeselect ctags show\fR
95 +.SH ACTION: SHOW
96 +.B eselect ctags show
97 .br
98 -Prints the currently activated ctags version.
99 +Print the currently activated ctags version.
100
101 # eselect ctags show
102 .br
103 Current target of symlink:
104 .br
105 exuberant-ctags
106 -.SH "ACTION: UPDATE"
107 -\fBeselect ctags update\fR
108 +.SH ACTION: UPDATE
109 +.B eselect ctags update
110 .br
111 -Update the ctags symlink. For an update only the version is changed,
112 -but not the provider (i.e. Emacs vs Exuberant). At the moment only
113 +Update the ctags symlink. For an update only the version is changed,
114 +but not the provider (i.e. Emacs vs Exuberant). At the moment only
115 (X)Emacs offers several concurrent versions.
116
117 # eselect ctags update
118 @@ -65,17 +76,22 @@
119 Switching ctags to exuberant-ctags ...
120 .br
121 Switching etags to etags-emacs-22 ...
122 -.SH "BUGS"
123 -Under FreeBSD, \fBeselect ctags\fR does not work since \fBctags\fR is
124 -a real binary, owned by package freebsd-ubin. (\fBeselect etags\fR
125 +.SH BUGS
126 +Under FreeBSD,
127 +.B eselect ctags
128 +does not work since
129 +.B ctags
130 +is a real binary, owned by package freebsd-ubin.
131 +.RB ( "eselect etags"
132 does work though.)
133
134 -\fBeselect etags\fR does not display any valid targets if there is no
135 -Emacs variant installed. This is a feature.
136 -.SH "AUTHOR"
137 +.B eselect etags
138 +does not display any valid targets if there is no Emacs variant
139 +installed. This is a feature.
140 +.SH AUTHOR
141 Ulrich Mueller <ulm@g.o>
142 -.SH "SEE ALSO"
143 +.SH SEE ALSO
144 .BR eselect (1),
145 .BR emacs.eselect (5)
146 -.SH "REVISION"
147 +.SH REVISION
148 $Id$
149
150 Modified: trunk/man/emacs.eselect.5
151 ===================================================================
152 --- trunk/man/emacs.eselect.5 2008-10-29 14:31:45 UTC (rev 395)
153 +++ trunk/man/emacs.eselect.5 2009-03-24 21:09:53 UTC (rev 396)
154 @@ -1,25 +1,29 @@
155 -.\" Copyright 1999-2008 Gentoo Foundation
156 +.\" Copyright 2007-2008 Gentoo Foundation
157 .\" Distributed under the terms of the GNU General Public License v2
158 .\" $Id$
159 .\"
160 -.TH "ESELECT" "5" "May 2008" "Gentoo Linux" "eselect"
161 -.SH "NAME"
162 +.TH ESELECT 5 "December 2008" "Gentoo Linux" eselect
163 +.SH NAME
164 emacs.eselect \- The Emacs management module for Gentoo's eselect
165 -.SH "SYNOPSIS"
166 -\fBeselect emacs\fR [\fBhelp\fR|\fBusage\fR]
167 +.SH SYNOPSIS
168 +.B eselect emacs
169 +.RB [ help | usage ]
170 .br
171 -\fBeselect emacs list\fR
172 +.B eselect emacs list
173 .br
174 -\fBeselect emacs set\fR \fItarget\fR
175 +.B eselect emacs set
176 +.I target
177 .br
178 -\fBeselect emacs show\fR
179 +.B eselect emacs show
180 .br
181 -\fBeselect emacs update\fR [\fIifunset\fR]
182 -.SH "DESCRIPTION"
183 -\fBeselect\fR is Gentoo's configuration and management tool. It features
184 -modules that care for the individual administrative tasks.
185 -.SH "ACTION: LIST"
186 -\fBeselect emacs list\fR
187 +.B eselect emacs update
188 +.RI [ ifunset ]
189 +.SH DESCRIPTION
190 +.B eselect
191 +is Gentoo's configuration and management tool. It features modules
192 +that care for the individual administrative tasks.
193 +.SH ACTION: LIST
194 +.B eselect emacs list
195 .br
196 List all installed Emacs versions and even informs you if XEmacs has
197 been found on your system.
198 @@ -31,12 +35,18 @@
199 [1] emacs-18
200 [2] emacs-21 *
201 [3] emacs-22
202 -.SH "ACTION: SET"
203 -\fBeselect emacs set\fR \fItarget\fR
204 +.SH ACTION: SET
205 +.B eselect emacs set
206 +.I target
207 .br
208 -Activates the selected Emacs version. \fItarget\fR can be either an
209 -identification number given by \fBeselect emacs list\fR or the name of
210 -one installed version.
211 +Activate the selected Emacs version.
212 +.I target
213 +can be either an identification number given by
214 +.B eselect emacs list
215 +or the name of one installed version. To avoid runtime issues with
216 +incompatible byte-code from the previously selected Emacs version, run
217 +.B emacs-updater -a rebuild
218 +to remerge all needed packages.
219
220 # eselect emacs set 3
221 .br
222 @@ -45,22 +55,23 @@
223 Switching ctags to ctags-emacs-22 ...
224 .br
225 Switching etags to etags-emacs-22 ...
226 -.SH "ACTION: SHOW"
227 -\fBeselect emacs show\fR
228 +.SH ACTION: SHOW
229 +.B eselect emacs show
230 .br
231 -Prints the currently activated Emacs version.
232 +Print the currently activated Emacs version.
233
234 # eselect emacs show
235 .br
236 Current target of GNU Emacs symlink:
237 .br
238 emacs-22
239 -.SH "ACTION: UPDATE"
240 -\fBeselect emacs update\fR [\fIifunset\fR]
241 +.SH ACTION: UPDATE
242 +.B eselect emacs update
243 +.RI [ ifunset ]
244 .br
245 -Update the emacs symlink to the last available version. If option
246 -[\fIifunset\fR] is given, an existing implementation is not
247 -overridden.
248 +Update the emacs symlink to the last available version. If option
249 +.I ifunset
250 +is given, an existing implementation is not overridden.
251
252 # eselect emacs update
253 .br
254 @@ -69,12 +80,12 @@
255 Switching ctags to ctags-emacs-22 ...
256 .br
257 Switching etags to etags-emacs-22 ...
258 -.SH "AUTHORS"
259 -Christian Faulhammer <opfer@g.o>
260 +.SH AUTHORS
261 +Christian Faulhammer <fauli@g.o>
262 .br
263 Ulrich Mueller <ulm@g.o>
264 -.SH "SEE ALSO"
265 +.SH SEE ALSO
266 .BR eselect (1),
267 .BR ctags.eselect (5)
268 -.SH "REVISION"
269 +.SH REVISION
270 $Id$
271
272 Modified: trunk/modules/ctags.eselect
273 ===================================================================
274 --- trunk/modules/ctags.eselect 2008-10-29 14:31:45 UTC (rev 395)
275 +++ trunk/modules/ctags.eselect 2009-03-24 21:09:53 UTC (rev 396)
276 @@ -1,4 +1,4 @@
277 -# Copyright 1999-2008 Gentoo Foundation
278 +# Copyright 2005-2008 Gentoo Foundation
279 # Distributed under the terms of the GNU General Public License v2
280 # $Id$
281 #
282 @@ -19,11 +19,15 @@
283 # do_set(): Set a version to be target of the symlink.
284 # do_update(): Set the target to the "best" available version. See below.
285
286 -# This module is used for ctags and etags
287 -#CTAGS=$(basename ${BASH_SOURCE%.*})
288 +# This module is used for ctags and etags.
289 +# Determine our name from ESELECT_MODULE_NAME, with BASH_SOURCE as fallback.
290 +#CTAGS=${ESELECT_MODULE_NAME:-$(basename "${BASH_SOURCE[0]%.*}")}
291 CTAGS=ctags
292
293 -DESCRIPTION="Manage /usr/bin/${CTAGS} implementations"
294 +bindir=/usr/bin
295 +man1dir=/usr/share/man/man1
296 +
297 +DESCRIPTION="Manage ${bindir}/${CTAGS} implementations"
298 MAINTAINER="emacs@g.o"
299 SVN_DATE='$Date$'
300 VERSION=$(svn_date_to_version "${SVN_DATE}" )
301 @@ -35,12 +39,12 @@
302 # currently active Emacs version (selected by emacs.eselect)
303 # The logic here is the same as in emacs.eselect, don't change it!
304 local emacs
305 - if [[ -L "${ROOT}/usr/bin/emacs" && \
306 - -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
307 - emacs=$(basename $(canonicalise "${ROOT}/usr/bin/emacs") )
308 - [[ -f "${ROOT}/usr/bin/${CTAGS}-${emacs}" ]] && echo ${CTAGS}-${emacs}
309 - elif [[ -f "${ROOT}/usr/bin/xemacs" ]]; then
310 - [[ -f "${ROOT}/usr/bin/${CTAGS}-xemacs" ]] && echo ${CTAGS}-xemacs
311 + if [[ -L "${ROOT}${bindir}/emacs" && \
312 + -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then
313 + emacs=$(basename $(readlink "${ROOT}${bindir}/emacs") )
314 + [[ -f "${ROOT}${bindir}/${CTAGS}-${emacs}" ]] && echo ${CTAGS}-${emacs}
315 + elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then
316 + [[ -f "${ROOT}${bindir}/${CTAGS}-xemacs" ]] && echo ${CTAGS}-xemacs
317 elif [[ ${CTAGS} == etags ]]; then
318 # We are called as etags module, but no (X)Emacs is installed.
319 # Return an empty list in this case, because we don't want
320 @@ -50,31 +54,31 @@
321 fi
322
323 # Exuberant ctags
324 - [[ -f "${ROOT}"/usr/bin/exuberant-ctags ]] && echo exuberant-ctags
325 + [[ -f "${ROOT}${bindir}/exuberant-ctags" ]] && echo exuberant-ctags
326 }
327
328 remove_symlinks() {
329 # Remove existing symlinks to binary and man page
330 - rm -f "${ROOT}"/usr/bin/${CTAGS}
331 - rm -f "${ROOT}"/usr/share/man/man1/${CTAGS}.1*
332 + rm -f "${ROOT}${bindir}/${CTAGS}" \
333 + "${ROOT}${man1dir}"/${CTAGS}.1*
334 }
335
336 set_bin_symlinks() {
337 # Set symlink to binary
338 local target=${1}
339 - ln -s "${target}" "${ROOT}/usr/bin/${CTAGS}" \
340 - || die "Couldn't set ${target} ${ROOT}/usr/bin/${CTAGS} symlink"
341 + ln -s "${target}" "${ROOT}${bindir}/${CTAGS}" \
342 + || die "Couldn't set ${target} ${ROOT}${bindir}/${CTAGS} symlink"
343 }
344
345 set_man_symlinks() {
346 # Set symlink to man page
347 local target=${1} extension i
348 - for i in "${ROOT}"/usr/share/man/man1/${target}.1*; do
349 + for i in "${ROOT}${man1dir}"/${target}.1*; do
350 if [[ -f ${i} ]]; then
351 # target file exists; determine compress extension
352 extension=${i##*/${target}.1}
353 ln -s "${target}.1${extension}" \
354 - "${ROOT}/usr/share/man/man1/${CTAGS}.1${extension}"
355 + "${ROOT}${man1dir}/${CTAGS}.1${extension}"
356 fi
357 done
358 }
359 @@ -92,7 +96,7 @@
360 fi
361
362 # is the target valid, i.e. does a ctags binary with this name exist?
363 - [[ -f "${ROOT}/usr/bin/${target}" ]] \
364 + [[ -f "${ROOT}${bindir}/${target}" ]] \
365 || die -q "Target \"${1}\" doesn't appear to be valid!"
366
367 echo "Switching ${CTAGS} to ${target} ..."
368 @@ -104,7 +108,7 @@
369
370 test_for_root() {
371 # checks if the user has rights to modify /usr/bin/
372 - [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
373 + [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!"
374 }
375
376 ### show action ###
377 @@ -117,11 +121,11 @@
378 [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
379
380 write_list_start "Current target of ${CTAGS} symlink:"
381 - if [[ -L "${ROOT}/usr/bin/${CTAGS}" && \
382 - -e $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ]]; then
383 + if [[ -L "${ROOT}${bindir}/${CTAGS}" && \
384 + -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then
385 write_kv_list_entry \
386 - $(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ) ""
387 - elif [[ -e "${ROOT}/usr/bin/${CTAGS}" ]]; then
388 + $(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) ""
389 + elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then
390 write_kv_list_entry \
391 "(not a symlink or target of symlink does not exist)" ""
392 else
393 @@ -145,7 +149,7 @@
394 for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do
395 # Display a star to indicate the currently chosen version
396 [[ ${targets[${i}]} = \
397 - $(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ) ]] \
398 + $(basename $(readlink "${ROOT}${bindir}/${CTAGS}") ) ]] \
399 && targets[${i}]="${targets[${i}]} $(highlight '*')"
400 done
401 write_list_start "Available ${CTAGS} symlink targets:"
402 @@ -174,9 +178,9 @@
403 [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
404 test_for_root
405
406 - if [[ -e "${ROOT}/usr/bin/${CTAGS}" && ! -L "${ROOT}/usr/bin/${CTAGS}" ]]
407 + if [[ -e "${ROOT}${bindir}/${CTAGS}" && ! -L "${ROOT}${bindir}/${CTAGS}" ]]
408 then
409 - die -q "Sorry, ${ROOT}/usr/bin/${CTAGS} exists but is not a symlink"
410 + die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
411 fi
412
413 set_symlinks "${1}" || die -q "Couldn't set a new symlink"
414 @@ -194,15 +198,15 @@
415 test_for_root
416
417 local current=""
418 - if [[ -L "${ROOT}/usr/bin/${CTAGS}" ]]; then
419 - current=$(basename $(canonicalise "${ROOT}/usr/bin/${CTAGS}") )
420 - if [[ ! -e $(canonicalise "${ROOT}/usr/bin/${CTAGS}") ]]; then
421 + if [[ -L "${ROOT}${bindir}/${CTAGS}" ]]; then
422 + current=$(basename $(readlink "${ROOT}${bindir}/${CTAGS}") )
423 + if [[ ! -e $(canonicalise "${ROOT}${bindir}/${CTAGS}") ]]; then
424 # clean up dead symlinks
425 remove_symlinks || die -q "Couldn't remove existing symlink"
426 fi
427 - elif [[ -e "${ROOT}/usr/bin/${CTAGS}" ]]; then
428 + elif [[ -e "${ROOT}${bindir}/${CTAGS}" ]]; then
429 if ! [[ ${CTAGS} == ctags && $(uname) == FreeBSD ]]; then
430 - die -q "Sorry, ${ROOT}/usr/bin/${CTAGS} exists but is not a symlink"
431 + die -q "${ROOT}${bindir}/${CTAGS} exists but is not a symlink"
432 fi
433 # On FreeBSD ctags is a real file, installed by freebsd-ubin
434 current=nolink
435
436 Modified: trunk/modules/emacs.eselect
437 ===================================================================
438 --- trunk/modules/emacs.eselect 2008-10-29 14:31:45 UTC (rev 395)
439 +++ trunk/modules/emacs.eselect 2009-03-24 21:09:53 UTC (rev 396)
440 @@ -1,4 +1,4 @@
441 -# Copyright 1999-2007 Gentoo Foundation
442 +# Copyright 2005-2008 Gentoo Foundation
443 # Distributed under the terms of the GNU General Public License v2
444 # $Id$
445 #
446 @@ -20,44 +20,49 @@
447 # do_update(): Set the target to the highest version available
448 # (optionally: only if not set)
449
450 -DESCRIPTION="Manage /usr/bin/emacs version"
451 +bindir=/usr/bin
452 +man1dir=/usr/share/man/man1
453 +infodir=/usr/share/info
454 +envdir=/etc/env.d
455 +
456 +DESCRIPTION="Manage ${bindir}/emacs version"
457 MAINTAINER="emacs@g.o"
458 SVN_DATE='$Date$'
459 VERSION=$(svn_date_to_version "${SVN_DATE}" )
460
461 # ctags and etags are handled in their own module
462 BINARYLIST="emacsclient b2m ebrowse rcs-checkin grep-changelog"
463 -MANPAGELIST="emacs emacsclient gfdl"
464 +MANPAGELIST="emacs emacsclient ebrowse gfdl"
465
466 find_targets() {
467 # Return the list of available Emacs binaries
468 local j
469 - for j in "${ROOT}"/usr/bin/emacs-[0-9]*; do
470 + for j in "${ROOT}${bindir}"/emacs-[0-9]*; do
471 [[ -f ${j} ]] && basename ${j}
472 done
473 }
474
475 remove_infopath() {
476 # When cleaning symlinks this takes care of the info documentation settings
477 - rm -f "${ROOT}/etc/env.d/50emacs"
478 + rm -f "${ROOT}${envdir}/50emacs"
479 }
480
481 # Define INFOPATH environment variable in env file
482 set_infopath() {
483 - [[ -d "${ROOT}"/usr/share/info/${1} ]] || return 1
484 - echo "INFOPATH=/usr/share/info/${1}" > "${ROOT}/etc/env.d/50emacs"
485 + [[ -d "${ROOT}${infodir}/${1}" ]] || return 1
486 + echo "INFOPATH=${infodir}/${1}" > "${ROOT}${envdir}/50emacs"
487 }
488
489 remove_symlinks() {
490 # Remove existing symlinks to binaries, man pages,
491 # and the env file (own function)
492 local f
493 - rm -f "${ROOT}"/usr/bin/emacs
494 + rm -f "${ROOT}${bindir}/emacs"
495 for f in ${BINARYLIST}; do
496 - rm -f "${ROOT}"/usr/bin/${f}
497 + rm -f "${ROOT}${bindir}/${f}"
498 done
499 for f in ${MANPAGELIST}; do
500 - rm -f "${ROOT}"/usr/share/man/man1/${f}.1*
501 + rm -f "${ROOT}${man1dir}"/${f}.1*
502 done
503 remove_infopath
504 }
505 @@ -67,9 +72,9 @@
506 local target=${1} f
507 for f in ${BINARYLIST}; do
508 # set symlink only if target binary actually exists
509 - if [[ -f "${ROOT}/usr/bin/${f}-${target}" ]]; then
510 - ln -s "${f}-${target}" "${ROOT}/usr/bin/${f}" ||
511 - die "Couldn't set ${f}-${target} ${ROOT}/usr/bin/${f} symlink"
512 + if [[ -f "${ROOT}${bindir}/${f}-${target}" ]]; then
513 + ln -s "${f}-${target}" "${ROOT}${bindir}/${f}" ||
514 + die "Couldn't set ${f}-${target} ${ROOT}${bindir}/${f} symlink"
515 fi
516 done
517 }
518 @@ -78,12 +83,12 @@
519 # Set symlinks to man pages
520 local target=${1} extension f i
521 for f in ${MANPAGELIST}; do
522 - for i in "${ROOT}"/usr/share/man/man1/${f}-${target}.1*; do
523 + for i in "${ROOT}${man1dir}"/${f}-${target}.1*; do
524 if [[ -f ${i} ]]; then
525 # target file exists; determine compress extension
526 extension=${i##*/${f}-${target}.1}
527 ln -s "${f}-${target}.1${extension}" \
528 - "${ROOT}/usr/share/man/man1/${f}.1${extension}"
529 + "${ROOT}${man1dir}/${f}.1${extension}"
530 fi
531 done
532 done
533 @@ -91,7 +96,7 @@
534
535 set_symlinks() {
536 # Set symlinks to binaries and man pages, update info path
537 - local target="${1}" targets
538 + local target="${1}" nomain="${2}" targets
539 # target may be specified by its name or its index
540 if is_number "${target}"; then
541 # numeric index, find the target's name
542 @@ -102,16 +107,16 @@
543 fi
544
545 # is the target valid, i.e. does an Emacs binary with this name exist?
546 - [[ -f "${ROOT}/usr/bin/${target}" ]] \
547 + [[ -f "${ROOT}${bindir}/${target}" ]] \
548 || die -q "Target \"${1}\" doesn't appear to be valid!"
549
550 echo "Switching emacs to ${target} ..."
551 remove_symlinks || die -q "Couldn't remove existing symlink"
552 # the main /usr/bin/emacs symlink is only set for Emacs binaries
553 # (but not for other providers of auxiliary programs, e.g., XEmacs)
554 - if [[ ${target} == emacs-* ]]; then
555 - ln -s "${target}" "${ROOT}/usr/bin/emacs" \
556 - || die "Couldn't set ${target} ${ROOT}/usr/bin/emacs symlink"
557 + if [[ -z ${nomain} ]]; then
558 + ln -s "${target}" "${ROOT}${bindir}/emacs" \
559 + || die "Couldn't set ${target} ${ROOT}${bindir}/emacs symlink"
560 fi
561 set_bin_symlinks "${target}"
562 set_man_symlinks "${target}"
563 @@ -127,7 +132,7 @@
564 xemacs_info() {
565 # This is just informational to tell that XEmacs has been found,
566 # a wish from graaff
567 - if [[ -e "${ROOT}/usr/bin/xemacs" ]]; then
568 + if [[ -e "${ROOT}${bindir}/xemacs" ]]; then
569 echo
570 write_list_start "XEmacs is also installed"
571 fi
572 @@ -135,15 +140,15 @@
573
574 vim_info() {
575 # Don't take this too serious
576 - if [[ -e "${ROOT}/usr/bin/vi" ]]; then
577 + if [[ -e "${ROOT}${bindir}/vi" ]]; then
578 echo
579 - write_list_start "Vi found, your system is in real trouble now!"
580 + write_list_start "Vi found, your system is in real trouble now! ;)"
581 fi
582 }
583
584 test_for_root() {
585 # checks if the user has rights to modify /usr/bin/
586 - [[ -w "${ROOT}/usr/bin" ]] || die -q "You need to be root!"
587 + [[ -w "${ROOT}${bindir}" ]] || die -q "You need root privileges!"
588 }
589
590 ### show action ###
591 @@ -155,12 +160,12 @@
592 do_show() {
593 [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
594
595 - write_list_start "Current target of GNU Emacs symlink:"
596 - if [[ -L "${ROOT}/usr/bin/emacs" && \
597 - -e $(canonicalise "${ROOT}/usr/bin/emacs") ]]; then
598 + write_list_start "Current target of Emacs symlink:"
599 + if [[ -L "${ROOT}${bindir}/emacs" && \
600 + -e $(canonicalise "${ROOT}${bindir}/emacs") ]]; then
601 write_kv_list_entry \
602 - $(basename $(canonicalise "${ROOT}/usr/bin/emacs") ) ""
603 - elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
604 + $(basename $(readlink "${ROOT}${bindir}/emacs") ) ""
605 + elif [[ -e "${ROOT}${bindir}/emacs" ]]; then
606 write_kv_list_entry \
607 "(not a symlink or target of symlink does not exist)" ""
608 else
609 @@ -186,10 +191,10 @@
610 for (( i = 0; i < ${#targets[@]}; i = i + 1 )); do
611 # Display a star to indicate the currently chosen version
612 [[ ${targets[${i}]} = \
613 - $(basename $(canonicalise "${ROOT}/usr/bin/emacs") ) ]] \
614 + $(basename $(readlink "${ROOT}${bindir}/emacs") ) ]] \
615 && targets[${i}]="${targets[${i}]} $(highlight '*')"
616 done
617 - write_list_start "Available GNU Emacs symlink targets:"
618 + write_list_start "Available Emacs symlink targets:"
619 write_numbered_list "${targets[@]}"
620 else
621 write_kv_list_entry "(none found)" ""
622 @@ -217,8 +222,8 @@
623 [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
624 test_for_root
625
626 - if [[ -e "${ROOT}/usr/bin/emacs" && ! -L "${ROOT}/usr/bin/emacs" ]]; then
627 - die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink"
628 + if [[ -e "${ROOT}${bindir}/emacs" && ! -L "${ROOT}${bindir}/emacs" ]]; then
629 + die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
630 fi
631
632 set_symlinks "${1}" || die -q "Couldn't set a new symlink"
633 @@ -243,22 +248,23 @@
634 [[ ${#@} -gt 1 ]] && die -q "Too many parameters"
635 test_for_root
636
637 - if [[ -L "${ROOT}/usr/bin/emacs" ]]; then
638 - [[ ${1} == *if*unset && -e $(canonicalise "${ROOT}/usr/bin/emacs") ]] \
639 + if [[ -L "${ROOT}${bindir}/emacs" ]]; then
640 + [[ ${1} == *if*unset \
641 + && -e $(canonicalise "${ROOT}${bindir}/emacs") ]] \
642 && return
643 # this is not redundant: "update" is called in pkg_postrm() of emacs
644 # and should clean up any dead symlinks if no valid target exists
645 remove_symlinks || die -q "Couldn't remove existing symlink"
646 - elif [[ -e "${ROOT}/usr/bin/emacs" ]]; then
647 - die -q "Sorry, ${ROOT}/usr/bin/emacs exists but is not a symlink"
648 + elif [[ -e "${ROOT}${bindir}/emacs" ]]; then
649 + die -q "${ROOT}${bindir}/emacs exists but is not a symlink"
650 fi
651
652 local targets=( $(find_targets) )
653 if [[ ${#targets[@]} -gt 0 ]]; then
654 set_symlinks ${#targets[@]} || die -q "Couldn't set a new symlink"
655 - elif [[ -f "${ROOT}/usr/bin/xemacs" ]]; then
656 + elif [[ -f "${ROOT}${bindir}/xemacs" ]]; then
657 # no Emacs target found -- link ctags, etags etc. to XEmacs versions
658 - set_symlinks xemacs
659 + set_symlinks xemacs nomain
660 fi
661
662 # ctags symlinks are handled in an own module now