aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/test-emacs.sh
blob: 89862d6358ca1cee8a695fe40530f2a03bffaa2d (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
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash -ex
# Some parts kindly taken from: https://github.com/purcell/emacs.d

if [ -n "$TRAVIS" ]; then
    # We still need to have an .emacs.d directory, so emacs-async (dependency of
    # some other package) is happy.
    export HOME=$PWD/..
    ln -s emacs ../.emacs.d
fi

##
# Linters.

mkdir -p vendor
wget -q -O vendor/elisp-lint.el https://raw.githubusercontent.com/gonewest818/elisp-lint/master/elisp-lint.el
wget -q -O vendor/package-lint.el https://raw.githubusercontent.com/purcell/package-lint/master/package-lint.el
wget -q -O vendor/dash.el https://raw.githubusercontent.com/magnars/dash.el/master/dash.el
LOAD_PATH="-L $(readlink -f -- vendor)"

# shellcheck disable=SC2039
pushd .

# God knows why this is needed, but `package-lint` bails otherwise...
mkdir -p vendor/data
echo "()" > vendor/data/stdlib-changes

for i in . lisp; do
    cd "$i"
    # shellcheck disable=SC2010
    # shellcheck disable=SC2035
    files="$(ls *.el | grep -v 'custom.el' | grep -v 'abbrevs.el' | grep -v 'lisp-autoloads.el' | grep -v '.emacs.d-autoloads.el' | grep -v 'soria-theme.el' | grep -v 'early-init.el' | xargs)"

    # shellcheck disable=SC2086
    ${EMACS:=emacs} -Q --batch ${LOAD_PATH} -l elisp-lint.el -f elisp-lint-files-batch $files

    # shellcheck disable=SC2086
    ${EMACS:=emacs} -Q --batch ${LOAD_PATH} -l package-lint.el -f package-lint-batch-and-exit $files
done

# shellcheck disable=SC2039
popd
rm -r vendor

##
# Startup.

echo "Attempting startup..."

${EMACS:=emacs} -nw --batch \
                --eval '(let ((debug-on-error t)
                              (url-show-status nil)
                              (user-emacs-directory default-directory)
                              (package-user-dir (expand-file-name (concat "elpa-" emacs-version)))
                              (custom-theme-directory default-directory)
                              (user-init-file (expand-file-name "init.el")))
                           (load-file user-init-file)
                           (run-hooks (quote after-init-hook)))'
echo "Startup successful"