Emacs setup

rvirding edited this page Sep 13, 2010 · 5 revisions

Getting emacs to find LFE mode

Put the following in your ~/.emacs:

  ;; LFE mode.
  ;; Set lfe-dir to point to where the lfe emacs files are.
  (defvar lfe-dir (concat (getenv "HOME") "/git/lfe/emacs"))
  (setq load-path (cons lfe-dir load-path))
  (require 'lfe-start)

Poor mans SLIME (courtesy ’cadar)

Create a shell script in your top LFE dir and name it run, like:


function send {
    screen -X stuff "$1"
    sleep 0.02

send $"$(cat myhistory)"
send $'\n'

Then add to your ~/.emacs:

(global-set-key (kbd "<f12>") 'my-save-and-compile)
(defun my-save-and-compile ()
  (interactive "")
  (save-buffer 0)
  (compile "./run"))

Now, if you run your LFE REPL in a screen session, you can eval your content in your myhistory file
from an Emacs buffer by pressing F12. Example:

(slurp '"src/prelude.lfe")
(: prelude take 3 '(1 2 3 4 5 6))
; ...now press F12 and watch the above be evaluated in your REPL...