            a-paste (action :handler a-paste :name "Paste" :tip "Paste text from the clipboard.")
            a-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
            a-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
-           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
+           a-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")           
            a-projects (map #(action :handler (make-a-active-project %)
                                     :name (str (:group %) "/" (:name %))
                                     :tip (str (:group %) "/" (:name %)))

        action-cut (action :handler a-cut :name "Cut" :tip "Cut text to the clipboard.")
        action-save-as (action :handler a-save-as :name "Save As" :tip "Save the current file.")
        action-eval-file (action :handler a-eval-file :name "Evaluate" :tip "Evaluate the current file.")
        action-restart-brevis
        (action :handler (fn [e]
                           (System/exit 1))

        (doseq [filename (:open-files saved-state)]
          (add-content-tab-from-filename filename @content-pane-params))))))

(defn is-directory-leiningen-project?
  "Return true if a directory represents a leiningen project."
  [directory]
  (some #(= "project.clj" (.getName %))
        (file-seq (file directory))))

(defn set-REPL-to-current-tab
  "Setup the REPL for the project corresponding to the current tab."
  []
  (when @repl
    (let [{:keys [server connection client]} @repl]
      (nrepl.server/stop-server server)))
  (when-let [tab-idx (current-tab-index)]    
    (let [filename (current-tab-filename)
          path (string/split filename (re-pattern (java.util.regex.Pattern/quote File/separator)))
          paths (loop [rem (butlast path)
                       paths []]
                  (if-not (empty? rem)
                    (recur (butlast rem) 
                           (conj paths (string/join File/separator rem)))
                    paths))
          project-dir (some is-directory-leiningen-project?
                            paths)]
      (if-not project-dir
        (println "File is not within a valid Leiningen project.")
        (let [project (project/read (str (:current-project @current-profile) File/separator "project.clj"))
              repl-cfg {:host (repl/repl-host project)
                        :port (repl/repl-port project)}
              repl-server (nrepl.server/start-server :port 59258)
              repl-connection (nrepl/connect :port 59258)
              repl-client (nrepl/client repl-connection Long/MAX_VALUE)]
          (reset! repl {:server repl-server
                        :connection repl-connection
                        :client repl-client}))))))

(defn -main 
  "Start from command line."
