         (sources)
         (t anything-sources)))  
 
+(defvar anything-quit nil)
+(defmacro with-anything-quittable (&rest body)
+  `(let (inhibit-quit)
+     (condition-case v
+         (progn ,@body)
+       (quit (setq anything-quit t)
+             (exit-minibuffer)
+             (keyboard-quit)))))
+(put 'with-anything-quittable 'lisp-indent-function 0)
+
 ;; (@* "Core: entry point")
 (defun anything (&optional any-sources any-input any-prompt any-resume any-preselect any-buffer)
   "Select anything. In Lisp program, some optional arguments can be used.

;; New maintainer.
;;

(defvar anything-version "$Id: anything.el,v 1.136 2008/10/27 17:41:27 rubikitch Exp $")
(require 'cl)

;; (@* "User Configuration")

  (interactive)
  (condition-case v
      (with-anything-restore-variables
        (let ((frameconfig (anything-current-frame/window-configuration))
              ;; It is needed because `anything-source-name' is non-nil
              ;; when `anything' is invoked by action. Awful global scope.
              anything-source-name anything-in-persistent-action
              anything-quit
              (anything-buffer (or any-buffer anything-buffer))
              (anything-sources (anything-normalize-sources any-sources)))
         
          (add-hook 'post-command-hook 'anything-check-minibuffer-input)

          (setq anything-current-position (cons (point) (window-start)))
          (if any-resume
              (anything-initialize-overlays (anything-buffer-get))
            (anything-initialize))
          (setq anything-last-buffer anything-buffer)
          (when any-input (setq anything-input any-input anything-pattern any-input))
          (if anything-samewindow
              (switch-to-buffer anything-buffer)
            (pop-to-buffer anything-buffer))        

          (unwind-protect
              (progn
                (if any-resume (anything-mark-current-line) (anything-update))
                (select-frame-set-input-focus (window-frame (minibuffer-window)))
                (anything-preselect any-preselect)
                (let ((minibuffer-local-map anything-map))
                  (read-string (or any-prompt "pattern: ") (if any-resume anything-pattern any-input))))

            (anything-cleanup)
            (remove-hook 'post-command-hook 'anything-check-minibuffer-input)
            (anything-set-frame/window-configuration frameconfig))
          (unless anything-quit
            (unwind-protect
                (anything-execute-selection-action)
              (anything-aif (get-buffer anything-action-buffer)
                  (kill-buffer it))
              (run-hooks 'anything-after-action-hook)))))
    (quit
     (goto-char (car anything-current-position))
     (set-window-start (selected-window) (cdr anything-current-position))
