diff options
| author | Stefan Monnier | 2017-10-26 22:15:41 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2017-10-26 22:15:41 -0400 |
| commit | c015f935e06cf2ba3ef8f69f5ef086fc1e51c9d1 (patch) | |
| tree | b7bf261eed020544273e971fe2a5cbf32c55794d | |
| parent | 1ad56d0a6bdd07c722a3c161096a16f70d1cbb35 (diff) | |
| download | emacs-c015f935e06cf2ba3ef8f69f5ef086fc1e51c9d1.tar.gz emacs-c015f935e06cf2ba3ef8f69f5ef086fc1e51c9d1.zip | |
* lisp/vc/ediff-wind.el: Don't pop spurious frame in corner case
(ediff-setup-windows-multiframe-compare): Clarify control-flow.
Postpone the initial call to ediff-skip-unsuitable-frames until we're
sure it's needed to avoid creating a spurious new frame.
(ediff-setup-windows, ediff-setup-windows-plain)
(ediff-setup-windows-plain-merge, ediff-setup-control-frame)
(ediff-setup-windows-plain-compare, ediff-setup-windows-multiframe)
(ediff-setup-windows-multiframe-merge): Use with-current-buffer.
| -rw-r--r-- | lisp/vc/ediff-wind.el | 239 |
1 files changed, 106 insertions, 133 deletions
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el index c2b76780e92..45497688487 100644 --- a/lisp/vc/ediff-wind.el +++ b/lisp/vc/ediff-wind.el | |||
| @@ -64,10 +64,10 @@ | |||
| 64 | (defun ediff-choose-window-setup-function-automatically () | 64 | (defun ediff-choose-window-setup-function-automatically () |
| 65 | (declare (obsolete ediff-setup-windows-default "24.3")) | 65 | (declare (obsolete ediff-setup-windows-default "24.3")) |
| 66 | (if (ediff-window-display-p) | 66 | (if (ediff-window-display-p) |
| 67 | 'ediff-setup-windows-multiframe | 67 | #'ediff-setup-windows-multiframe |
| 68 | 'ediff-setup-windows-plain)) | 68 | #'ediff-setup-windows-plain)) |
| 69 | 69 | ||
| 70 | (defcustom ediff-window-setup-function 'ediff-setup-windows-default | 70 | (defcustom ediff-window-setup-function #'ediff-setup-windows-default |
| 71 | "Function called to set up windows. | 71 | "Function called to set up windows. |
| 72 | Ediff provides a choice of three functions: | 72 | Ediff provides a choice of three functions: |
| 73 | (1) `ediff-setup-windows-multiframe', which sets the control panel | 73 | (1) `ediff-setup-windows-multiframe', which sets the control panel |
| @@ -132,7 +132,7 @@ provided functions are written." | |||
| 132 | (Ancestor . ediff-window-Ancestor))) | 132 | (Ancestor . ediff-window-Ancestor))) |
| 133 | 133 | ||
| 134 | 134 | ||
| 135 | (defcustom ediff-split-window-function 'split-window-vertically | 135 | (defcustom ediff-split-window-function #'split-window-vertically |
| 136 | "The function used to split the main window between buffer-A and buffer-B. | 136 | "The function used to split the main window between buffer-A and buffer-B. |
| 137 | You can set it to a horizontal split instead of the default vertical split | 137 | You can set it to a horizontal split instead of the default vertical split |
| 138 | by setting this variable to `split-window-horizontally'. | 138 | by setting this variable to `split-window-horizontally'. |
| @@ -145,7 +145,7 @@ In this case, Ediff will use those frames to display these buffers." | |||
| 145 | function) | 145 | function) |
| 146 | :group 'ediff-window) | 146 | :group 'ediff-window) |
| 147 | 147 | ||
| 148 | (defcustom ediff-merge-split-window-function 'split-window-horizontally | 148 | (defcustom ediff-merge-split-window-function #'split-window-horizontally |
| 149 | "The function used to split the main window between buffer-A and buffer-B. | 149 | "The function used to split the main window between buffer-A and buffer-B. |
| 150 | You can set it to a vertical split instead of the default horizontal split | 150 | You can set it to a vertical split instead of the default horizontal split |
| 151 | by setting this variable to `split-window-vertically'. | 151 | by setting this variable to `split-window-vertically'. |
| @@ -210,7 +210,7 @@ responsibility." | |||
| 210 | :type 'boolean | 210 | :type 'boolean |
| 211 | :group 'ediff-window) | 211 | :group 'ediff-window) |
| 212 | 212 | ||
| 213 | (defcustom ediff-control-frame-position-function 'ediff-make-frame-position | 213 | (defcustom ediff-control-frame-position-function #'ediff-make-frame-position |
| 214 | "Function to call to determine the desired location for the control panel. | 214 | "Function to call to determine the desired location for the control panel. |
| 215 | Expects three parameters: the control buffer, the desired width and height | 215 | Expects three parameters: the control buffer, the desired width and height |
| 216 | of the control frame. It returns an association list | 216 | of the control frame. It returns an association list |
| @@ -258,7 +258,7 @@ customization of the default." | |||
| 258 | display off.") | 258 | display off.") |
| 259 | (ediff-defvar-local ediff-wide-display-frame nil | 259 | (ediff-defvar-local ediff-wide-display-frame nil |
| 260 | "Frame to be used for wide display.") | 260 | "Frame to be used for wide display.") |
| 261 | (ediff-defvar-local ediff-make-wide-display-function 'ediff-make-wide-display | 261 | (ediff-defvar-local ediff-make-wide-display-function #'ediff-make-wide-display |
| 262 | "The value is a function that is called to create a wide display. | 262 | "The value is a function that is called to create a wide display. |
| 263 | The function is called without arguments. It should resize the frame in | 263 | The function is called without arguments. It should resize the frame in |
| 264 | which buffers A, B, and C are to be displayed, and it should save the old | 264 | which buffers A, B, and C are to be displayed, and it should save the old |
| @@ -334,11 +334,11 @@ into icons, regardless of the window manager." | |||
| 334 | 334 | ||
| 335 | ;; in case user did a no-no on a tty | 335 | ;; in case user did a no-no on a tty |
| 336 | (or (ediff-window-display-p) | 336 | (or (ediff-window-display-p) |
| 337 | (setq ediff-window-setup-function 'ediff-setup-windows-plain)) | 337 | (setq ediff-window-setup-function #'ediff-setup-windows-plain)) |
| 338 | 338 | ||
| 339 | (or (ediff-keep-window-config control-buffer) | 339 | (or (ediff-keep-window-config control-buffer) |
| 340 | (funcall | 340 | (funcall |
| 341 | (ediff-with-current-buffer control-buffer ediff-window-setup-function) | 341 | (with-current-buffer control-buffer ediff-window-setup-function) |
| 342 | buffer-A buffer-B buffer-C control-buffer)) | 342 | buffer-A buffer-B buffer-C control-buffer)) |
| 343 | (run-hooks 'ediff-after-setup-windows-hook)) | 343 | (run-hooks 'ediff-after-setup-windows-hook)) |
| 344 | 344 | ||
| @@ -352,7 +352,7 @@ into icons, regardless of the window manager." | |||
| 352 | ;; Usually used without windowing systems | 352 | ;; Usually used without windowing systems |
| 353 | ;; With windowing, we want to use dedicated frames. | 353 | ;; With windowing, we want to use dedicated frames. |
| 354 | (defun ediff-setup-windows-plain (buffer-A buffer-B buffer-C control-buffer) | 354 | (defun ediff-setup-windows-plain (buffer-A buffer-B buffer-C control-buffer) |
| 355 | (ediff-with-current-buffer control-buffer | 355 | (with-current-buffer control-buffer |
| 356 | (setq ediff-multiframe nil)) | 356 | (setq ediff-multiframe nil)) |
| 357 | (if ediff-merge-job | 357 | (if ediff-merge-job |
| 358 | (ediff-setup-windows-plain-merge | 358 | (ediff-setup-windows-plain-merge |
| @@ -366,14 +366,14 @@ into icons, regardless of the window manager." | |||
| 366 | ;; skip dedicated and unsplittable frames | 366 | ;; skip dedicated and unsplittable frames |
| 367 | (ediff-destroy-control-frame control-buffer) | 367 | (ediff-destroy-control-frame control-buffer) |
| 368 | (let ((window-min-height 1) | 368 | (let ((window-min-height 1) |
| 369 | (with-Ancestor-p (ediff-with-current-buffer control-buffer | 369 | (with-Ancestor-p (with-current-buffer control-buffer |
| 370 | ediff-merge-with-ancestor-job)) | 370 | ediff-merge-with-ancestor-job)) |
| 371 | split-window-function | 371 | split-window-function |
| 372 | merge-window-share merge-window-lines | 372 | merge-window-share merge-window-lines |
| 373 | (buf-Ancestor (ediff-with-current-buffer control-buffer | 373 | (buf-Ancestor (with-current-buffer control-buffer |
| 374 | ediff-ancestor-buffer)) | 374 | ediff-ancestor-buffer)) |
| 375 | wind-A wind-B wind-C wind-Ancestor) | 375 | wind-A wind-B wind-C wind-Ancestor) |
| 376 | (ediff-with-current-buffer control-buffer | 376 | (with-current-buffer control-buffer |
| 377 | (setq merge-window-share ediff-merge-window-share | 377 | (setq merge-window-share ediff-merge-window-share |
| 378 | ;; this lets us have local versions of ediff-split-window-function | 378 | ;; this lets us have local versions of ediff-split-window-function |
| 379 | split-window-function ediff-split-window-function)) | 379 | split-window-function ediff-split-window-function)) |
| @@ -417,7 +417,7 @@ into icons, regardless of the window manager." | |||
| 417 | (switch-to-buffer buf-B) | 417 | (switch-to-buffer buf-B) |
| 418 | (setq wind-B (selected-window)) | 418 | (setq wind-B (selected-window)) |
| 419 | 419 | ||
| 420 | (ediff-with-current-buffer control-buffer | 420 | (with-current-buffer control-buffer |
| 421 | (setq ediff-window-A wind-A | 421 | (setq ediff-window-A wind-A |
| 422 | ediff-window-B wind-B | 422 | ediff-window-B wind-B |
| 423 | ediff-window-C wind-C | 423 | ediff-window-C wind-C |
| @@ -436,7 +436,7 @@ into icons, regardless of the window manager." | |||
| 436 | split-window-function wind-width-or-height | 436 | split-window-function wind-width-or-height |
| 437 | three-way-comparison | 437 | three-way-comparison |
| 438 | wind-A-start wind-B-start wind-A wind-B wind-C) | 438 | wind-A-start wind-B-start wind-A wind-B wind-C) |
| 439 | (ediff-with-current-buffer control-buffer | 439 | (with-current-buffer control-buffer |
| 440 | (setq wind-A-start (ediff-overlay-start | 440 | (setq wind-A-start (ediff-overlay-start |
| 441 | (ediff-get-value-according-to-buffer-type | 441 | (ediff-get-value-according-to-buffer-type |
| 442 | 'A ediff-narrow-bounds)) | 442 | 'A ediff-narrow-bounds)) |
| @@ -462,7 +462,7 @@ into icons, regardless of the window manager." | |||
| 462 | (setq wind-A (selected-window)) | 462 | (setq wind-A (selected-window)) |
| 463 | (if three-way-comparison | 463 | (if three-way-comparison |
| 464 | (setq wind-width-or-height | 464 | (setq wind-width-or-height |
| 465 | (/ (if (eq split-window-function 'split-window-vertically) | 465 | (/ (if (eq split-window-function #'split-window-vertically) |
| 466 | (window-height wind-A) | 466 | (window-height wind-A) |
| 467 | (window-width wind-A)) | 467 | (window-width wind-A)) |
| 468 | 3))) | 468 | 3))) |
| @@ -487,7 +487,7 @@ into icons, regardless of the window manager." | |||
| 487 | (switch-to-buffer buf-C) | 487 | (switch-to-buffer buf-C) |
| 488 | (setq wind-C (selected-window)))) | 488 | (setq wind-C (selected-window)))) |
| 489 | 489 | ||
| 490 | (ediff-with-current-buffer control-buffer | 490 | (with-current-buffer control-buffer |
| 491 | (setq ediff-window-A wind-A | 491 | (setq ediff-window-A wind-A |
| 492 | ediff-window-B wind-B | 492 | ediff-window-B wind-B |
| 493 | ediff-window-C wind-C)) | 493 | ediff-window-C wind-C)) |
| @@ -506,23 +506,23 @@ into icons, regardless of the window manager." | |||
| 506 | 506 | ||
| 507 | ;; dispatch an appropriate window setup function | 507 | ;; dispatch an appropriate window setup function |
| 508 | (defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf) | 508 | (defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf) |
| 509 | (ediff-with-current-buffer control-buf | 509 | (with-current-buffer control-buf |
| 510 | (setq ediff-multiframe t)) | 510 | (setq ediff-multiframe t)) |
| 511 | (if ediff-merge-job | 511 | (if ediff-merge-job |
| 512 | (ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf) | 512 | (ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf) |
| 513 | (ediff-setup-windows-multiframe-compare buf-A buf-B buf-C control-buf))) | 513 | (ediff-setup-windows-multiframe-compare buf-A buf-B buf-C control-buf))) |
| 514 | 514 | ||
| 515 | (defun ediff-setup-windows-multiframe-merge (buf-A buf-B buf-C control-buf) | 515 | (defun ediff-setup-windows-multiframe-merge (buf-A buf-B buf-C control-buf) |
| 516 | ;;; Algorithm: | 516 | ;; Algorithm: |
| 517 | ;;; 1. Never use frames that have dedicated windows in them---it is bad to | 517 | ;; 1. Never use frames that have dedicated windows in them---it is bad to |
| 518 | ;;; destroy dedicated windows. | 518 | ;; destroy dedicated windows. |
| 519 | ;;; 2. If A and B are in the same frame but C's frame is different--- use one | 519 | ;; 2. If A and B are in the same frame but C's frame is different--- use one |
| 520 | ;;; frame for A and B and use a separate frame for C. | 520 | ;; frame for A and B and use a separate frame for C. |
| 521 | ;;; 3. If C's frame is non-existent, then: if the first suitable | 521 | ;; 3. If C's frame is non-existent, then: if the first suitable |
| 522 | ;;; non-dedicated frame is different from A&B's, then use it for C. | 522 | ;; non-dedicated frame is different from A&B's, then use it for C. |
| 523 | ;;; Otherwise, put A,B, and C in one frame. | 523 | ;; Otherwise, put A,B, and C in one frame. |
| 524 | ;;; 4. If buffers A, B, C are is separate frames, use them to display these | 524 | ;; 4. If buffers A, B, C are is separate frames, use them to display these |
| 525 | ;;; buffers. | 525 | ;; buffers. |
| 526 | 526 | ||
| 527 | ;; Skip dedicated or iconified frames. | 527 | ;; Skip dedicated or iconified frames. |
| 528 | ;; Unsplittable frames are taken care of later. | 528 | ;; Unsplittable frames are taken care of later. |
| @@ -532,7 +532,7 @@ into icons, regardless of the window manager." | |||
| 532 | (wind-A (ediff-get-visible-buffer-window buf-A)) | 532 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
| 533 | (wind-B (ediff-get-visible-buffer-window buf-B)) | 533 | (wind-B (ediff-get-visible-buffer-window buf-B)) |
| 534 | (wind-C (ediff-get-visible-buffer-window buf-C)) | 534 | (wind-C (ediff-get-visible-buffer-window buf-C)) |
| 535 | (buf-Ancestor (ediff-with-current-buffer control-buf | 535 | (buf-Ancestor (with-current-buffer control-buf |
| 536 | ediff-ancestor-buffer)) | 536 | ediff-ancestor-buffer)) |
| 537 | (wind-Ancestor (ediff-get-visible-buffer-window buf-Ancestor)) | 537 | (wind-Ancestor (ediff-get-visible-buffer-window buf-Ancestor)) |
| 538 | (frame-A (if wind-A (window-frame wind-A))) | 538 | (frame-A (if wind-A (window-frame wind-A))) |
| @@ -541,10 +541,10 @@ into icons, regardless of the window manager." | |||
| 541 | (frame-Ancestor (if wind-Ancestor (window-frame wind-Ancestor))) | 541 | (frame-Ancestor (if wind-Ancestor (window-frame wind-Ancestor))) |
| 542 | ;; on wide display, do things in one frame | 542 | ;; on wide display, do things in one frame |
| 543 | (force-one-frame | 543 | (force-one-frame |
| 544 | (ediff-with-current-buffer control-buf ediff-wide-display-p)) | 544 | (with-current-buffer control-buf ediff-wide-display-p)) |
| 545 | ;; this lets us have local versions of ediff-split-window-function | 545 | ;; this lets us have local versions of ediff-split-window-function |
| 546 | (split-window-function | 546 | (split-window-function |
| 547 | (ediff-with-current-buffer control-buf ediff-split-window-function)) | 547 | (with-current-buffer control-buf ediff-split-window-function)) |
| 548 | (orig-wind (selected-window)) | 548 | (orig-wind (selected-window)) |
| 549 | (orig-frame (selected-frame)) | 549 | (orig-frame (selected-frame)) |
| 550 | (use-same-frame (or force-one-frame | 550 | (use-same-frame (or force-one-frame |
| @@ -566,11 +566,11 @@ into icons, regardless of the window manager." | |||
| 566 | ;; use-same-frame-for-AB implies wind A and B are ok for display | 566 | ;; use-same-frame-for-AB implies wind A and B are ok for display |
| 567 | (use-same-frame-for-AB (and (not use-same-frame) | 567 | (use-same-frame-for-AB (and (not use-same-frame) |
| 568 | (eq frame-A frame-B))) | 568 | (eq frame-A frame-B))) |
| 569 | (merge-window-share (ediff-with-current-buffer control-buf | 569 | (merge-window-share (with-current-buffer control-buf |
| 570 | ediff-merge-window-share)) | 570 | ediff-merge-window-share)) |
| 571 | merge-window-lines | 571 | merge-window-lines |
| 572 | designated-minibuffer-frame ; ediff-merge-with-ancestor-job | 572 | designated-minibuffer-frame ; ediff-merge-with-ancestor-job |
| 573 | (with-Ancestor-p (ediff-with-current-buffer control-buf | 573 | (with-Ancestor-p (with-current-buffer control-buf |
| 574 | ediff-merge-with-ancestor-job)) | 574 | ediff-merge-with-ancestor-job)) |
| 575 | (done-Ancestor (not with-Ancestor-p)) | 575 | (done-Ancestor (not with-Ancestor-p)) |
| 576 | done-A done-B done-C) | 576 | done-A done-B done-C) |
| @@ -724,7 +724,7 @@ into icons, regardless of the window manager." | |||
| 724 | (switch-to-buffer buf-Ancestor) | 724 | (switch-to-buffer buf-Ancestor) |
| 725 | (setq wind-Ancestor (selected-window)))) | 725 | (setq wind-Ancestor (selected-window)))) |
| 726 | 726 | ||
| 727 | (ediff-with-current-buffer control-buf | 727 | (with-current-buffer control-buf |
| 728 | (setq ediff-window-A wind-A | 728 | (setq ediff-window-A wind-A |
| 729 | ediff-window-B wind-B | 729 | ediff-window-B wind-B |
| 730 | ediff-window-C wind-C | 730 | ediff-window-C wind-C |
| @@ -738,21 +738,17 @@ into icons, regardless of the window manager." | |||
| 738 | 738 | ||
| 739 | ;; Window setup for all comparison jobs, including 3way comparisons | 739 | ;; Window setup for all comparison jobs, including 3way comparisons |
| 740 | (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf) | 740 | (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf) |
| 741 | ;;; Algorithm: | 741 | ;; Algorithm: |
| 742 | ;;; If a buffer is seen in a frame, use that frame for that buffer. | 742 | ;; If a buffer is seen in a frame, use that frame for that buffer. |
| 743 | ;;; If it is not seen, use the current frame. | 743 | ;; If it is not seen, use the current frame. |
| 744 | ;;; If both buffers are not seen, they share the current frame. If one | 744 | ;; If both buffers are not seen, they share the current frame. If one |
| 745 | ;;; of the buffers is not seen, it is placed in the current frame (where | 745 | ;; of the buffers is not seen, it is placed in the current frame (where |
| 746 | ;;; ediff started). If that frame is displaying the other buffer, it is | 746 | ;; ediff started). If that frame is displaying the other buffer, it is |
| 747 | ;;; shared between the two buffers. | 747 | ;; shared between the two buffers. |
| 748 | ;;; However, if we decide to put both buffers in one frame | 748 | ;; However, if we decide to put both buffers in one frame |
| 749 | ;;; and the selected frame isn't splittable, we create a new frame and | 749 | ;; and the selected frame isn't splittable, we create a new frame and |
| 750 | ;;; put both buffers there, event if one of this buffers is visible in | 750 | ;; put both buffers there, event if one of this buffers is visible in |
| 751 | ;;; another frame. | 751 | ;; another frame. |
| 752 | |||
| 753 | ;; Skip dedicated or iconified frames. | ||
| 754 | ;; Unsplittable frames are taken care of later. | ||
| 755 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | ||
| 756 | 752 | ||
| 757 | (let* ((window-min-height 1) | 753 | (let* ((window-min-height 1) |
| 758 | (wind-A (ediff-get-visible-buffer-window buf-A)) | 754 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
| @@ -761,17 +757,16 @@ into icons, regardless of the window manager." | |||
| 761 | (frame-A (if wind-A (window-frame wind-A))) | 757 | (frame-A (if wind-A (window-frame wind-A))) |
| 762 | (frame-B (if wind-B (window-frame wind-B))) | 758 | (frame-B (if wind-B (window-frame wind-B))) |
| 763 | (frame-C (if wind-C (window-frame wind-C))) | 759 | (frame-C (if wind-C (window-frame wind-C))) |
| 764 | (ctl-frame-exists-p (ediff-with-current-buffer control-buf | 760 | (ctl-frame-exists-p (with-current-buffer control-buf |
| 765 | (frame-live-p ediff-control-frame))) | 761 | (frame-live-p ediff-control-frame))) |
| 766 | ;; on wide display, do things in one frame | 762 | ;; on wide display, do things in one frame |
| 767 | (force-one-frame | 763 | (force-one-frame |
| 768 | (ediff-with-current-buffer control-buf ediff-wide-display-p)) | 764 | (with-current-buffer control-buf ediff-wide-display-p)) |
| 769 | ;; this lets us have local versions of ediff-split-window-function | 765 | ;; this lets us have local versions of ediff-split-window-function |
| 770 | (split-window-function | 766 | (split-window-function |
| 771 | (ediff-with-current-buffer control-buf ediff-split-window-function)) | 767 | (with-current-buffer control-buf ediff-split-window-function)) |
| 772 | (three-way-comparison | 768 | (three-way-comparison |
| 773 | (ediff-with-current-buffer control-buf ediff-3way-comparison-job)) | 769 | (with-current-buffer control-buf ediff-3way-comparison-job)) |
| 774 | (orig-wind (selected-window)) | ||
| 775 | (use-same-frame (or force-one-frame | 770 | (use-same-frame (or force-one-frame |
| 776 | (eq frame-A frame-B) | 771 | (eq frame-A frame-B) |
| 777 | (not (ediff-window-ok-for-display wind-A)) | 772 | (not (ediff-window-ok-for-display wind-A)) |
| @@ -790,10 +785,9 @@ into icons, regardless of the window manager." | |||
| 790 | (or ctl-frame-exists-p | 785 | (or ctl-frame-exists-p |
| 791 | (eq frame-B (selected-frame)))))) | 786 | (eq frame-B (selected-frame)))))) |
| 792 | wind-A-start wind-B-start | 787 | wind-A-start wind-B-start |
| 793 | designated-minibuffer-frame | 788 | designated-minibuffer-frame) |
| 794 | done-A done-B done-C) | ||
| 795 | 789 | ||
| 796 | (ediff-with-current-buffer control-buf | 790 | (with-current-buffer control-buf |
| 797 | (setq wind-A-start (ediff-overlay-start | 791 | (setq wind-A-start (ediff-overlay-start |
| 798 | (ediff-get-value-according-to-buffer-type | 792 | (ediff-get-value-according-to-buffer-type |
| 799 | 'A ediff-narrow-bounds)) | 793 | 'A ediff-narrow-bounds)) |
| @@ -801,30 +795,6 @@ into icons, regardless of the window manager." | |||
| 801 | (ediff-get-value-according-to-buffer-type | 795 | (ediff-get-value-according-to-buffer-type |
| 802 | 'B ediff-narrow-bounds)))) | 796 | 'B ediff-narrow-bounds)))) |
| 803 | 797 | ||
| 804 | (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own | ||
| 805 | (progn | ||
| 806 | ;; buffer buf-A is seen in live wind-A | ||
| 807 | (select-window wind-A) ; must be displaying buf-A | ||
| 808 | (delete-other-windows) | ||
| 809 | (setq wind-A (selected-window)) | ||
| 810 | (setq done-A t))) | ||
| 811 | |||
| 812 | (if (and (window-live-p wind-B) (null use-same-frame)) ; buf B on its own | ||
| 813 | (progn | ||
| 814 | ;; buffer buf-B is seen in live wind-B | ||
| 815 | (select-window wind-B) ; must be displaying buf-B | ||
| 816 | (delete-other-windows) | ||
| 817 | (setq wind-B (selected-window)) | ||
| 818 | (setq done-B t))) | ||
| 819 | |||
| 820 | (if (and (window-live-p wind-C) (null use-same-frame)) ; buf C on its own | ||
| 821 | (progn | ||
| 822 | ;; buffer buf-C is seen in live wind-C | ||
| 823 | (select-window wind-C) ; must be displaying buf-C | ||
| 824 | (delete-other-windows) | ||
| 825 | (setq wind-C (selected-window)) | ||
| 826 | (setq done-C t))) | ||
| 827 | |||
| 828 | (if use-same-frame | 798 | (if use-same-frame |
| 829 | (let (wind-width-or-height) ; this affects 3way setups only | 799 | (let (wind-width-or-height) ; this affects 3way setups only |
| 830 | (if (and (eq frame-A frame-B) (frame-live-p frame-A)) | 800 | (if (and (eq frame-A frame-B) (frame-live-p frame-A)) |
| @@ -838,7 +808,7 @@ into icons, regardless of the window manager." | |||
| 838 | (if three-way-comparison | 808 | (if three-way-comparison |
| 839 | (setq wind-width-or-height | 809 | (setq wind-width-or-height |
| 840 | (/ | 810 | (/ |
| 841 | (if (eq split-window-function 'split-window-vertically) | 811 | (if (eq split-window-function #'split-window-vertically) |
| 842 | (window-height wind-A) | 812 | (window-height wind-A) |
| 843 | (window-width wind-A)) | 813 | (window-width wind-A)) |
| 844 | 3))) | 814 | 3))) |
| @@ -855,46 +825,57 @@ into icons, regardless of the window manager." | |||
| 855 | (if (memq (selected-window) (list wind-A wind-B)) | 825 | (if (memq (selected-window) (list wind-A wind-B)) |
| 856 | (other-window 1)) | 826 | (other-window 1)) |
| 857 | (switch-to-buffer buf-C) | 827 | (switch-to-buffer buf-C) |
| 858 | (setq wind-C (selected-window)))) | 828 | (setq wind-C (selected-window))))) |
| 859 | (setq done-A t | 829 | |
| 860 | done-B t | 830 | (if (window-live-p wind-A) ; buf-A on its own |
| 861 | done-C t) | 831 | (progn |
| 862 | )) | 832 | ;; buffer buf-A is seen in live wind-A |
| 863 | 833 | (select-window wind-A) ; must be displaying buf-A | |
| 864 | (or done-A ; Buf A to be set in its own frame | 834 | (delete-other-windows) |
| 865 | ;;; or it was set before because use-same-frame = 1 | 835 | (setq wind-A (selected-window))) ;FIXME: Why? |
| 866 | (progn | 836 | ;; Buf-A was not set up yet as it wasn't visible, |
| 867 | ;; Buf-A was not set up yet as it wasn't visible, | 837 | ;; and use-same-frame = nil |
| 868 | ;; and use-same-frame = nil | 838 | ;; Skip dedicated or iconified frames. |
| 869 | (select-window orig-wind) | 839 | ;; Unsplittable frames are taken care of later. |
| 870 | (delete-other-windows) | 840 | (ediff-skip-unsuitable-frames 'ok-unsplittable) |
| 871 | (switch-to-buffer buf-A) | 841 | (delete-other-windows) |
| 872 | (setq wind-A (selected-window)) | 842 | (switch-to-buffer buf-A) |
| 873 | )) | 843 | (setq wind-A (selected-window))) |
| 874 | (or done-B ; Buf B to be set in its own frame | 844 | |
| 875 | ;;; or it was set before because use-same-frame = 1 | 845 | (if (window-live-p wind-B) ; buf B on its own |
| 876 | (progn | 846 | (progn |
| 877 | ;; Buf-B was not set up yet as it wasn't visible, | 847 | ;; buffer buf-B is seen in live wind-B |
| 878 | ;; and use-same-frame = nil | 848 | (select-window wind-B) ; must be displaying buf-B |
| 879 | (select-window orig-wind) | 849 | (delete-other-windows) |
| 880 | (delete-other-windows) | 850 | (setq wind-B (selected-window))) ;FIXME: Why? |
| 881 | (switch-to-buffer buf-B) | 851 | ;; Buf-B was not set up yet as it wasn't visible, |
| 882 | (setq wind-B (selected-window)) | 852 | ;; and use-same-frame = nil |
| 883 | )) | 853 | ;; Skip dedicated or iconified frames. |
| 884 | 854 | ;; Unsplittable frames are taken care of later. | |
| 885 | (if three-way-comparison | 855 | (ediff-skip-unsuitable-frames 'ok-unsplittable) |
| 886 | (or done-C ; Buf C to be set in its own frame | 856 | (delete-other-windows) |
| 887 | ;;; or it was set before because use-same-frame = 1 | 857 | (switch-to-buffer buf-B) |
| 858 | (setq wind-B (selected-window))) | ||
| 859 | |||
| 860 | (if (window-live-p wind-C) ; buf C on its own | ||
| 861 | (progn | ||
| 862 | ;; buffer buf-C is seen in live wind-C | ||
| 863 | (select-window wind-C) ; must be displaying buf-C | ||
| 864 | (delete-other-windows) | ||
| 865 | (setq wind-C (selected-window))) ;FIXME: Why? | ||
| 866 | (if three-way-comparison | ||
| 888 | (progn | 867 | (progn |
| 889 | ;; Buf-C was not set up yet as it wasn't visible, | 868 | ;; Buf-C was not set up yet as it wasn't visible, |
| 890 | ;; and use-same-frame = nil | 869 | ;; and use-same-frame = nil |
| 891 | (select-window orig-wind) | 870 | ;; Skip dedicated or iconified frames. |
| 871 | ;; Unsplittable frames are taken care of later. | ||
| 872 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | ||
| 892 | (delete-other-windows) | 873 | (delete-other-windows) |
| 893 | (switch-to-buffer buf-C) | 874 | (switch-to-buffer buf-C) |
| 894 | (setq wind-C (selected-window)) | 875 | (setq wind-C (selected-window)) |
| 895 | ))) | 876 | )))) |
| 896 | 877 | ||
| 897 | (ediff-with-current-buffer control-buf | 878 | (with-current-buffer control-buf |
| 898 | (setq ediff-window-A wind-A | 879 | (setq ediff-window-A wind-A |
| 899 | ediff-window-B wind-B | 880 | ediff-window-B wind-B |
| 900 | ediff-window-C wind-C) | 881 | ediff-window-C wind-C) |
| @@ -913,9 +894,9 @@ into icons, regardless of the window manager." | |||
| 913 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) | 894 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) |
| 914 | )) | 895 | )) |
| 915 | 896 | ||
| 916 | ;; skip unsplittable frames and frames that have dedicated windows. | ||
| 917 | ;; create a new splittable frame if none is found | ||
| 918 | (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) | 897 | (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) |
| 898 | "Skip unsplittable frames and frames that have dedicated windows. | ||
| 899 | create a new splittable frame if none is found." | ||
| 919 | (if (ediff-window-display-p) | 900 | (if (ediff-window-display-p) |
| 920 | (let ((wind-frame (window-frame)) | 901 | (let ((wind-frame (window-frame)) |
| 921 | seen-windows) | 902 | seen-windows) |
| @@ -975,14 +956,14 @@ into icons, regardless of the window manager." | |||
| 975 | ;; user-grabbed-mouse | 956 | ;; user-grabbed-mouse |
| 976 | fheight fwidth adjusted-parameters) | 957 | fheight fwidth adjusted-parameters) |
| 977 | 958 | ||
| 978 | (ediff-with-current-buffer ctl-buffer | 959 | (with-current-buffer ctl-buffer |
| 979 | (if (and (featurep 'xemacs) (featurep 'menubar)) | 960 | (if (and (featurep 'xemacs) (featurep 'menubar)) |
| 980 | (set-buffer-menubar nil)) | 961 | (set-buffer-menubar nil)) |
| 981 | ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) | 962 | ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) |
| 982 | (run-hooks 'ediff-before-setup-control-frame-hook)) | 963 | (run-hooks 'ediff-before-setup-control-frame-hook)) |
| 983 | 964 | ||
| 984 | (setq old-ctl-frame (ediff-with-current-buffer ctl-buffer ediff-control-frame)) | 965 | (setq old-ctl-frame (with-current-buffer ctl-buffer ediff-control-frame)) |
| 985 | (ediff-with-current-buffer ctl-buffer | 966 | (with-current-buffer ctl-buffer |
| 986 | (setq ctl-frame (if (frame-live-p old-ctl-frame) | 967 | (setq ctl-frame (if (frame-live-p old-ctl-frame) |
| 987 | old-ctl-frame | 968 | old-ctl-frame |
| 988 | (make-frame ediff-control-frame-parameters)) | 969 | (make-frame ediff-control-frame-parameters)) |
| @@ -1002,7 +983,7 @@ into icons, regardless of the window manager." | |||
| 1002 | 983 | ||
| 1003 | ;; must be before ediff-setup-control-buffer | 984 | ;; must be before ediff-setup-control-buffer |
| 1004 | ;; just a precaution--we should be in ctl-buffer already | 985 | ;; just a precaution--we should be in ctl-buffer already |
| 1005 | (ediff-with-current-buffer ctl-buffer | 986 | (with-current-buffer ctl-buffer |
| 1006 | (make-local-variable 'frame-title-format) | 987 | (make-local-variable 'frame-title-format) |
| 1007 | (make-local-variable 'frame-icon-title-format) ; XEmacs | 988 | (make-local-variable 'frame-icon-title-format) ; XEmacs |
| 1008 | (make-local-variable 'icon-title-format)) ; Emacs | 989 | (make-local-variable 'icon-title-format)) ; Emacs |
| @@ -1101,12 +1082,12 @@ into icons, regardless of the window manager." | |||
| 1101 | (not (eq ediff-grab-mouse t))))) | 1082 | (not (eq ediff-grab-mouse t))))) |
| 1102 | 1083 | ||
| 1103 | (when (featurep 'xemacs) | 1084 | (when (featurep 'xemacs) |
| 1104 | (ediff-with-current-buffer ctl-buffer | 1085 | (with-current-buffer ctl-buffer |
| 1105 | (make-local-hook 'select-frame-hook) | 1086 | (make-local-hook 'select-frame-hook) |
| 1106 | (add-hook 'select-frame-hook | 1087 | (add-hook 'select-frame-hook |
| 1107 | 'ediff-xemacs-select-frame-hook nil 'local))) | 1088 | #'ediff-xemacs-select-frame-hook nil 'local))) |
| 1108 | 1089 | ||
| 1109 | (ediff-with-current-buffer ctl-buffer | 1090 | (with-current-buffer ctl-buffer |
| 1110 | (run-hooks 'ediff-after-setup-control-frame-hook)))) | 1091 | (run-hooks 'ediff-after-setup-control-frame-hook)))) |
| 1111 | 1092 | ||
| 1112 | 1093 | ||
| @@ -1126,7 +1107,7 @@ into icons, regardless of the window manager." | |||
| 1126 | 1107 | ||
| 1127 | ;; finds a good place to clip control frame | 1108 | ;; finds a good place to clip control frame |
| 1128 | (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height) | 1109 | (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height) |
| 1129 | (ediff-with-current-buffer ctl-buffer | 1110 | (with-current-buffer ctl-buffer |
| 1130 | (let* ((frame-A (window-frame ediff-window-A)) | 1111 | (let* ((frame-A (window-frame ediff-window-A)) |
| 1131 | (frame-A-parameters (frame-parameters frame-A)) | 1112 | (frame-A-parameters (frame-parameters frame-A)) |
| 1132 | (frame-A-top (eval (cdr (assoc 'top frame-A-parameters)))) | 1113 | (frame-A-top (eval (cdr (assoc 'top frame-A-parameters)))) |
| @@ -1380,12 +1361,4 @@ It assumes that it is called from within the control buffer." | |||
| 1380 | 1361 | ||
| 1381 | 1362 | ||
| 1382 | (provide 'ediff-wind) | 1363 | (provide 'ediff-wind) |
| 1383 | |||
| 1384 | |||
| 1385 | ;; Local Variables: | ||
| 1386 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | ||
| 1387 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | ||
| 1388 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | ||
| 1389 | ;; End: | ||
| 1390 | |||
| 1391 | ;;; ediff-wind.el ends here | 1364 | ;;; ediff-wind.el ends here |