This page last changed on 2008-09-15 by pjetter.
Emacs basics
--------------------

* C-x means *hold* control and press x.  C-x f means hold control,
  press x, release control and then press f.

* M-x (hold ALT and press x) runs the command
  execute-extended-command.  Use this to run slime-connect.

* "point" means the cursor


Basic keys:

C-x C-c
  Quit emacs.

C-x C-f
  Opens or creates a file. Opening a directory starts the file
  manager.

C-x C-s
  Saves a buffer to file.

C-x k
  Closes a buffer (file).

C-x C-k
  Closes current buffer (not default in emacs, added by
  load-recommended-settings).

C-g or ESC ESC ESC
  Cancel command.

C-SPC
  Activate region, use this to select a piece of text.

C-w
  Cut region (kill region).

C-k
  Cut line.

M-w
  Copy region (kill-ring-save).

C-y
  Yank (paste).

C-x C-b
  Show bufferlist.  In the electric buffer list you can easily change to
  another buffer.

C-x b
  Switch to another buffer.

C-s
  Incremental search. Type a string to find it in the current buffer.

C-x 2
  Split window

  Note: "window" means the area inside the real window, this area
  can be split into multiple areas, each showing a different buffer.
  In Emacs, a "frame" means a real window.

C-x 1
  Close all other windows.

C-x 0
  Close this window.

C-x o
  Switch to other window.

 
More commands can be found by exploring the menus.


-----------------------------------------------

Slime basic commands

Slime commands only work in a lisp buffer (usually a file whose
extension is ".lisp") or in the slime REPL.


C-c C-c
  Compile top-level s-expression at point.

C-x C-e
  Evaluate s-expression at point.

C-c C-k
  Compile current file.

S-TAB
  Slime complete symbol.  I.e. "mvb" ==> "multiple-value-bind" (with fuzzy completion)

C-c C-d d
  Desribe symbol at point

C-c C-d h
  Lookup symbol online in the Common Lisp Hyperspec

C-c C-d a
  Slime apropos.  Show a list of all symbols containing the specified string.

C-c i
  Slime inspect.  Inspects an object.

M-.
  Jump to definition.

M-,
  Jump back.

C-M-q
  Indent s-expression after point.


In the REPL:

M-p
  Previous command.

M-n
  Next command.


In the debugger:

v
  Show source (jumps to call site).

q
  Quit debugger.

a
  Abort to top-level.


-----------------------------------------------

;; Some puls-specific functions and macros

;; Define a page in hunchentoot.  It's immediately visible at the given
;; uri.

(defpage (test :uri "/test") (foo)
  (:html (:p "adssad")
    (:p (str foo))))

(defpage (foo :uri "/foo") ()
  (:html (:p "adssad")
    (:p (link* "Mun linkki" "/test" 'foo 100 'bar "moi"))
    (:p (form "/test" "foo"))))


;; Define a function that produces html.

(defhtml form (action name)
  (:form :action action
         (:input :type "text" :name name)
         (:input :type "submit")))

;; Note that the html code is written to the stream *http-stream*.  If
;; you want to catch the entire output of this function to a string, one
;; must shadow *http-stream* with WITH-OUTPUT-TO-STRING, so that
;; *http-stream* will in fact refer to another stream, one that goes into
;; our string.

(with-output-to-string (*http-stream*)
  (form "foo" "hello"))

;; This will return the string

;; <form action='foo'>
;;   <input type='text' name='hello' />
;;   <input type='submit' />
;; </form>"


(defun a ()
  (b "moi" 10))

(defun b (a b)
  (+ a b))


Document generated by Confluence on 2008-12-12 16:01