Working with Emacs and Cygwin
I'm currently running emacs in Cygwin so that I can access to the gnu tools like grep, sed, etc. This entry details how I installed emacs on Cygwin to make it work for me.
1. Install Cygwin
Download the setup program from https://cygwin.com/ and install Cygwin.2. Install apt-get
apt-cyg is a Cygwin package manager. You don't have to use and can install all Cygwin applications using the setup program.To install apt-cyg:
- run the Cygwin Terminal shortcut as administrator
- enter the following in the terminal
lynx -source rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg
install apt-cyg /usr/local/bin
apt-cyg install unzip
apt-cyg install wget
3. Install cask
I'm playing around with using cask to manage my emacs packages. See the installation page for installation options.I simply cloned the repository in my ~ (home) directory.
git clone https://github.com/cask/cask.git ~/.cask
4. Install emacs
Run the following command in the Cygwin Terminal to install emacs.apt-cyg install emacs-w32
5. Customize bash
Open the bash initialization file using emacs.emacs .bash_profile
Enter the following. There are more example settings for bash on the Cywgin Customizing bash page.
#see https://cygwin.com/cygwin-ug-net/setup-files.html
# Ignore case while completing
set completion-ignore-case on
# Make Bash 8bit clean
set meta-flag on
set convert-meta offset output-meta on
# Variables for emacs server
export ALTERNATE_EDITOR=""
export EDITOR=emacsclient
# start emacs
# emacs --daemon
# emacsclient -c -n
# emacsclient -t
# Close emacs
# emacsclient -e '(kill-emacs)'
6. Emacs source TAGS
I wanted the source available for teh Emacs lisp files so that I could see how the functions were implemented. I downloaded the source files using the Cygwin setup program but I couldn't get it to build. Since I only wanted the lisp source files I decided to generate the TAG file manually.The source was copied to the /usr/src/emacs-24.5-2.src/. The source files are located in the emacs-24.5/lisp directory. I copied all the *.el files to the /usr/share/emacs/24.5/lisp directory.
To create the tags file run the following commands in the Cygwin Terminal. I've taken this from the MakeFile in the lisp src directory. I've taken this from the MakeFile in the lisp src directory.
cd /usr/share/emacs/24.5/lisp
echo ./*.el ./*/*.el ./*/*/*.el ./*/*/*/*.el | \
sed -e 's,./[^ ]*loaddefs[^ ]*,,g' \
-e 's,./ldefs-boot[^ ]*,,' \
-e 's,./[^ ]*esh-groups.el[^ ]*,,' | \
xargs "etags" -a -o TAGS
7. Ruby
I decided to install ruby using the following. See the websites for installation instructions.- ruby-install - https://github.com/postmodern/ruby-install#readme
- chruby - https://github.com/postmodern/chruby#readme
Add the following to .bashrc.
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
#Create version file to automatically enable ruby version.
echo "ruby-2.2.3" > ~/.ruby-version
Install the inf-ruby scripts for emacs.
cp ~/src/ruby-2.2.3/misc/* .emacs.d/vendor/