Commits

seanmcl committed d5ed146

window selection work

Comments (0)

Files changed (2)

RELEASE_PROCEDURE

+-*- mode:org -*-
 
 Tests
 =====
 
 * Try getenv, setenv, and toggle with restarts to make sure the variables
   are being set properly
+
+Window selection
+------------------
+
+Experiments with two frames
+
+F1   = F1 contents before next-error
+F2   = F2 contents before next-error
+n-e  = frame in which I ran next-error
+F1'  = F1 contents after next-error
+F2'  = F2 contents after next-error
+s-w' = the selected window after next-error
+X    = I think disagrees with the spec
+
+ | F1        | F2        | n-e | F1'       | X | F2'       | X | s-w' | X |
+ |-----------+-----------+-----+-----------+---+-----------+---+------+---|
+ | code      | *scratch* | F1  | split     |   | *scratch* |   | code |   |
+ | *scratch* | code      | F2  | *scratch* |   | split     |   | code |   |
+ | code      | [Errors]  | F1  | code      |   | [Errors]  |   | code |   |
+ | code      | [Errors]  | F2  | code      |   | [Errors]  |   | code |   |
+ | [Errors]  | code      | F1  | [Errors]  |   | code      |   | code |   |
+ | [Errors]  | code      | F2  | [Errors]  |   | code      |   | code |   |
+ | code      | code      | F1  | split     |   | code      |   | code |   |
+ | code      | code      | F2  | code      |   | split     |   | code |   |
+
+Experiments with a single frame
+
+ | W1        | W2        | n-e | W1'      | X | W2'      | X | s-w' | X |
+ |-----------+-----------+-----+----------+---+----------+---+------+---|
+ | code      | *scratch* | W1  | code     |   | [Errors] |   | code |   |
+ | *scratch* | code      | W2  | [Errors] |   | code     |   | code |   |
+ | code      | [Errors]  | W1  | code     |   | [Errors] |   | code |   |
+ | code      | [Errors]  | W2  | code     |   | [Errors] |   | code |   |
+ | [Errors]  | code      | W1  | [Errors] |   | code     |   | code |   |
+ | [Errors]  | code      | W2  | [Errors] |   | code     |   | code |   |
+ | code      | code      | W1  | code     |   | [Errors] |   | code |   |
+ | code      | code      | W2  | [Errors] |   | code     |   | code |   |
+
 
 (defun Omake.Window.clear-dedicated ()
   (setq Omake.Window.Error nil)
-  (setq Omake.Window.Code nil))
+  (setq Omake.Window.Code nil)
+  (setq Omake.Frame.Error nil)
+  (setq Omake.Frame.Code nil))
 
 (defmacro Omake.Window.check (w)
   `(and ,w
 ;; (Omake.Window.kindp 'abc)
 ;; (Omake.Window.kindp nil)
 
+(defun Omake.Window.other (kind)
+  (assert (Omake.Window.kindp kind))
+  (case kind
+    (code 'error)
+    (error 'code)
+    (t (error "Impossible"))))
+;; (Omake.Window.other 'error)
+;; (Omake.Window.other 'code)
+;; (Omake.Window.other nil)
+
 (defun Omake.check-dedicated ()
   (Omake.Window.check Omake.Window.Error)
   (Omake.Window.check Omake.Window.Code)
      (when ,w (make-frame-visible (window-frame ,w)))))
 
 (defun Omake.Frame.uniconify (kind)
+  (assert (Omake.Window.kindp kind))
   (case kind
     ('error (Omake.Frame.uniconify1 Omake.Window.Error Omake.Frame.Error))
     ('code (Omake.Frame.uniconify1 Omake.Window.Code Omake.Frame.Code))
     (if dw (cons (window-frame dw) dw)
       (let* ((try-windows
               (if df (window-list df) (Window.all-visible)))
+             ;; Make sure it tries the selected window first
+             ;; to make selection roughly symmetric between frames
+             (try-windows (cons (selected-window) try-windows))
              (or-else-frame
               (if df df (window-frame (selected-window))))
              (final-window
     (set-window-buffer ew error-buffer)
     (set-window-buffer cw code-buffer)
     (select-window cw)
+    (select-frame-set-input-focus (window-frame cw))
+    ;;(raise-frame (window-frame cw))
+    ;;(select-frame (window-frame cw))
+    ;;(redirect-frame-focus (window-frame cw))
     (switch-to-buffer code-buffer)
     (remove-overlays (point-min) (point-max))
     (Buffer.goto-line line)
 (defun Omake.set-dedicated-error-window ()
   (interactive)
   (Omake.check-dedicated)
-  (let ((w (selected-window)))
+  (let ((w (selected-window))
+        (f (selected-frame)))
     (when (equal w (Omake.Window.get 'code))
       (error "The current window is already dedicated to code.
-Do M-x Omake.clear-dedicated-windows to reset"))
-    (setq Omake.Window.Error w)))
+Do M-x Omake.clear-dedicated-windows to reset" ))
+    (setq Omake.Window.Error w)
+    (setq Omake.Frame.Error f)))
 
 (defun Omake.set-dedicated-code-window ()
   (interactive)
   (Omake.check-dedicated)
-  (let ((w (selected-window)))
+  (let ((w (selected-window))
+        (f (selected-frame)))
     (when (equal w (Omake.Window.get 'error))
       (error "The current window is already dedicated to errors.
 Do M-x Omake.clear-dedicated-windows to reset"))
-    (setq Omake.Window.Code w)))
+    (setq Omake.Window.Code w)
+    (setq Omake.Frame.Code f)))
 
 (defun Omake.clear-dedicated-windows ()
   (interactive)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.