Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

July 2004
Sun Mon Tue Wed Thu Fri Sat
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 26 27 28 29 30 31
Jun  Aug

Open CL files in SLIME from the ACL IDE

Tuesday, July 20, 2004

In the past, I've shown how you can setup SLIME for a number of different CL implementations under MS Windows. However, some people have expressed an interest in using SLIME/Emacs as the default editor from the ACL IDE under MS Windows in a manner similar to how ELI can be configured as the default editor. I've worked out a (somewhat kludgey) way to do this. Here's how:

  1. In the ACL IDE, select the Tools/Options menu item. Click on the "Editor" tab and tick the "Open files in GNU Emacs" option. Save the options and exit the ACL IDE.
  2. Enter the statements at the end of this posting into your .emacs (Note: they are standalone and will serve as a minimal .emacs) file, adjusting directory locations as necessary.
  3. That's it!
To use, just start up Emacs. The statements below will kick off the ACL IDE. They also enable ELI (Franz's own Emacs Lisp mode). However, the code will suppress the ELI menus and ELI REPL and attach SLIME in place of ELI to Lisp modes. Now, you can open files in the ACL IDE and they will be automatically opened in Emacs/SLIME. Enjoy!
;; Set the ELI & SLIME directories as appropriate
(setq load-path (append (list "c:/usr/home/site/slime"
			      "c:/bin/acl-7.0/eli")
			load-path))
;; Setup ELI for ACL (setq fi:common-lisp-image-name "c:/bin/acl-7.0/allegro-ansi.exe") (setq fi:common-lisp-directory "c:/bin/acl-7.0/") (setq fi:common-lisp-image-arguments '("-L" "c:/usr/home/.slime.lisp")) (load "fi-site-init") (defun fi::initialize-menu-bar-map ()) ; don't display the ELI menus (fi:common-lisp fi:common-lisp-buffer-name fi:common-lisp-directory fi:common-lisp-image-name fi:common-lisp-image-arguments fi:common-lisp-host)
;; Re-load lisp-mode so that ELI's common-lisp-mode doesn't replace lisp-mode ;; This also gets rid of ELI's keybindings (load "lisp-mode")
;; Specify mode for Lisp file extensions (setq auto-mode-alist (append '(("\.lisp$" . lisp-mode) ("\.lsp$" . lisp-mode) ("\.cl$" . lisp-mode) ("\.asd$" . lisp-mode) ("\.system$" . lisp-mode) )auto-mode-alist))
;; Now configure SLIME as the default mode for CL (require 'slime) (add-hook 'lisp-mode-hook (lambda () (slime-mode t) (define-key lisp-mode-map [(control j)] 'newline) (define-key lisp-mode-map [(control m)] 'newline-and-indent) (set (make-local-variable lisp-indent-function) 'common-lisp-indent-function))) (add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t))) (slime-autodoc-mode)
;; Start up SLIME and get rid of the ELI listener buffer (slime-connect "localhost" 4005) (sleep-for .1) (kill-buffer "*common-lisp*")

emacs Copyright © 2005 by Bill Clementson