(eval-when (:compile-toplevel :load-toplevel :execute)
  (setf *readtable* (copy-readtable nil)))

(progn   (defmacro comment (&rest ignore)
           (declare (ignore ignore))
         (comment "
This file demonstrate how one can add a command
dynamically to sedit, thus demonstrating how sedit
is an emacs. ;-)
         (defun previous-cell (list cell)
         (loop :for current :on list
               :until (eq (cdr current) cell)
               :finally (return current)))

         (defun sedit-swap (buffer)
           "swaps the expression before the selection with the selection."
           (with-buffer (buffer root selection)
                        (let ((parent
                               (selection-parent-list selection))
                               (sedit-find-object root selection)))
                          (if (eq (car selection-cell) selection)
                              (let ((previous-cell
                                 (and previous-cell selection-cell)
                                  (car previous-cell)
                                  (car selection-cell))))
                              (progn (comment "selection is a cdr.")
                                      (car selection-cell)
                                      (cdr selection-cell)))))))
         (add-command 'w
                      "swaps the expression before with the selection."))