From ed87ba72282a8e5c2cd3f5631748726c930809bd Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 21 Oct 2016 11:55:32 +0200 Subject: emacs: trying to test it with travis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Files and idea taken from https://github.com/purcell/emacs.d. I've also added the bin/test directory into it. Signed-off-by: Miquel Sabaté Solà --- .travis.yml | 30 ++++++++++++++++++++++++++++++ README.md | 2 +- bin/test/test.sh | 5 +++-- emacs/init.el | 9 ++++++--- emacs/test-startup.sh | 22 ++++++++++++++++++++++ 5 files changed, 62 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100755 emacs/test-startup.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..75eaadc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +# The procedure for testing GNU Emacs was kindly taken from: +# https://github.com/purcell/emacs.d + +language: ruby + +before_install: + - git clone https://github.com/rejeep/evm.git $HOME/.evm + - export PATH=$HOME/.evm/bin:$PATH + + - evm config path /tmp + - evm install $EVM_EMACS --use --skip + +env: + - EVM_EMACS=emacs-24.4-travis + - EVM_EMACS=emacs-24.5-travis + - EVM_EMACS=emacs-25.1-travis + - EVM_EMACS=emacs-git-snapshot-travis + +matrix: + allow_failures: + - env: EVM_EMACS=emacs-git-snapshot-travis + +script: + # Testing GNU Emacs + - git clone https://github.com/mssola/soria.git + - cp soria/soria-theme.el emacs/soria-theme.el + - lsb_release -a && cd emacs && ./test-startup.sh + + # Testing scripts + - cd ../bin/test && ./test.sh diff --git a/README.md b/README.md index 7afe88c..633b87d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# dotfiles +# dotfiles [![Build Status](https://travis-ci.org/mssola/dotfiles.svg?branch=master)](https://travis-ci.org/mssola/dotfiles) To automatically install everything, just execute the `install.sh` script. Take a look at this script since it might perform some actions that are diff --git a/bin/test/test.sh b/bin/test/test.sh index 58a8530..f9f23a8 100755 --- a/bin/test/test.sh +++ b/bin/test/test.sh @@ -15,10 +15,12 @@ # along with this program. If not, see . # Back up the current files and get paths straight. +set -e dir="$( cd "$( dirname "$0" )" && pwd )" -license=$(realpath "$dir/../license") +license=$(readlink -f "$dir/../license") cp "$dir/main.cpp" "$dir/main.cpp.old" cp "$dir/README.md" "$dir/README.md.old" +set +e status=0 # license main.cpp @@ -46,4 +48,3 @@ else echo "OK" fi exit $status - diff --git a/emacs/init.el b/emacs/init.el index 7a3f8de..295c7ac 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -128,8 +128,10 @@ ;; Graphical interface tweaks (menu-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) +(when (fboundp 'set-scroll-bar-mode) + (set-scroll-bar-mode nil)) +(when (fboundp 'tool-bar-mode) + (tool-bar-mode -1)) ;; Lines and columns (line-number-mode 1) @@ -204,7 +206,7 @@ The user will end up in the *scratch* buffer." ;;; My lisp directory -(add-to-list 'load-path "~/.emacs.d/lisp") +(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) (require 'g) ;;; Packages @@ -214,6 +216,7 @@ The user will end up in the *scratch* buffer." ;; for Emacs out there. After trying some custom functions to handle ;; package-install, I decided on use-package because I feel more well-organized. (unless (package-installed-p 'use-package) + (package-refresh-contents) (package-install 'use-package)) (require 'use-package) diff --git a/emacs/test-startup.sh b/emacs/test-startup.sh new file mode 100755 index 0000000..d8f3547 --- /dev/null +++ b/emacs/test-startup.sh @@ -0,0 +1,22 @@ +#!/bin/sh -ex +# 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 + +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" -- cgit v1.2.3