   ;; which buttons are currently pressed?
   (setq acme-mouse-state 'left)
   (mouse-set-mark click)
-  (setq acme-last-command nil)
+  (setq acme-last-command 'none)
   ;; pass to regular click handler
   (mouse-drag-region click))
 

  (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)
        (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 deactivate-mark nil)
  (if (eq acme-last-command 'none)
      (mouse-set-point click))
  (setq acme-last-command 'none))

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

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