   []
   (.getSelectedIndex (:tabbed-panel @editor-window)))
 
+(defn current-tab-filename
+  "Return the filename corresponding to the current tab."
+  []
+  (.getToolTipTextAt (:tabbed-panel @editor-window) (current-tab-index)))
+
 (defn a-save [e]
   (let [tab-idx (current-tab-index)]
-    (spit (.getToolTipTextAt (:tabbed-panel @editor-window) tab-idx)
+    (spit (current-tab-filename)
           (get-text-from-tab tab-idx))))
 
 (defn a-save-as [e]

        menus (menubar
                :items [(menu :text "File" :items [action-new action-open action-save action-save-as action-close-tab action-exit])
                        (menu :text "Edit" :items [action-copy action-cut action-paste])
                        (menu :text "Run" :items [action-eval-file])
                        (menu :text "Projects" :items (into [] action-projects))
                        (menu :text "Git" :items [])
                        (menu :text "Brevis" :items [action-restart-brevis]) 

    #_(write-value-repl (:value (last response-vals)))
    #_(println (:value (last response-vals)))
    #_(with-out-str (pprint (doall response-vals)))))

(declare set-REPL-to-current-tab)
(defn a-set-REPL-to-project
  "Setup the repl for the current project."
  [e]
  (set-REPL-to-current-tab))

(defn a-eval-file
  "Evaluate a file."
