вторник, 25 января 2011 г.

My Emacs = SBCL + SLIME, and other voodoo

First of all at the beginning of my way I was faced with the choise of development environment. In LISP as well as in Haskell. When I started to work with LISP, I tried some environments in Windows (CLISP) and the same environment in UNiX OS, Ubuntu 10.10. After the certain time I decided that its not enough for work. 'Cause it have no relation between text editor and directly CLISP. Its very inconvenient. So I began to search for something more comfortable. And I found the Thing, call Emacs. After reviewing several forum on this topic, I found out that Emacs its the Great Devil's Plan. It is very difficult and multyform, 'cause you can create you own built of emacs, and configure files it's the private treasure of each developer. But Emacs - only text editor (yes, it was great simplification), and I need the CLISP module or something like that. Surfing the Internet, I found pack: Emacs + SLIME + SBCL. What is it. Step by step:
      - Emacs - text-editor and the base of all other modules;
      - Slime - Superior Lisp Interaction Mode for Emacs. Lisp in propia persona.
      - SBCL - Steel Bank Common Lisp. Common Lisp compiler.
Sooooo. I found that I want. Lets install it! I will decribe the installation's steps of this software in Ubuntu 10.10.

Step1: Installing aptitude package. Open terminal and type:
       sudo apt-get install aptitude
       Wait while it download and install.

Step2: Installing Emacs, SLIME and SBCL. Terminal, type:
           sudo aptitude install -y emacs slime cl-asdf sbcl
            Wait. Voila. It has installed.

Step3: Configure your Emacs.(NOTICE. This configuration is not mine. But I tested it)
       Running Emacs. Open Emacs configuration file - press C-x C-f (if you have no the .emacs file, it will be create. It is normal). And copy this configuration to this file:

 ;; Set up the Common Lisp environment
 (add-to-list 'load-path "/usr/share/common-lisp/source/slime/")
 (setq inferior-lisp-program "/usr/bin/sbcl")
 (require 'slime)
 (slime-setup)


Now you have working copy of Emacs and you can use the SLIME-mode, as well.

Next step - configure Emacs for you. Add to .emacs file:

 ;; Text and the such
 ;; Use colors to highlight commands, etc.
 (global-font-lock-mode t)
 ;; Disable the welcome message
 (setq inhibit-startup-message t)
 ;; Format the title-bar to always include the buffer name
 (setq frame-title-format "emacs - %b")
 ;; Display time
 (display-time)
 ;; Make the mouse wheel scroll Emacs
 (mouse-wheel-mode t)
 ;; Always end a file with a newline
 (setq require-final-newline t)
 ;; Stop emacs from arbitrarily adding lines to the end of a file when the
 ;; cursor is moved past the end of it:
 (setq next-line-add-newlines nil)
 ;; Flash instead of that annoying bell
 (setq visible-bell t)
 ;; Remove icons toolbar
 (if (> emacs-major-version 20)
 (tool-bar-mode -1))
 ;; Use y or n instead of yes or not
 (fset 'yes-or-no-p 'y-or-n-p)


And the last part of configuration - color settings of text, commands, etc. Add:


 (defun faces_x ()
 ;; these are used when in X
 (custom-set-faces
 '(default ((t (:foreground "wheat" :background "black"))))
 '(flyspell-duplicate ((t (:foreground "Gold3" :underline t :weight normal))))
 '(flyspell-incorrect ((t (:foreground "OrangeRed" :underline t :weight normal))))
 '(font-lock-comment-face ((t (:foreground "SteelBlue1"))))
 '(font-lock-function-name-face ((t (:foreground "gold"))))
 '(font-lock-keyword-face ((t (:foreground "springgreen"))))
 '(font-lock-type-face ((t (:foreground "PaleGreen"))))
 '(font-lock-variable-name-face ((t (:foreground "Coral"))))
 '(menu ((((type x-toolkit)) (:background "light slate gray" :foreground "wheat" :box  (:line-width 2 :color "grey75" :style released-button)))))
 '(mode-line ((t (:foreground "black" :background "light slate gray"))))
 '(tool-bar ((((type x w32 mac) (class color)) (:background "midnight blue" :foreground  "wheat" :box (:line-width 1 :style released-button))))))
 (set-cursor-color "deep sky blue")
 (set-foreground-color "wheat")
 (set-background-color "black")
 (set-face-foreground 'default "wheat")
 (set-face-background 'default "black"))
 (defun faces_nox ()
 ;; these are used when in terminal
 (custom-set-faces
 '(default ((t (:foreground "white" :background "black"))))
 '(font-lock-comment-face ((t (:foreground "magenta"))))
 '(font-lock-function-name-face ((t (:foreground "red"))))
 '(font-lock-keyword-face ((t (:foreground "green"))))
 '(font-lock-type-face ((t (:foreground "blue"))))
 '(font-lock-string-face ((t (:foreground "cyan"))))
 '(font-lock-variable-name-face ((t (:foreground "blue"))))
 '(menu ((((type x-toolkit)) (:background "white" :foreground "black" :box (:line-width 2  :color "grey75" :style released-button)))))
 '(modeline ((t (:foreground "blue" :background "white")))))
 (set-cursor-color "blue")
 (set-foreground-color "white")
 (set-background-color "black")
 (set-face-foreground 'default "white")
 (set-face-background 'default "black"))
 (if window-system
 (faces_x)
 (faces_nox))


Thats all. Use your Emacs and be happy.

Комментариев нет:

Отправить комментарий