[MLton-commit] r5190

Vesa Karvonen vesak at mlton.org
Wed Feb 14 04:35:27 PST 2007


Changed to reuse windows: if a window is showing the buffer that visits
the desired file, then select that window.

----------------------------------------------------------------------

U   mlton/trunk/ide/emacs/def-use-util.el

----------------------------------------------------------------------

Modified: mlton/trunk/ide/emacs/def-use-util.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-util.el	2007-02-14 00:20:09 UTC (rev 5189)
+++ mlton/trunk/ide/emacs/def-use-util.el	2007-02-14 12:35:25 UTC (rev 5190)
@@ -59,13 +59,20 @@
 open the file a second time if a buffer is editing a file by the same true
 file name."
   (let ((buffer (def-use-find-buffer-visiting-file file)))
-    (if buffer
-        (if other-window
-            (switch-to-buffer-other-window buffer)
-          (switch-to-buffer buffer))
-      (if other-window
-          (find-file-other-window file)
-        (find-file file)))))
+    (cond
+     (buffer
+      (let ((window (get-buffer-window buffer)))
+        (cond
+         (other-window
+          (switch-to-buffer-other-window buffer))
+         (window
+          (set-frame-selected-window nil window))
+         (t
+          (switch-to-buffer buffer)))))
+     (other-window
+      (find-file-other-window file))
+     (t
+      (find-file file)))))
 
 (defun def-use-point-at-next-line ()
   "Returns point at the beginning of the next line."




More information about the MLton-commit mailing list