Archive

Archive for the ‘Emacs’ Category

Installing ESS (Emacs Speaks Statistics)

20 April 2011 Leave a comment

Problem

You have a non-standard directory under which you install software. You have installed Emacs under this directory. Now you want to install ESS under this directory as well so that Emacs could interact with R.

Solution

Suppose your non-standard directory is

/scratch/username/usr

where username is your actual username. I assume that you have installed both Emacs and R under this directory. Download ESS and extract the downloaded tarball to

/scratch/username/usr/share/emacs/site-lisp

Edit your /home/username/.emacs by inserting the following lines:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     
;; ESS: Emacs Speaks Statistics, mainly for R
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;     

(load "/scratch/username/usr/share/emacs/site-lisp/ess-x.y.z/lisp/ess-site")
(setq inferior-R-program-name "/scratch/username/usr/bin/R")

Remember to replace “x.y.z” with the actual version number of ESS that you use. Now load Emacs and to use R from Emacs, enter the command

M-x R

This should bring up an R session from within Emacs. Here’s a screenshot for your viewing pleasure:

Advertisements

Haskell mode spews junk on first load

9 September 2010 Leave a comment

I’m using Haskell mode version 2.8.0 with Emacs 23.1.1 under Ubuntu 10.04.1 LTS. After loading a Haskell file, I would get the following garbage:

#[nil "\300C\207"
      [t]
      2]

Here’s what it looks like:

Acting on a tip from the ArchLinux community, I grep’d through all the Emacs Lisp files in the source distribution of Haskell mode 2.8.0 and found that the garbage in question is output by the following function in haskell-mode.el:

(eval-when-compile
  ;; Emacs 21 defines `values' as a (run-time) alias for list.                  
  ;; Don't maerge this with the pervious clause.                                
  (if (string-match "values"
                    (pp (byte-compile (lambda () (values t)))))
      (defsubst values (&rest values)
        values)))

The culprit is the line

(pp (byte-compile (lambda () (values t)))))

I commented out that whole function and the junk is no longer seen when I first load a Haskell file.

Debugging and Python programming tools

9 October 2009 1 comment