   (if (eq acme-mouse-state 'left)
       (progn
         (setq acme-mouse-state 'left-right)
-        (if (eq acme-last-command nil)
-            (progn (mouse-set-point click)
-                   (let ((range (mouse-start-end (mark) (point) mouse-selection-click-count)))
-                     (set-mark (car range))
-                     (goto-char (nth 1 range)))))
-        (delete-region (mark) (point))
-        (yank arg)
+        (case acme-last-command
+          ('none (mouse-set-point click)
+                 (let ((range (mouse-start-end (mark) (point) mouse-selection-click-count)))
+                   (setq acme-start (car range))
+                   (setq acme-end (nth 1 range))
+                   (set-mark acme-start)
+                   (goto-char acme-end)
+                   (delete-region (mark) (point))
+                   (yank arg)))
+          ('cut (undo)
+                (set-mark acme-start)
+                (goto-char acme-end)))
         (setq acme-last-command 'paste)
         (setq deactivate-mark nil)
         (exchange-point-and-mark))))

(defun acme-mouse-1 (click)
  (interactive "e")
  (setq acme-mouse-state 'none)
  (setq acme-last-command nil)
  (setq deactivate-mark nil)
  (if (eq acme-last-command nil)
      (mouse-set-point click)))

;; called if mouse moves between button down and up
(defun acme-drag-mouse-1 (click)
  (interactive "e")
  (if (eq acme-last-command nil)
      (mouse-set-region click)
    (setq deactivate-mark nil)
    (exchange-point-and-mark))
  (setq acme-last-command nil))

(defun acme-down-mouse-2 (click)
  (interactive "e")

                 (undo)
               (mouse-set-point click)
               (let ((range (mouse-start-end (mark) (point) mouse-selection-click-count)))
                 (setq acme-start (car range))
                 (setq acme-end (nth 1 range))
                 (set-mark acme-start)
                 (goto-char acme-end)
                 (kill-region (mark) (point))))
             (setq acme-last-command 'cut))))

