diff options
| author | Karl Heuer | 1995-06-05 23:42:53 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-06-05 23:42:53 +0000 |
| commit | 18b5607fcd19140d0314a417bef4d8a7146c0026 (patch) | |
| tree | 5dee571668f812d0f3479c043cb44c8bfb8446e9 | |
| parent | f1a5512adf3a937685377de551f06ee4a694266c (diff) | |
| download | emacs-18b5607fcd19140d0314a417bef4d8a7146c0026.tar.gz emacs-18b5607fcd19140d0314a417bef4d8a7146c0026.zip | |
(ediff-make-control-frame): optimized for display.
Commented out (redraw-display), to improve speed.
Got rid of toolbars in control frame in xemacs
Changed window-min-height from 1 to 2
(ediff-diff-at-point,ediff-toggle-multiframe): bug fixes.
(ediff-destroy-control-frame,ediff-window-display-p): new functions.
Converted xemacs *screen* nomenclature to *frame*.
Incorporated overlay strings. Ediff no longer runs under emacs
19.28 and earlier and XEmacs 19.11 and earlier.
Changed window-system to ediff-window-display.
(ediff-toggle-multiframe): fixed.
(ediff-destroy-control-frame): new function.
| -rw-r--r-- | lisp/ediff-wind.el | 303 |
1 files changed, 158 insertions, 145 deletions
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el index 6ad7eaa97a9..56a497285ac 100644 --- a/lisp/ediff-wind.el +++ b/lisp/ediff-wind.el | |||
| @@ -23,9 +23,9 @@ | |||
| 23 | (require 'ediff-init) | 23 | (require 'ediff-init) |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | (defvar ediff-window-setup-function (if (not window-system) | 26 | (defvar ediff-window-setup-function (if (ediff-window-display-p) |
| 27 | 'ediff-setup-windows-plain | 27 | 'ediff-setup-windows-multiframe |
| 28 | 'ediff-setup-windows-multiframe) | 28 | 'ediff-setup-windows-plain) |
| 29 | "*Function called to set up windows. | 29 | "*Function called to set up windows. |
| 30 | Ediff provides a choice of two functions: ediff-setup-windows-plain, for | 30 | Ediff provides a choice of two functions: ediff-setup-windows-plain, for |
| 31 | doing everything in one frame, and ediff-setup-windows-multiframe, | 31 | doing everything in one frame, and ediff-setup-windows-multiframe, |
| @@ -82,25 +82,25 @@ This variable has no effect when buffer-A/B/C are shown in different frames. | |||
| 82 | In this case, Ediff will use those frames to display these buffers.") | 82 | In this case, Ediff will use those frames to display these buffers.") |
| 83 | 83 | ||
| 84 | (defconst ediff-control-frame-parameters | 84 | (defconst ediff-control-frame-parameters |
| 85 | (if window-system | 85 | (if (ediff-window-display-p) |
| 86 | (list | 86 | (list |
| 87 | '(name . "Ediff") | 87 | '(name . "Ediff") |
| 88 | ;;'(unsplittable . t) | 88 | ;;'(unsplittable . t) |
| 89 | '(minibuffer . nil) | 89 | '(minibuffer . nil) |
| 90 | '(vertical-scroll-bars . nil) ; FSF only | 90 | '(vertical-scroll-bars . nil) ; Emacs only |
| 91 | '(scrollbar-width . 0) ; XEmacs only | 91 | '(scrollbar-width . 0) ; XEmacs only |
| 92 | '(menu-bar-lines . 0) ; FSF only | 92 | '(menu-bar-lines . 0) ; Emacs only |
| 93 | ;; don't lower and auto-raise | 93 | ;; don't lower and auto-raise |
| 94 | '(auto-lower . nil) | 94 | '(auto-lower . nil) |
| 95 | '(auto-raise . t) | 95 | '(auto-raise . t) |
| 96 | ;; this blocks queries from window manager as to where to put | 96 | ;; this blocks queries from window manager as to where to put |
| 97 | ;; ediff's control frame. we put the frame outside the display, | 97 | ;; ediff's control frame. we put the frame outside the display, |
| 98 | ;; so the initial frame won't jump all over the screen | 98 | ;; so the initial frame won't jump all over the screen |
| 99 | (cons 'top (if (fboundp 'x-display-pixel-height) | 99 | (cons 'top (if (fboundp 'ediff-display-pixel-height) |
| 100 | (1+ (x-display-pixel-height)) | 100 | (1+ (ediff-display-pixel-height)) |
| 101 | 3000)) | 101 | 3000)) |
| 102 | (cons 'left (if (fboundp 'x-display-pixel-width) | 102 | (cons 'left (if (fboundp 'ediff-display-pixel-width) |
| 103 | (1+ (x-display-pixel-width)) | 103 | (1+ (ediff-display-pixel-width)) |
| 104 | 3000)) | 104 | 3000)) |
| 105 | )) | 105 | )) |
| 106 | "Frame parameters for displaying Ediff Control Panel. | 106 | "Frame parameters for displaying Ediff Control Panel. |
| @@ -186,28 +186,28 @@ into icons, regardless of the window manager.") | |||
| 186 | 186 | ||
| 187 | ;; Select the lowest window on the frame. | 187 | ;; Select the lowest window on the frame. |
| 188 | (defun ediff-select-lowest-window () | 188 | (defun ediff-select-lowest-window () |
| 189 | (let* ((lowest-window (selected-window)) | 189 | (if ediff-xemacs-p |
| 190 | (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) | 190 | (select-window (frame-lowest-window)) |
| 191 | ;;(last-window (previous-window)) | 191 | (let* ((lowest-window (selected-window)) |
| 192 | (last-window (save-excursion | 192 | (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) |
| 193 | (other-window -1) (selected-window))) | 193 | (last-window (save-excursion |
| 194 | (window-search t)) | 194 | (other-window -1) (selected-window))) |
| 195 | (while window-search | 195 | (window-search t)) |
| 196 | (let* ((this-window (next-window)) | 196 | (while window-search |
| 197 | (next-bottom-edge (car (cdr (cdr (cdr | 197 | (let* ((this-window (next-window)) |
| 198 | (window-edges this-window))))))) | 198 | (next-bottom-edge |
| 199 | (if (< bottom-edge next-bottom-edge) | 199 | (car (cdr (cdr (cdr (window-edges this-window))))))) |
| 200 | (progn | 200 | (if (< bottom-edge next-bottom-edge) |
| 201 | (setq bottom-edge next-bottom-edge) | 201 | (progn |
| 202 | (setq lowest-window this-window))) | 202 | (setq bottom-edge next-bottom-edge) |
| 203 | 203 | (setq lowest-window this-window))) | |
| 204 | (select-window this-window) | 204 | |
| 205 | (if (eq last-window this-window) | 205 | (select-window this-window) |
| 206 | (progn | 206 | (if (eq last-window this-window) |
| 207 | (select-window lowest-window) | 207 | (progn |
| 208 | (setq window-search nil))))))) | 208 | (select-window lowest-window) |
| 209 | (setq window-search nil)))))))) | ||
| 209 | 210 | ||
| 210 | |||
| 211 | 211 | ||
| 212 | ;;; Common window setup routines | 212 | ;;; Common window setup routines |
| 213 | 213 | ||
| @@ -222,8 +222,10 @@ into icons, regardless of the window manager.") | |||
| 222 | (if (eq (selected-window) (minibuffer-window)) | 222 | (if (eq (selected-window) (minibuffer-window)) |
| 223 | (other-window 1)) | 223 | (other-window 1)) |
| 224 | 224 | ||
| 225 | ;; when support for buf C is added, the actual window setup function will | 225 | ;; in case user did a no-no on a tty |
| 226 | ;; depend on ediff-job-name | 226 | (or (ediff-window-display-p) |
| 227 | (setq ediff-window-setup-function 'ediff-setup-windows-plain)) | ||
| 228 | |||
| 227 | (or (ediff-keep-window-config control-buffer) | 229 | (or (ediff-keep-window-config control-buffer) |
| 228 | (funcall | 230 | (funcall |
| 229 | (ediff-eval-in-buffer control-buffer ediff-window-setup-function) | 231 | (ediff-eval-in-buffer control-buffer ediff-window-setup-function) |
| @@ -243,15 +245,9 @@ into icons, regardless of the window manager.") | |||
| 243 | buffer-A buffer-B buffer-C control-buffer))) | 245 | buffer-A buffer-B buffer-C control-buffer))) |
| 244 | 246 | ||
| 245 | (defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer) | 247 | (defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer) |
| 246 | ;; skip dedicated and unsplittable frames | 248 | ;; skip dedicated and unsplittable frames |
| 247 | (ediff-eval-in-buffer control-buffer | 249 | (ediff-destroy-control-frame control-buffer) |
| 248 | (if (and window-system (ediff-frame-live-p ediff-control-frame)) | 250 | (let ((window-min-height 2) |
| 249 | (progn | ||
| 250 | (redraw-display) | ||
| 251 | (ediff-delete-frame ediff-control-frame) | ||
| 252 | (setq ediff-control-frame nil)))) | ||
| 253 | (ediff-skip-unsuitable-frames) | ||
| 254 | (let ((window-min-height 1) | ||
| 255 | split-window-function | 251 | split-window-function |
| 256 | merge-window-share merge-window-lines | 252 | merge-window-share merge-window-lines |
| 257 | wind-A wind-B wind-C) | 253 | wind-A wind-B wind-C) |
| @@ -302,17 +298,11 @@ into icons, regardless of the window manager.") | |||
| 302 | ;; This function handles all comparison jobs, including 3way jobs | 298 | ;; This function handles all comparison jobs, including 3way jobs |
| 303 | (defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer) | 299 | (defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer) |
| 304 | ;; skip dedicated and unsplittable frames | 300 | ;; skip dedicated and unsplittable frames |
| 305 | (ediff-eval-in-buffer control-buffer | 301 | (ediff-destroy-control-frame control-buffer) |
| 306 | (if (and window-system (ediff-frame-live-p ediff-control-frame)) | 302 | (let ((window-min-height 2) |
| 307 | (progn | ||
| 308 | (redraw-display) | ||
| 309 | (ediff-delete-frame ediff-control-frame) | ||
| 310 | (setq ediff-control-frame nil)))) | ||
| 311 | (ediff-skip-unsuitable-frames) | ||
| 312 | (let ((window-min-height 1) | ||
| 313 | split-window-function wind-width-or-height | 303 | split-window-function wind-width-or-height |
| 314 | three-way-comparison | 304 | three-way-comparison |
| 315 | job wind-A-start wind-B-start wind-A wind-B wind-C) | 305 | wind-A-start wind-B-start wind-A wind-B wind-C) |
| 316 | (ediff-eval-in-buffer control-buffer | 306 | (ediff-eval-in-buffer control-buffer |
| 317 | (setq wind-A-start (ediff-overlay-start | 307 | (setq wind-A-start (ediff-overlay-start |
| 318 | (ediff-get-value-according-to-buffer-type | 308 | (ediff-get-value-according-to-buffer-type |
| @@ -320,7 +310,6 @@ into icons, regardless of the window manager.") | |||
| 320 | wind-B-start (ediff-overlay-start | 310 | wind-B-start (ediff-overlay-start |
| 321 | (ediff-get-value-according-to-buffer-type | 311 | (ediff-get-value-according-to-buffer-type |
| 322 | 'B ediff-narrow-bounds)) | 312 | 'B ediff-narrow-bounds)) |
| 323 | job ediff-job-name | ||
| 324 | ;; this lets us have local versions of ediff-split-window-function | 313 | ;; this lets us have local versions of ediff-split-window-function |
| 325 | split-window-function ediff-split-window-function | 314 | split-window-function ediff-split-window-function |
| 326 | three-way-comparison ediff-3way-comparison-job)) | 315 | three-way-comparison ediff-3way-comparison-job)) |
| @@ -366,7 +355,7 @@ into icons, regardless of the window manager.") | |||
| 366 | 355 | ||
| 367 | ;; It is unlikely that we will want to implement 3way window comparison. | 356 | ;; It is unlikely that we will want to implement 3way window comparison. |
| 368 | ;; So, only buffers A and B are used here. | 357 | ;; So, only buffers A and B are used here. |
| 369 | (if (eq job 'ediff-windows) | 358 | (if ediff-windows-job |
| 370 | (progn | 359 | (progn |
| 371 | (set-window-start wind-A wind-A-start) | 360 | (set-window-start wind-A wind-A-start) |
| 372 | (set-window-start wind-B wind-B-start))) | 361 | (set-window-start wind-B wind-B-start))) |
| @@ -394,17 +383,17 @@ into icons, regardless of the window manager.") | |||
| 394 | ;;; If buffers A, B, C are is separate frames, use them to display these | 383 | ;;; If buffers A, B, C are is separate frames, use them to display these |
| 395 | ;;; buffers. | 384 | ;;; buffers. |
| 396 | 385 | ||
| 397 | ;; Skip dedicated or iconified frames. Unsplittable frames are taken | 386 | ;; Skip dedicated or iconified frames. |
| 398 | ;; care of later. | 387 | ;; Unsplittable frames are taken care of later. |
| 399 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | 388 | (ediff-skip-unsuitable-frames 'ok-unsplittable) |
| 400 | 389 | ||
| 401 | (let* ((window-min-height 1) | 390 | (let* ((window-min-height 2) |
| 402 | (wind-A (ediff-get-visible-buffer-window buf-A)) | 391 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
| 403 | (wind-B (ediff-get-visible-buffer-window buf-B)) | 392 | (wind-B (ediff-get-visible-buffer-window buf-B)) |
| 404 | (wind-C (ediff-get-visible-buffer-window buf-C)) | 393 | (wind-C (ediff-get-visible-buffer-window buf-C)) |
| 405 | (frame-A (if wind-A (ediff-window-frame wind-A))) | 394 | (frame-A (if wind-A (window-frame wind-A))) |
| 406 | (frame-B (if wind-B (ediff-window-frame wind-B))) | 395 | (frame-B (if wind-B (window-frame wind-B))) |
| 407 | (frame-C (if wind-C (ediff-window-frame wind-C))) | 396 | (frame-C (if wind-C (window-frame wind-C))) |
| 408 | ;; on wide display, do things in one frame | 397 | ;; on wide display, do things in one frame |
| 409 | (force-one-frame | 398 | (force-one-frame |
| 410 | (ediff-eval-in-buffer control-buf ediff-wide-display-p)) | 399 | (ediff-eval-in-buffer control-buf ediff-wide-display-p)) |
| @@ -412,12 +401,14 @@ into icons, regardless of the window manager.") | |||
| 412 | (split-window-function | 401 | (split-window-function |
| 413 | (ediff-eval-in-buffer control-buf ediff-split-window-function)) | 402 | (ediff-eval-in-buffer control-buf ediff-split-window-function)) |
| 414 | (orig-wind (selected-window)) | 403 | (orig-wind (selected-window)) |
| 415 | (orig-frame (ediff-selected-frame)) | 404 | (orig-frame (selected-frame)) |
| 416 | (use-same-frame (or force-one-frame | 405 | (use-same-frame (or force-one-frame |
| 417 | (eq frame-A (or frame-C orig-frame)) | 406 | (eq frame-A (or frame-C orig-frame)) |
| 418 | (eq frame-B (or frame-C orig-frame)) | 407 | (eq frame-B (or frame-C orig-frame)) |
| 419 | (not (ediff-frame-live-p frame-A)) | 408 | (not (frame-live-p frame-A)) |
| 420 | (not (ediff-frame-live-p frame-B)) | 409 | (not (frame-live-p frame-B)) |
| 410 | (and (eq frame-A frame-B) | ||
| 411 | (not (frame-live-p frame-C))) | ||
| 421 | )) | 412 | )) |
| 422 | (use-same-frame-for-AB (and (not use-same-frame) | 413 | (use-same-frame-for-AB (and (not use-same-frame) |
| 423 | (eq frame-A frame-B))) | 414 | (eq frame-A frame-B))) |
| @@ -458,7 +449,7 @@ into icons, regardless of the window manager.") | |||
| 458 | 449 | ||
| 459 | (if use-same-frame-for-AB | 450 | (if use-same-frame-for-AB |
| 460 | (progn | 451 | (progn |
| 461 | (ediff-select-frame frame-A) | 452 | (select-frame frame-A) |
| 462 | (switch-to-buffer buf-A) | 453 | (switch-to-buffer buf-A) |
| 463 | (delete-other-windows) | 454 | (delete-other-windows) |
| 464 | (setq wind-A (selected-window)) | 455 | (setq wind-A (selected-window)) |
| @@ -473,11 +464,11 @@ into icons, regardless of the window manager.") | |||
| 473 | done-B t))) | 464 | done-B t))) |
| 474 | 465 | ||
| 475 | (if use-same-frame | 466 | (if use-same-frame |
| 476 | (let ((curr-frame (ediff-selected-frame)) | 467 | (let ((curr-frame (selected-frame)) |
| 477 | (window-min-height 1)) | 468 | (window-min-height 2)) |
| 478 | ;; avoid dedicated and non-splittable windows | 469 | ;; avoid dedicated and non-splittable windows |
| 479 | (ediff-skip-unsuitable-frames) | 470 | (ediff-skip-unsuitable-frames) |
| 480 | (or (eq curr-frame (ediff-selected-frame)) | 471 | (or (eq curr-frame (selected-frame)) |
| 481 | (setq wind-A nil | 472 | (setq wind-A nil |
| 482 | wind-B nil | 473 | wind-B nil |
| 483 | wind-C nil | 474 | wind-C nil |
| @@ -545,12 +536,11 @@ into icons, regardless of the window manager.") | |||
| 545 | (setq ediff-window-A wind-A | 536 | (setq ediff-window-A wind-A |
| 546 | ediff-window-B wind-B | 537 | ediff-window-B wind-B |
| 547 | ediff-window-C wind-C) | 538 | ediff-window-C wind-C) |
| 548 | 539 | (setq frame-A (window-frame ediff-window-A) | |
| 549 | (setq frame-A (ediff-window-frame ediff-window-A) | 540 | designated-minibuffer-frame |
| 550 | designated-minibuffer-frame (ediff-window-frame | 541 | (window-frame (minibuffer-window frame-A)))) |
| 551 | (minibuffer-window frame-A)))) | 542 | |
| 552 | 543 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) | |
| 553 | (ediff-setup-control-frame control-buf) | ||
| 554 | )) | 544 | )) |
| 555 | 545 | ||
| 556 | 546 | ||
| @@ -572,15 +562,15 @@ into icons, regardless of the window manager.") | |||
| 572 | ;; Unsplittable frames are taken care of later. | 562 | ;; Unsplittable frames are taken care of later. |
| 573 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | 563 | (ediff-skip-unsuitable-frames 'ok-unsplittable) |
| 574 | 564 | ||
| 575 | (let* ((window-min-height 1) | 565 | (let* ((window-min-height 2) |
| 576 | (wind-A (ediff-get-visible-buffer-window buf-A)) | 566 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
| 577 | (wind-B (ediff-get-visible-buffer-window buf-B)) | 567 | (wind-B (ediff-get-visible-buffer-window buf-B)) |
| 578 | (wind-C (ediff-get-visible-buffer-window buf-C)) | 568 | (wind-C (ediff-get-visible-buffer-window buf-C)) |
| 579 | (frame-A (if wind-A (ediff-window-frame wind-A))) | 569 | (frame-A (if wind-A (window-frame wind-A))) |
| 580 | (frame-B (if wind-B (ediff-window-frame wind-B))) | 570 | (frame-B (if wind-B (window-frame wind-B))) |
| 581 | (frame-C (if wind-C (ediff-window-frame wind-C))) | 571 | (frame-C (if wind-C (window-frame wind-C))) |
| 582 | (ctl-frame-exists-p (ediff-eval-in-buffer control-buf | 572 | (ctl-frame-exists-p (ediff-eval-in-buffer control-buf |
| 583 | (ediff-frame-live-p ediff-control-frame))) | 573 | (frame-live-p ediff-control-frame))) |
| 584 | ;; on wide display, do things in one frame | 574 | ;; on wide display, do things in one frame |
| 585 | (force-one-frame | 575 | (force-one-frame |
| 586 | (ediff-eval-in-buffer control-buf ediff-wide-display-p)) | 576 | (ediff-eval-in-buffer control-buf ediff-wide-display-p)) |
| @@ -595,16 +585,16 @@ into icons, regardless of the window manager.") | |||
| 595 | (if three-way-comparison | 585 | (if three-way-comparison |
| 596 | (or (eq frame-A frame-C) | 586 | (or (eq frame-A frame-C) |
| 597 | (eq frame-B frame-C) | 587 | (eq frame-B frame-C) |
| 598 | (not (ediff-frame-live-p frame-A)) | 588 | (not (frame-live-p frame-A)) |
| 599 | (not (ediff-frame-live-p frame-B)) | 589 | (not (frame-live-p frame-B)) |
| 600 | (not (ediff-frame-live-p frame-C)))) | 590 | (not (frame-live-p frame-C)))) |
| 601 | (and (not (ediff-frame-live-p frame-B)) | 591 | (and (not (frame-live-p frame-B)) |
| 602 | (or ctl-frame-exists-p | 592 | (or ctl-frame-exists-p |
| 603 | (eq frame-A (ediff-selected-frame)))) | 593 | (eq frame-A (selected-frame)))) |
| 604 | (and (not (ediff-frame-live-p frame-A)) | 594 | (and (not (frame-live-p frame-A)) |
| 605 | (or ctl-frame-exists-p | 595 | (or ctl-frame-exists-p |
| 606 | (eq frame-B (ediff-selected-frame)))))) | 596 | (eq frame-B (selected-frame)))))) |
| 607 | wind-A-start wind-B-start job-name | 597 | wind-A-start wind-B-start |
| 608 | designated-minibuffer-frame | 598 | designated-minibuffer-frame |
| 609 | done-A done-B done-C) | 599 | done-A done-B done-C) |
| 610 | 600 | ||
| @@ -614,8 +604,7 @@ into icons, regardless of the window manager.") | |||
| 614 | 'A ediff-narrow-bounds)) | 604 | 'A ediff-narrow-bounds)) |
| 615 | wind-B-start (ediff-overlay-start | 605 | wind-B-start (ediff-overlay-start |
| 616 | (ediff-get-value-according-to-buffer-type | 606 | (ediff-get-value-according-to-buffer-type |
| 617 | 'B ediff-narrow-bounds)) | 607 | 'B ediff-narrow-bounds)))) |
| 618 | job-name ediff-job-name)) | ||
| 619 | 608 | ||
| 620 | (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own | 609 | (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own |
| 621 | (progn | 610 | (progn |
| @@ -642,12 +631,12 @@ into icons, regardless of the window manager.") | |||
| 642 | (setq done-C t))) | 631 | (setq done-C t))) |
| 643 | 632 | ||
| 644 | (if use-same-frame | 633 | (if use-same-frame |
| 645 | (let ((curr-frame (ediff-selected-frame)) | 634 | (let ((curr-frame (selected-frame)) |
| 646 | ;; this affects 3way setups only | 635 | ;; this affects 3way setups only |
| 647 | wind-width-or-height) | 636 | wind-width-or-height) |
| 648 | ;; avoid dedicated and non-splittable windows | 637 | ;; avoid dedicated and non-splittable windows |
| 649 | (ediff-skip-unsuitable-frames) | 638 | (ediff-skip-unsuitable-frames) |
| 650 | (or (eq curr-frame (ediff-selected-frame)) | 639 | (or (eq curr-frame (selected-frame)) |
| 651 | (setq wind-A nil | 640 | (setq wind-A nil |
| 652 | wind-B nil | 641 | wind-B nil |
| 653 | wind-C nil | 642 | wind-C nil |
| @@ -720,33 +709,33 @@ into icons, regardless of the window manager.") | |||
| 720 | (setq ediff-window-A wind-A | 709 | (setq ediff-window-A wind-A |
| 721 | ediff-window-B wind-B | 710 | ediff-window-B wind-B |
| 722 | ediff-window-C wind-C) | 711 | ediff-window-C wind-C) |
| 723 | 712 | ||
| 724 | (setq frame-A (ediff-window-frame ediff-window-A) | 713 | (setq frame-A (window-frame ediff-window-A) |
| 725 | designated-minibuffer-frame (ediff-window-frame | 714 | designated-minibuffer-frame |
| 726 | (minibuffer-window frame-A)))) | 715 | (window-frame (minibuffer-window frame-A)))) |
| 727 | 716 | ||
| 728 | ;; It is unlikely that we'll implement ediff-windows that would compare | 717 | ;; It is unlikely that we'll implement ediff-windows that would compare |
| 729 | ;; 3 windows at once. So, we don't use buffer C here. | 718 | ;; 3 windows at once. So, we don't use buffer C here. |
| 730 | (if (eq job-name 'ediff-windows) | 719 | (if ediff-windows-job |
| 731 | (progn | 720 | (progn |
| 732 | (set-window-start wind-A wind-A-start) | 721 | (set-window-start wind-A wind-A-start) |
| 733 | (set-window-start wind-B wind-B-start))) | 722 | (set-window-start wind-B wind-B-start))) |
| 734 | 723 | ||
| 735 | (ediff-setup-control-frame control-buf) | 724 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) |
| 736 | )) | 725 | )) |
| 737 | 726 | ||
| 738 | ;; skip unsplittable and dedicated windows | 727 | ;; skip unsplittable and dedicated windows |
| 739 | ;; create a new splittable frame if none is found | 728 | ;; create a new splittable frame if none is found |
| 740 | (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) | 729 | (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) |
| 741 | (if window-system | 730 | (if (ediff-window-display-p) |
| 742 | (let (last-window) | 731 | (let (last-window) |
| 743 | (while (and (not (eq (selected-window) last-window)) | 732 | (while (and (not (eq (selected-window) last-window)) |
| 744 | (or | 733 | (or |
| 745 | (window-dedicated-p (selected-window)) | 734 | (window-dedicated-p (selected-window)) |
| 746 | (ediff-frame-iconified-p (ediff-selected-frame)) | 735 | (ediff-frame-iconified-p (selected-frame)) |
| 747 | (if ok-unsplittable | 736 | (if ok-unsplittable |
| 748 | nil | 737 | nil |
| 749 | (ediff-frame-unsplittable-p (ediff-selected-frame))))) | 738 | (ediff-frame-unsplittable-p (selected-frame))))) |
| 750 | ;; remember where started | 739 | ;; remember where started |
| 751 | (or last-window (setq last-window (selected-window))) | 740 | (or last-window (setq last-window (selected-window))) |
| 752 | ;; try new window | 741 | ;; try new window |
| @@ -754,31 +743,38 @@ into icons, regardless of the window manager.") | |||
| 754 | (if (eq (selected-window) last-window) | 743 | (if (eq (selected-window) last-window) |
| 755 | ;; fed up, no appropriate frame | 744 | ;; fed up, no appropriate frame |
| 756 | (progn | 745 | (progn |
| 757 | (redraw-display) | 746 | ;;(redraw-display) |
| 758 | (ediff-select-frame (ediff-make-frame '((unsplittable))))))))) | 747 | (select-frame (ediff-make-frame '((unsplittable))))))))) |
| 759 | 748 | ||
| 760 | ;; Prepare or refresh control frame | 749 | ;; Prepare or refresh control frame |
| 761 | (defun ediff-setup-control-frame (ctl-buffer) | 750 | (defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame) |
| 762 | (let ((window-min-height 1) | 751 | (let ((window-min-height 2) |
| 763 | ctl-frame-iconified-p dont-iconify-ctl-frame deiconify-ctl-frame | 752 | ctl-frame-iconified-p dont-iconify-ctl-frame deiconify-ctl-frame |
| 764 | ctl-frame old-ctl-frame lines | 753 | ctl-frame old-ctl-frame lines |
| 765 | fheight fwidth adjusted-parameters) | 754 | fheight fwidth adjusted-parameters) |
| 766 | 755 | ||
| 767 | (ediff-eval-in-buffer ctl-buffer | 756 | (ediff-eval-in-buffer ctl-buffer |
| 757 | (if ediff-xemacs-p (set-buffer-menubar nil)) | ||
| 768 | (run-hooks 'ediff-before-setup-control-frame-hooks)) | 758 | (run-hooks 'ediff-before-setup-control-frame-hooks)) |
| 769 | 759 | ||
| 770 | (setq old-ctl-frame (ediff-eval-in-buffer ctl-buffer ediff-control-frame)) | 760 | (setq old-ctl-frame (ediff-eval-in-buffer ctl-buffer ediff-control-frame)) |
| 761 | ;; Delete the old ctl frame and get a new ctl frame. | ||
| 762 | ;; The old ctl frame is deleted to let emacs reset default minibuffer | ||
| 763 | ;; frame or when the ctl frame needs to be moved. | ||
| 764 | ;; The old frame isn't reused, since ediff-setup-control-frame is called | ||
| 765 | ;; very rarely, so the overhead is minimal. | ||
| 771 | (if (frame-live-p old-ctl-frame) (delete-frame old-ctl-frame)) | 766 | (if (frame-live-p old-ctl-frame) (delete-frame old-ctl-frame)) |
| 772 | (redraw-display) | 767 | ;;(redraw-display) |
| 773 | ;; Make the frame while ctl-buff is current, so that | 768 | ;; new ctl frame should be created while ctl-buff is current, so that |
| 774 | ;; ediff-control-frame-parameters will have the right value. | 769 | ;; the local default-minibuffer-frame will be consulted and |
| 770 | ;; that ediff-control-frame-parameters will have the right value. | ||
| 775 | (ediff-eval-in-buffer ctl-buffer | 771 | (ediff-eval-in-buffer ctl-buffer |
| 776 | (let ((default-minibuffer-frame designated-minibuffer-frame)) | 772 | (let ((default-minibuffer-frame designated-minibuffer-frame)) |
| 777 | (setq ctl-frame (ediff-make-frame ediff-control-frame-parameters) | 773 | (setq ctl-frame (make-frame ediff-control-frame-parameters) |
| 778 | ctl-buffer (setq ediff-control-frame ctl-frame)))) | 774 | ediff-control-frame ctl-frame))) |
| 779 | 775 | ||
| 780 | (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame)) | 776 | (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame)) |
| 781 | (ediff-select-frame ctl-frame) | 777 | (select-frame ctl-frame) |
| 782 | (if (window-dedicated-p (selected-window)) | 778 | (if (window-dedicated-p (selected-window)) |
| 783 | () | 779 | () |
| 784 | (delete-other-windows) | 780 | (delete-other-windows) |
| @@ -788,8 +784,8 @@ into icons, regardless of the window manager.") | |||
| 788 | (if ediff-xemacs-p | 784 | (if ediff-xemacs-p |
| 789 | ;; just a precaution--we should be in ctl-buffer already | 785 | ;; just a precaution--we should be in ctl-buffer already |
| 790 | (ediff-eval-in-buffer ctl-buffer | 786 | (ediff-eval-in-buffer ctl-buffer |
| 791 | (make-local-variable 'screen-title-format) | 787 | (make-local-variable 'frame-title-format) |
| 792 | (make-local-variable 'screen-icon-title-format))) | 788 | (make-local-variable 'frame-icon-title-format))) |
| 793 | 789 | ||
| 794 | (ediff-setup-control-buffer ctl-buffer) | 790 | (ediff-setup-control-buffer ctl-buffer) |
| 795 | (setq dont-iconify-ctl-frame | 791 | (setq dont-iconify-ctl-frame |
| @@ -812,36 +808,41 @@ into icons, regardless of the window manager.") | |||
| 812 | ctl-buffer fwidth fheight))) | 808 | ctl-buffer fwidth fheight))) |
| 813 | 809 | ||
| 814 | ;; In XEmacs, buffer menubar needs to be killed before frame parameters | 810 | ;; In XEmacs, buffer menubar needs to be killed before frame parameters |
| 815 | ;; are changed XEmacs needs to redisplay, as it has trouble setting | 811 | ;; are changed. XEmacs needs to redisplay, as it has trouble setting |
| 816 | ;; height correctly otherwise. | 812 | ;; height correctly otherwise. |
| 817 | (if (and ediff-xemacs-p (ediff-frame-has-menubar)) | 813 | (if ediff-xemacs-p |
| 818 | (progn (set-buffer-menubar nil)(sit-for 0))) | 814 | (progn |
| 815 | (set-specifier top-toolbar-height (list ctl-frame 0)) | ||
| 816 | (set-specifier bottom-toolbar-height (list ctl-frame 0)) | ||
| 817 | (set-specifier left-toolbar-width (list ctl-frame 0)) | ||
| 818 | (set-specifier right-toolbar-width (list ctl-frame 0)) | ||
| 819 | (sit-for 0))) | ||
| 819 | 820 | ||
| 820 | ;; Under OS/2 (emx) we have to call modify frame parameters twice, in | 821 | ;; Under OS/2 (emx) we have to call modify frame parameters twice, in |
| 821 | ;; order to make sure that at least once we do it for non-iconified | 822 | ;; order to make sure that at least once we do it for non-iconified |
| 822 | ;; frame. If appears that in the OS/2 port of Emacs, one can't modify | 823 | ;; frame. If appears that in the OS/2 port of Emacs, one can't modify |
| 823 | ;; frame parameters of iconified frames. | 824 | ;; frame parameters of iconified frames. |
| 824 | (if (eq system-type 'emx) | 825 | (if (eq system-type 'emx) |
| 825 | (ediff-modify-frame-parameters ctl-frame adjusted-parameters)) | 826 | (modify-frame-parameters ctl-frame adjusted-parameters)) |
| 826 | 827 | ||
| 827 | (goto-char (point-min)) | 828 | (goto-char (point-min)) |
| 828 | 829 | ||
| 829 | (cond ((and ediff-prefer-iconified-control-frame | 830 | (cond ((and ediff-prefer-iconified-control-frame |
| 830 | (not ctl-frame-iconified-p) | 831 | (not ctl-frame-iconified-p) |
| 831 | (not dont-iconify-ctl-frame)) | 832 | (not dont-iconify-ctl-frame)) |
| 832 | (ediff-iconify-frame ctl-frame)) | 833 | (iconify-frame ctl-frame)) |
| 833 | ((or deiconify-ctl-frame | 834 | ((or deiconify-ctl-frame |
| 834 | (not ctl-frame-iconified-p)) | 835 | (not ctl-frame-iconified-p)) |
| 835 | (ediff-raise-frame ctl-frame))) | 836 | (raise-frame ctl-frame))) |
| 836 | 837 | ||
| 837 | ;; This works around a bug in 19.25 and earlier. There, if frame gets | 838 | ;; This works around a bug in 19.25 and earlier. There, if frame gets |
| 838 | ;; iconified, the current buffer changes to that of the frame that | 839 | ;; iconified, the current buffer changes to that of the frame that |
| 839 | ;; becomes exposed as a result of this iconification. | 840 | ;; becomes exposed as a result of this iconification. |
| 840 | ;; So, we make sure the current buffer doesn't change. | 841 | ;; So, we make sure the current buffer doesn't change. |
| 841 | (ediff-select-frame ctl-frame) | 842 | (select-frame ctl-frame) |
| 842 | (ediff-refresh-control-frame) | 843 | (ediff-refresh-control-frame) |
| 843 | 844 | ||
| 844 | (ediff-modify-frame-parameters ctl-frame adjusted-parameters) | 845 | (modify-frame-parameters ctl-frame adjusted-parameters) |
| 845 | 846 | ||
| 846 | (if ediff-xemacs-p | 847 | (if ediff-xemacs-p |
| 847 | (set-window-buffer-dedicated (selected-window) ctl-buffer) | 848 | (set-window-buffer-dedicated (selected-window) ctl-buffer) |
| @@ -849,30 +850,41 @@ into icons, regardless of the window manager.") | |||
| 849 | 850 | ||
| 850 | (or ediff-xemacs-p (sit-for 0 200)) ; emacs has trouble here, needs time | 851 | (or ediff-xemacs-p (sit-for 0 200)) ; emacs has trouble here, needs time |
| 851 | (or (ediff-frame-iconified-p ctl-frame) | 852 | (or (ediff-frame-iconified-p ctl-frame) |
| 852 | (set-mouse-position ctl-frame 1 0)) | 853 | (ediff-reset-mouse ctl-frame)) |
| 853 | (if (ediff-check-version '< 19 11 'xemacs) (sit-for 0)) | ||
| 854 | (or ediff-xemacs-p (unfocus-frame)) | 854 | (or ediff-xemacs-p (unfocus-frame)) |
| 855 | 855 | ||
| 856 | (if ediff-xemacs-p | 856 | (if ediff-xemacs-p |
| 857 | (ediff-eval-in-buffer ctl-buffer | 857 | (ediff-eval-in-buffer ctl-buffer |
| 858 | (make-local-variable 'select-screen-hook) | 858 | (make-local-variable 'select-frame-hook) |
| 859 | (add-hook 'select-screen-hook 'ediff-xemacs-select-screen-hook) | 859 | (add-hook 'select-frame-hook 'ediff-xemacs-select-frame-hook) |
| 860 | )) | 860 | )) |
| 861 | 861 | ||
| 862 | (ediff-eval-in-buffer ctl-buffer | 862 | (ediff-eval-in-buffer ctl-buffer |
| 863 | (run-hooks 'ediff-after-setup-control-frame-hooks)) | 863 | (run-hooks 'ediff-after-setup-control-frame-hooks)) |
| 864 | 864 | )) | |
| 865 | )) | 865 | |
| 866 | (defun ediff-destroy-control-frame (ctl-buffer) | ||
| 867 | (ediff-eval-in-buffer ctl-buffer | ||
| 868 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) | ||
| 869 | (let ((ctl-frame ediff-control-frame)) | ||
| 870 | (if ediff-xemacs-p | ||
| 871 | (set-buffer-menubar default-menubar)) | ||
| 872 | ;;(redraw-display) | ||
| 873 | (setq ediff-control-frame nil) | ||
| 874 | (delete-frame ctl-frame) | ||
| 875 | ))) | ||
| 876 | (ediff-skip-unsuitable-frames) | ||
| 877 | (ediff-reset-mouse)) | ||
| 866 | 878 | ||
| 867 | 879 | ||
| 868 | ;; finds a good place to clip control frame | 880 | ;; finds a good place to clip control frame |
| 869 | (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height) | 881 | (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height) |
| 870 | (ediff-eval-in-buffer ctl-buffer | 882 | (ediff-eval-in-buffer ctl-buffer |
| 871 | (let* ((frame-A (ediff-window-frame ediff-window-A)) | 883 | (let* ((frame-A (window-frame ediff-window-A)) |
| 872 | (frame-A-parameters (ediff-frame-parameters frame-A)) | 884 | (frame-A-parameters (frame-parameters frame-A)) |
| 873 | (frame-A-top (cdr (assoc 'top frame-A-parameters))) | 885 | (frame-A-top (cdr (assoc 'top frame-A-parameters))) |
| 874 | (frame-A-left (cdr (assoc 'left frame-A-parameters))) | 886 | (frame-A-left (cdr (assoc 'left frame-A-parameters))) |
| 875 | (frame-A-width (ediff-frame-width frame-A)) | 887 | (frame-A-width (frame-width frame-A)) |
| 876 | (ctl-frame ediff-control-frame) | 888 | (ctl-frame ediff-control-frame) |
| 877 | horizontal-adjustment upward-adjustment | 889 | horizontal-adjustment upward-adjustment |
| 878 | ctl-frame-top) | 890 | ctl-frame-top) |
| @@ -900,9 +912,9 @@ into icons, regardless of the window manager.") | |||
| 900 | ediff-narrow-control-frame-leftward-shift | 912 | ediff-narrow-control-frame-leftward-shift |
| 901 | horizontal-adjustment)))))))))) | 913 | horizontal-adjustment)))))))))) |
| 902 | 914 | ||
| 903 | (defun ediff-xemacs-select-screen-hook () | 915 | (defun ediff-xemacs-select-frame-hook () |
| 904 | (if (equal (ediff-selected-frame) ediff-control-frame) | 916 | (if (equal (selected-frame) ediff-control-frame) |
| 905 | (ediff-raise-frame ediff-control-frame))) | 917 | (raise-frame ediff-control-frame))) |
| 906 | 918 | ||
| 907 | (defun ediff-make-wide-display () | 919 | (defun ediff-make-wide-display () |
| 908 | "Construct an alist of parameters for the wide display. | 920 | "Construct an alist of parameters for the wide display. |
| @@ -910,18 +922,17 @@ Saves the old frame parameters in `ediff-wide-display-orig-parameters'. | |||
| 910 | The frame to be resized is kept in `ediff-wide-display-frame'. | 922 | The frame to be resized is kept in `ediff-wide-display-frame'. |
| 911 | This function modifies only the left margin and the width of the display. | 923 | This function modifies only the left margin and the width of the display. |
| 912 | It assumes that it is called from within the control buffer." | 924 | It assumes that it is called from within the control buffer." |
| 913 | (if (not (fboundp 'x-display-pixel-width)) | 925 | (if (not (fboundp 'ediff-display-pixel-width)) |
| 914 | (error | 926 | (error "Can't determine display width.")) |
| 915 | "Can't determine display width. Please upgrade your version of Emacs")) | 927 | (let* ((frame-A (window-frame ediff-window-A)) |
| 916 | (let* ((frame-A (ediff-window-frame ediff-window-A)) | 928 | (frame-A-params (frame-parameters frame-A)) |
| 917 | (frame-A-params (ediff-frame-parameters frame-A)) | ||
| 918 | (cw (ediff-frame-char-width frame-A)) | 929 | (cw (ediff-frame-char-width frame-A)) |
| 919 | (wd (- (/ (x-display-pixel-width) cw) 5))) | 930 | (wd (- (/ (ediff-display-pixel-width) cw) 5))) |
| 920 | (setq ediff-wide-display-orig-parameters | 931 | (setq ediff-wide-display-orig-parameters |
| 921 | (list (cons 'left (max 0 (cdr (assoc 'left frame-A-params)))) | 932 | (list (cons 'left (max 0 (cdr (assoc 'left frame-A-params)))) |
| 922 | (cons 'width (cdr (assoc 'width frame-A-params)))) | 933 | (cons 'width (cdr (assoc 'width frame-A-params)))) |
| 923 | ediff-wide-display-frame frame-A) | 934 | ediff-wide-display-frame frame-A) |
| 924 | (ediff-modify-frame-parameters frame-A (list (cons 'left cw) | 935 | (modify-frame-parameters frame-A (list (cons 'left cw) |
| 925 | (cons 'width wd))))) | 936 | (cons 'width wd))))) |
| 926 | 937 | ||
| 927 | 938 | ||
| @@ -969,7 +980,7 @@ It assumes that it is called from within the control buffer." | |||
| 969 | ;; Force mode-line redisplay | 980 | ;; Force mode-line redisplay |
| 970 | (force-mode-line-update) | 981 | (force-mode-line-update) |
| 971 | 982 | ||
| 972 | (if (and window-system (ediff-frame-live-p ediff-control-frame)) | 983 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) |
| 973 | (ediff-refresh-control-frame)) | 984 | (ediff-refresh-control-frame)) |
| 974 | 985 | ||
| 975 | (ediff-eval-in-buffer ediff-buffer-A | 986 | (ediff-eval-in-buffer ediff-buffer-A |
| @@ -997,11 +1008,11 @@ It assumes that it is called from within the control buffer." | |||
| 997 | (defun ediff-refresh-control-frame () | 1008 | (defun ediff-refresh-control-frame () |
| 998 | (if ediff-xemacs-p | 1009 | (if ediff-xemacs-p |
| 999 | (progn | 1010 | (progn |
| 1000 | (setq screen-title-format (ediff-make-narrow-control-buffer-id) | 1011 | (setq frame-title-format (ediff-make-narrow-control-buffer-id) |
| 1001 | screen-icon-title-format (ediff-make-narrow-control-buffer-id)) | 1012 | frame-icon-title-format (ediff-make-narrow-control-buffer-id)) |
| 1002 | ;; this forces update of the screen title | 1013 | ;; this forces update of the frame title |
| 1003 | (ediff-modify-frame-parameters ediff-control-frame '(()))) | 1014 | (modify-frame-parameters ediff-control-frame '(()))) |
| 1004 | (ediff-modify-frame-parameters | 1015 | (modify-frame-parameters |
| 1005 | ediff-control-frame | 1016 | ediff-control-frame |
| 1006 | (list (cons 'name (ediff-make-narrow-control-buffer-id)))) | 1017 | (list (cons 'name (ediff-make-narrow-control-buffer-id)))) |
| 1007 | )) | 1018 | )) |
| @@ -1067,9 +1078,11 @@ It assumes that it is called from within the control buffer." | |||
| 1067 | (or (not ediff-3way-job) | 1078 | (or (not ediff-3way-job) |
| 1068 | (eq (window-buffer C-wind) ediff-buffer-C)) | 1079 | (eq (window-buffer C-wind) ediff-buffer-C)) |
| 1069 | (string= ediff-window-config-saved | 1080 | (string= ediff-window-config-saved |
| 1070 | (format "%S%S%S%S%S" | 1081 | (format "%S%S%S%S%S%S%S" |
| 1071 | ctl-wind A-wind B-wind C-wind | 1082 | ctl-wind A-wind B-wind C-wind |
| 1072 | ediff-split-window-function))))))) | 1083 | ediff-split-window-function |
| 1084 | (ediff-multiframe-setup-p) | ||
| 1085 | ediff-wide-display-p))))))) | ||
| 1073 | 1086 | ||
| 1074 | 1087 | ||
| 1075 | (provide 'ediff-wind) | 1088 | (provide 'ediff-wind) |