summaryrefslogtreecommitdiff
path: root/compute-lispdir.sh
blob: 553b579b305002659027a3a15b3c42f507014876 (plain)
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
#!/bin/bash
# Figures out a reasonable --prefix
typeset -i rc=0
typeset -i DEBUG=${DEBUG:-0}
EMACS_PROG=${EMACS_PROG:-emacs}
list=$($EMACS_PROG --batch --no-splash --no-site-file --eval '(message (substring (format "%s" load-path) 1 -1))' 2>&1)
rc=$?
if (( rc != 0 )) ; then
    echo  >&2 "Something went wrong running $EMACS_PROG"
    exit $rc
$cmd
fi
for dir in $list ; do
    if [[ -d $dir ]] ; then
	case $dir in
	    */emacs/site-lisp)
		((DEBUG)) && echo "site lisp: $dir"
		echo "$dir"
		exit 0
		;;
	esac
    fi
done
for dir in $list ; do
    if [[ -d $dir ]] ; then
	case $dir in
	    */emacs/2[5-8]\.[0-9]/site-lisp)
		((DEBUG)) && echo "versioned site lisp: $dir"
		echo "$dir"
		exit 0
		;;
	esac
    fi
done
for dir in $list ; do
    if [[ -d $dir ]] ; then
	case $dir in
	    */emacs/2[5-8]\.[0-9]/site-lisp)
		((DEBUG)) && echo "versioned site lisp: $dir"
		echo "$dir"
		exit 0
		;;
	esac
    fi
done
exit 0