EMACS setup notes

Installation instructions for the various programs I use with EMACS


WindowsXP

R

Download and install R from Cran. I am using version 2.11.1. Sequence manipulation algorithms require the seqinr package v2.0-9 to be installed in R. Launch the gui and select Packages/Install Packages… Select a Cran mirror, then select the package “seqinr”. Packages can also be installed from the command line, once you have R running in EMACS. Use the comand:

1
install.packages("seqinr")

EMACS

Install EMACS. I am using version 23.2

Set up some speed keys:

1
2
3
4
5
6
7
8

(defun load-and-run-fave-file()
(interactive)
(find-file "~/owncloud/markov-elear/src/markov_elear/generator.clj"))


(global-set-key (kbd "<f6>") 'load-and-run-fave-file)
(global-set-key (kbd "<f10>") 'primer-db-main)

ESS

Install ESS. I am using version 5.8. Unzip the files as a subdirectory to c:/emacs-23.2/site-lisp. You must include in your .emacs file:

1
(require 'ess-site)

Start EMACS. If ESS and R have been properly installed and configured, you should see:

“Finding all versions of R on your system…”

in the minibuffer during startup. Launch R with the command “M-x R”. You should be able to enter R commands at the > prompt and see the output.

To make working with R more convenient, I include the following in my .emacs file:

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
;;__________________________________________________________________________
;;;; R Setup
(require 'ess-site)

(defun my-ess-mode ()
(interactive)
(cond ((string= "R" ess-dialect)
(message "my-r-mode")
;; customization for ESS[R] here
(define-key ess-mode-map '[f5] 'ess-eval-region-and-go))))

;and then hook this into the appropriate place:

(add-hook 'ess-mode-hook 'my-ess-mode)

;;__________________________________________________________________________
;;;; Programming - Elisp

(add-hook 'emacs-lisp-mode-hook
'(lambda ()
(interactive)
(require 'eldoc)
(turn-on-eldoc-mode)
(define-key emacs-lisp-mode-map [f5] 'eval-region)
(define-key emacs-lisp-mode-map [f4] 'eval-buffer)))

This allows me to use F5 to evaluate a region whether I am in R or Lisp. I also define the following function key shortcuts to streamline the loading of different files of interest. If you decide not to define these keys, you will need to load the files manually using the command “M-x my-favorite-file”.

1
2
3
4
5
6
7
(global-set-key (kbd "&lt;F6>") 'load-and-run-fave-file)
(global-set-key (kbd "&lt;F10>") 'exe-my-fave-method)

(defun load-and-run-fave-file()
(interactive)
(load "my-favorite-file.el"))

If ess is not finding R, check your PATH variable and make sure the R executable is listed.

Clustalw2

Install clustalw2 which performs the sequence alignments. Download the clustalw-2.0.11-win.msi file and allow it to install in c:\Program Files.

Package.el

Try to use Melpa stable only. At least for Clojure compatibility, MELPA unstable introduces bugs.

update MELPA packages (note capital U)

1
M-x package-list-packages U x  
1
M-x package-refresh-contents

Init.el

I switched from ~/.emacs to ~/.emacs.d/init.el
Furthermore I want all of .emacs.d to be in my ~/syncd directory for easy cloud backup.
I need to change the properties of the launch icon to redirect to ~/syncd/.emacs.d/init.el and set the user-emacs-directory variable early in init.el

Properties of the launch icon can only be modified by root so sudo edit /usr/share/applications/GNU Emacs 25 (GUI)

#nautilus
navigate to /usr/share/applications/GNU Emacs 25 (GUI) and chage properties to: /usr/bin/emacs25 %F -q –load “/home/mbc/syncd/.emacs.d/init.el”

%F allows multiple files as arguments.

The first line in init.el is (setq user-emacs-directory “/home/mbc/syncd/.emacs.d/“)

11/01/2019

Working with emacs26

#nautilus
navigate to /usr/share/applications/emacs.desktop and change the line to:
Exec=/usr/bin/emacs %F -q -load /home/mbc/syncd/.emacs.d/init.el

Useful Packages

eldoc: provides method documentation

company: auto completes

ido: provides selection lists e.g. for navigating directories

Share