/[emacs]/emacs/lisp/ediff-wind.el
ViewVC logotype

Diff of /emacs/lisp/ediff-wind.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.35 by kifer, Mon Oct 28 02:08:02 2002 UTC revision 1.36 by lektu, Tue Feb 4 11:14:35 2003 UTC
# Line 24  Line 24 
24  ;;; Commentary:  ;;; Commentary:
25    
26  ;;; Code:  ;;; Code:
27            
28  (provide 'ediff-wind)  (provide 'ediff-wind)
29    
30  ;; Compiler pacifier  ;; Compiler pacifier
# Line 281  into icons, regardless of the window man Line 281  into icons, regardless of the window man
281                  )                  )
282            )            )
283      ))      ))
284          
285    
286  ;; Select the lowest window on the frame.  ;; Select the lowest window on the frame.
287  (defun ediff-select-lowest-window ()  (defun ediff-select-lowest-window ()
# Line 301  into icons, regardless of the window man Line 301  into icons, regardless of the window man
301               (progn               (progn
302                 (setq bottom-edge next-bottom-edge)                 (setq bottom-edge next-bottom-edge)
303                 (setq lowest-window this-window)))                 (setq lowest-window this-window)))
304            
305           (select-window this-window)           (select-window this-window)
306           (if (eq last-window this-window)           (if (eq last-window this-window)
307               (progn               (progn
# Line 322  into icons, regardless of the window man Line 322  into icons, regardless of the window man
322    (run-hooks 'ediff-before-setup-windows-hook)    (run-hooks 'ediff-before-setup-windows-hook)
323    (if (eq (selected-window) (minibuffer-window))    (if (eq (selected-window) (minibuffer-window))
324        (other-window 1))        (other-window 1))
325          
326    ;; in case user did a no-no on a tty    ;; in case user did a no-no on a tty
327    (or (ediff-window-display-p)    (or (ediff-window-display-p)
328        (setq ediff-window-setup-function 'ediff-setup-windows-plain))        (setq ediff-window-setup-function 'ediff-setup-windows-plain))
329      
330    (or (ediff-keep-window-config control-buffer)    (or (ediff-keep-window-config control-buffer)
331        (funcall        (funcall
332         (ediff-with-current-buffer control-buffer ediff-window-setup-function)         (ediff-with-current-buffer control-buffer ediff-window-setup-function)
# Line 344  into icons, regardless of the window man Line 344  into icons, regardless of the window man
344         buffer-A buffer-B buffer-C control-buffer)         buffer-A buffer-B buffer-C control-buffer)
345      (ediff-setup-windows-plain-compare      (ediff-setup-windows-plain-compare
346       buffer-A buffer-B buffer-C control-buffer)))       buffer-A buffer-B buffer-C control-buffer)))
347        
348  (defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer)  (defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer)
349    ;; skip dedicated and unsplittable frames    ;; skip dedicated and unsplittable frames
350    (ediff-destroy-control-frame control-buffer)    (ediff-destroy-control-frame control-buffer)
# Line 360  into icons, regardless of the window man Line 360  into icons, regardless of the window man
360      (split-window-vertically)      (split-window-vertically)
361      (ediff-select-lowest-window)      (ediff-select-lowest-window)
362      (ediff-setup-control-buffer control-buffer)      (ediff-setup-control-buffer control-buffer)
363        
364      ;; go to the upper window and split it betw A, B, and possibly C      ;; go to the upper window and split it betw A, B, and possibly C
365      (other-window 1)      (other-window 1)
366      (setq merge-window-lines      (setq merge-window-lines
367            (max 2 (round (* (window-height) merge-window-share))))            (max 2 (round (* (window-height) merge-window-share))))
368      (switch-to-buffer buf-A)      (switch-to-buffer buf-A)
369      (setq wind-A (selected-window))      (setq wind-A (selected-window))
370        
371      ;; XEmacs used to have a lot of trouble with display      ;; XEmacs used to have a lot of trouble with display
372      ;; It did't set things right unless we tell it to sit still      ;; It did't set things right unless we tell it to sit still
373      ;; 19.12 seems ok.      ;; 19.12 seems ok.
374      ;;(if ediff-xemacs-p (sit-for 0))      ;;(if ediff-xemacs-p (sit-for 0))
375        
376      (split-window-vertically (max 2 (- (window-height) merge-window-lines)))      (split-window-vertically (max 2 (- (window-height) merge-window-lines)))
377      (if (eq (selected-window) wind-A)      (if (eq (selected-window) wind-A)
378          (other-window 1))          (other-window 1))
379      (setq wind-C (selected-window))      (setq wind-C (selected-window))
380      (switch-to-buffer buf-C)      (switch-to-buffer buf-C)
381        
382      (select-window wind-A)      (select-window wind-A)
383      (funcall split-window-function)      (funcall split-window-function)
384                      
385      (if (eq (selected-window) wind-A)      (if (eq (selected-window) wind-A)
386          (other-window 1))          (other-window 1))
387      (switch-to-buffer buf-B)      (switch-to-buffer buf-B)
388      (setq wind-B (selected-window))      (setq wind-B (selected-window))
389              
390      (ediff-with-current-buffer control-buffer      (ediff-with-current-buffer control-buffer
391        (setq ediff-window-A wind-A        (setq ediff-window-A wind-A
392              ediff-window-B wind-B              ediff-window-B wind-B
393              ediff-window-C wind-C))              ediff-window-C wind-C))
394        
395      (ediff-select-lowest-window)      (ediff-select-lowest-window)
396      (ediff-setup-control-buffer control-buffer)      (ediff-setup-control-buffer control-buffer)
397      ))      ))
398    
399        
400  ;; This function handles all comparison jobs, including 3way jobs  ;; This function handles all comparison jobs, including 3way jobs
401  (defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer)  (defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer)
402    ;; skip dedicated and unsplittable frames    ;; skip dedicated and unsplittable frames
# Line 419  into icons, regardless of the window man Line 419  into icons, regardless of the window man
419      (split-window-vertically)      (split-window-vertically)
420      (ediff-select-lowest-window)      (ediff-select-lowest-window)
421      (ediff-setup-control-buffer control-buffer)      (ediff-setup-control-buffer control-buffer)
422        
423      ;; go to the upper window and split it betw A, B, and possibly C      ;; go to the upper window and split it betw A, B, and possibly C
424      (other-window 1)      (other-window 1)
425      (switch-to-buffer buf-A)      (switch-to-buffer buf-A)
# Line 430  into icons, regardless of the window man Line 430  into icons, regardless of the window man
430                       (window-height wind-A)                       (window-height wind-A)
431                     (window-width wind-A))                     (window-width wind-A))
432                   3)))                   3)))
433        
434      ;; XEmacs used to have a lot of trouble with display      ;; XEmacs used to have a lot of trouble with display
435      ;; It did't set things right unless we told it to sit still      ;; It did't set things right unless we told it to sit still
436      ;; 19.12 seems ok.      ;; 19.12 seems ok.
437      ;;(if ediff-xemacs-p (sit-for 0))      ;;(if ediff-xemacs-p (sit-for 0))
438        
439      (funcall split-window-function wind-width-or-height)      (funcall split-window-function wind-width-or-height)
440                      
441      (if (eq (selected-window) wind-A)      (if (eq (selected-window) wind-A)
442          (other-window 1))          (other-window 1))
443      (switch-to-buffer buf-B)      (switch-to-buffer buf-B)
444      (setq wind-B (selected-window))      (setq wind-B (selected-window))
445              
446      (if three-way-comparison      (if three-way-comparison
447          (progn          (progn
448            (funcall split-window-function) ; equally            (funcall split-window-function) ; equally
# Line 450  into icons, regardless of the window man Line 450  into icons, regardless of the window man
450                (other-window 1))                (other-window 1))
451            (switch-to-buffer buf-C)            (switch-to-buffer buf-C)
452            (setq wind-C (selected-window))))            (setq wind-C (selected-window))))
453              
454      (ediff-with-current-buffer control-buffer      (ediff-with-current-buffer control-buffer
455        (setq ediff-window-A wind-A        (setq ediff-window-A wind-A
456              ediff-window-B wind-B              ediff-window-B wind-B
457              ediff-window-C wind-C))              ediff-window-C wind-C))
458        
459      ;; It is unlikely that we will want to implement 3way window comparison.      ;; It is unlikely that we will want to implement 3way window comparison.
460      ;; So, only buffers A and B are used here.      ;; So, only buffers A and B are used here.
461      (if ediff-windows-job      (if ediff-windows-job
462          (progn          (progn
463            (set-window-start wind-A wind-A-start)            (set-window-start wind-A wind-A-start)
464            (set-window-start wind-B wind-B-start)))            (set-window-start wind-B wind-B-start)))
465      
466      (ediff-select-lowest-window)      (ediff-select-lowest-window)
467      (ediff-setup-control-buffer control-buffer)      (ediff-setup-control-buffer control-buffer)
468      ))      ))
469    
470        
471  ;; dispatch an appropriate window setup function  ;; dispatch an appropriate window setup function
472  (defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf)  (defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf)
473    (ediff-with-current-buffer control-buf    (ediff-with-current-buffer control-buf
# Line 475  into icons, regardless of the window man Line 475  into icons, regardless of the window man
475    (if ediff-merge-job    (if ediff-merge-job
476        (ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf)        (ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf)
477      (ediff-setup-windows-multiframe-compare buf-A buf-B buf-C control-buf)))      (ediff-setup-windows-multiframe-compare buf-A buf-B buf-C control-buf)))
478        
479  (defun ediff-setup-windows-multiframe-merge (buf-A buf-B buf-C control-buf)  (defun ediff-setup-windows-multiframe-merge (buf-A buf-B buf-C control-buf)
480  ;;; Algorithm:  ;;; Algorithm:
481  ;;;   1. Never use frames that have dedicated windows in them---it is bad to  ;;;   1. Never use frames that have dedicated windows in them---it is bad to
# Line 491  into icons, regardless of the window man Line 491  into icons, regardless of the window man
491    ;;   Skip dedicated or iconified frames.    ;;   Skip dedicated or iconified frames.
492    ;;   Unsplittable frames are taken care of later.    ;;   Unsplittable frames are taken care of later.
493    (ediff-skip-unsuitable-frames 'ok-unsplittable)    (ediff-skip-unsuitable-frames 'ok-unsplittable)
494      
495    (let* ((window-min-height 1)    (let* ((window-min-height 1)
496           (wind-A (ediff-get-visible-buffer-window buf-A))           (wind-A (ediff-get-visible-buffer-window buf-A))
497           (wind-B (ediff-get-visible-buffer-window buf-B))           (wind-B (ediff-get-visible-buffer-window buf-B))
# Line 531  into icons, regardless of the window man Line 531  into icons, regardless of the window man
531           merge-window-lines           merge-window-lines
532           designated-minibuffer-frame           designated-minibuffer-frame
533           done-A done-B done-C)           done-A done-B done-C)
534        
535      ;; buf-A on its own      ;; buf-A on its own
536      (if (and (window-live-p wind-A)      (if (and (window-live-p wind-A)
537               (null use-same-frame) ; implies wind-A is suitable               (null use-same-frame) ; implies wind-A is suitable
# Line 542  into icons, regardless of the window man Line 542  into icons, regardless of the window man
542            (delete-other-windows)            (delete-other-windows)
543            (setq wind-A (selected-window))            (setq wind-A (selected-window))
544            (setq done-A t)))            (setq done-A t)))
545        
546      ;; buf-B on its own      ;; buf-B on its own
547      (if (and (window-live-p wind-B)      (if (and (window-live-p wind-B)
548               (null use-same-frame) ; implies wind-B is suitable               (null use-same-frame) ; implies wind-B is suitable
# Line 553  into icons, regardless of the window man Line 553  into icons, regardless of the window man
553            (delete-other-windows)            (delete-other-windows)
554            (setq wind-B (selected-window))            (setq wind-B (selected-window))
555            (setq done-B t)))            (setq done-B t)))
556              
557      ;; buf-C on its own      ;; buf-C on its own
558      (if (and (window-live-p wind-C)      (if (and (window-live-p wind-C)
559               (ediff-window-ok-for-display wind-C)               (ediff-window-ok-for-display wind-C)
# Line 564  into icons, regardless of the window man Line 564  into icons, regardless of the window man
564            (delete-other-windows)            (delete-other-windows)
565            (setq wind-C (selected-window))            (setq wind-C (selected-window))
566            (setq done-C t)))            (setq done-C t)))
567        
568      (if (and use-same-frame-for-AB  ; implies wind A and B are suitable      (if (and use-same-frame-for-AB  ; implies wind A and B are suitable
569               (window-live-p wind-A))               (window-live-p wind-A))
570          (progn          (progn
# Line 572  into icons, regardless of the window man Line 572  into icons, regardless of the window man
572            (select-window wind-A)            (select-window wind-A)
573            (delete-other-windows)            (delete-other-windows)
574            (setq wind-A (selected-window))            (setq wind-A (selected-window))
575              
576            (funcall split-window-function)            (funcall split-window-function)
577            (if (eq (selected-window) wind-A)            (if (eq (selected-window) wind-A)
578                (other-window 1))                (other-window 1))
579            (switch-to-buffer buf-B)            (switch-to-buffer buf-B)
580            (setq wind-B (selected-window))            (setq wind-B (selected-window))
581              
582            (setq done-A t            (setq done-A t
583                  done-B t)))                  done-B t)))
584        
585      (if use-same-frame      (if use-same-frame
586          (let ((window-min-height 1))          (let ((window-min-height 1))
587            (if (and (eq frame-A frame-B)            (if (and (eq frame-A frame-B)
# Line 595  into icons, regardless of the window man Line 595  into icons, regardless of the window man
595                  (max 2 (round (* (window-height) merge-window-share))))                  (max 2 (round (* (window-height) merge-window-share))))
596            (switch-to-buffer buf-A)            (switch-to-buffer buf-A)
597            (setq wind-A (selected-window))            (setq wind-A (selected-window))
598              
599            (split-window-vertically            (split-window-vertically
600             (max 2 (- (window-height) merge-window-lines)))             (max 2 (- (window-height) merge-window-lines)))
601            (if (eq (selected-window) wind-A)            (if (eq (selected-window) wind-A)
602                (other-window 1))                (other-window 1))
603            (setq wind-C (selected-window))            (setq wind-C (selected-window))
604            (switch-to-buffer buf-C)            (switch-to-buffer buf-C)
605              
606            (select-window wind-A)            (select-window wind-A)
607              
608            (funcall split-window-function)            (funcall split-window-function)
609            (if (eq (selected-window) wind-A)            (if (eq (selected-window) wind-A)
610                (other-window 1))                (other-window 1))
611            (switch-to-buffer buf-B)            (switch-to-buffer buf-B)
612            (setq wind-B (selected-window))            (setq wind-B (selected-window))
613              
614            (setq done-A t            (setq done-A t
615                  done-B t                  done-B t
616                  done-C t)                  done-C t)
617            ))            ))
618        
619      (or done-A  ; Buf A to be set in its own frame,      (or done-A  ; Buf A to be set in its own frame,
620                ;;; or it was set before because use-same-frame = 1                ;;; or it was set before because use-same-frame = 1
621          (progn          (progn
# Line 636  into icons, regardless of the window man Line 636  into icons, regardless of the window man
636            (switch-to-buffer buf-B)            (switch-to-buffer buf-B)
637            (setq wind-B (selected-window))            (setq wind-B (selected-window))
638            ))            ))
639        
640      (or done-C  ; Buf C to be set in its own frame,      (or done-C  ; Buf C to be set in its own frame,
641                ;;; or it was set before because use-same-frame = 1                ;;; or it was set before because use-same-frame = 1
642          (progn          (progn
# Line 647  into icons, regardless of the window man Line 647  into icons, regardless of the window man
647            (switch-to-buffer buf-C)            (switch-to-buffer buf-C)
648            (setq wind-C (selected-window))            (setq wind-C (selected-window))
649            ))            ))
650        
651      (ediff-with-current-buffer control-buf      (ediff-with-current-buffer control-buf
652        (setq ediff-window-A wind-A        (setq ediff-window-A wind-A
653              ediff-window-B wind-B              ediff-window-B wind-B
# Line 655  into icons, regardless of the window man Line 655  into icons, regardless of the window man
655        (setq frame-A (window-frame ediff-window-A)        (setq frame-A (window-frame ediff-window-A)
656              designated-minibuffer-frame              designated-minibuffer-frame
657              (window-frame (minibuffer-window frame-A))))              (window-frame (minibuffer-window frame-A))))
658        
659      (ediff-setup-control-frame control-buf designated-minibuffer-frame)      (ediff-setup-control-frame control-buf designated-minibuffer-frame)
660      ))      ))
661    
662      
663  ;; Window setup for all comparison jobs, including 3way comparisons  ;; Window setup for all comparison jobs, including 3way comparisons
664  (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf)  (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf)
665  ;;; Algorithm:  ;;; Algorithm:
# Line 673  into icons, regardless of the window man Line 673  into icons, regardless of the window man
673  ;;;    and the selected frame isn't splittable, we create a new frame and  ;;;    and the selected frame isn't splittable, we create a new frame and
674  ;;;    put both buffers there, event if one of this buffers is visible in  ;;;    put both buffers there, event if one of this buffers is visible in
675  ;;;    another frame.  ;;;    another frame.
676      
677    ;; Skip dedicated or iconified frames.    ;; Skip dedicated or iconified frames.
678    ;; Unsplittable frames are taken care of later.    ;; Unsplittable frames are taken care of later.
679    (ediff-skip-unsuitable-frames 'ok-unsplittable)    (ediff-skip-unsuitable-frames 'ok-unsplittable)
680      
681    (let* ((window-min-height 1)    (let* ((window-min-height 1)
682           (wind-A (ediff-get-visible-buffer-window buf-A))           (wind-A (ediff-get-visible-buffer-window buf-A))
683           (wind-B (ediff-get-visible-buffer-window buf-B))           (wind-B (ediff-get-visible-buffer-window buf-B))
# Line 716  into icons, regardless of the window man Line 716  into icons, regardless of the window man
716           wind-A-start wind-B-start           wind-A-start wind-B-start
717           designated-minibuffer-frame           designated-minibuffer-frame
718           done-A done-B done-C)           done-A done-B done-C)
719        
720      (ediff-with-current-buffer control-buf      (ediff-with-current-buffer control-buf
721        (setq wind-A-start (ediff-overlay-start        (setq wind-A-start (ediff-overlay-start
722                            (ediff-get-value-according-to-buffer-type                            (ediff-get-value-according-to-buffer-type
# Line 724  into icons, regardless of the window man Line 724  into icons, regardless of the window man
724              wind-B-start (ediff-overlay-start              wind-B-start (ediff-overlay-start
725                            (ediff-get-value-according-to-buffer-type                            (ediff-get-value-according-to-buffer-type
726                             'B ediff-narrow-bounds))))                             'B ediff-narrow-bounds))))
727        
728      (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own      (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own
729          (progn          (progn
730            ;; buffer buf-A is seen in live wind-A            ;; buffer buf-A is seen in live wind-A
# Line 732  into icons, regardless of the window man Line 732  into icons, regardless of the window man
732            (delete-other-windows)            (delete-other-windows)
733            (setq wind-A (selected-window))            (setq wind-A (selected-window))
734            (setq done-A t)))            (setq done-A t)))
735        
736      (if (and (window-live-p wind-B) (null use-same-frame)) ; buf B on its own      (if (and (window-live-p wind-B) (null use-same-frame)) ; buf B on its own
737          (progn          (progn
738            ;; buffer buf-B is seen in live wind-B            ;; buffer buf-B is seen in live wind-B
# Line 740  into icons, regardless of the window man Line 740  into icons, regardless of the window man
740            (delete-other-windows)            (delete-other-windows)
741            (setq wind-B (selected-window))            (setq wind-B (selected-window))
742            (setq done-B t)))            (setq done-B t)))
743              
744      (if (and (window-live-p wind-C) (null use-same-frame)) ; buf C on its own      (if (and (window-live-p wind-C) (null use-same-frame)) ; buf C on its own
745          (progn          (progn
746            ;; buffer buf-C is seen in live wind-C            ;; buffer buf-C is seen in live wind-C
# Line 748  into icons, regardless of the window man Line 748  into icons, regardless of the window man
748            (delete-other-windows)            (delete-other-windows)
749            (setq wind-C (selected-window))            (setq wind-C (selected-window))
750            (setq done-C t)))            (setq done-C t)))
751        
752      (if use-same-frame      (if use-same-frame
753          (let (wind-width-or-height) ; this affects 3way setups only          (let (wind-width-or-height) ; this affects 3way setups only
754            (if (and (eq frame-A frame-B) (frame-live-p frame-A))            (if (and (eq frame-A frame-B) (frame-live-p frame-A))
# Line 758  into icons, regardless of the window man Line 758  into icons, regardless of the window man
758            (delete-other-windows)            (delete-other-windows)
759            (switch-to-buffer buf-A)            (switch-to-buffer buf-A)
760            (setq wind-A (selected-window))            (setq wind-A (selected-window))
761              
762            (if three-way-comparison            (if three-way-comparison
763                (setq wind-width-or-height                (setq wind-width-or-height
764                      (/                      (/
# Line 766  into icons, regardless of the window man Line 766  into icons, regardless of the window man
766                           (window-height wind-A)                           (window-height wind-A)
767                         (window-width wind-A))                         (window-width wind-A))
768                       3)))                       3)))
769              
770            (funcall split-window-function wind-width-or-height)            (funcall split-window-function wind-width-or-height)
771            (if (eq (selected-window) wind-A)            (if (eq (selected-window) wind-A)
772                (other-window 1))                (other-window 1))
773            (switch-to-buffer buf-B)            (switch-to-buffer buf-B)
774            (setq wind-B (selected-window))            (setq wind-B (selected-window))
775              
776            (if three-way-comparison            (if three-way-comparison
777                (progn                (progn
778                  (funcall split-window-function) ; equally                  (funcall split-window-function) ; equally
# Line 784  into icons, regardless of the window man Line 784  into icons, regardless of the window man
784                  done-B t                  done-B t
785                  done-C t)                  done-C t)
786            ))            ))
787        
788      (or done-A  ; Buf A to be set in its own frame      (or done-A  ; Buf A to be set in its own frame
789                ;;; or it was set before because use-same-frame = 1                ;;; or it was set before because use-same-frame = 1
790          (progn          (progn
# Line 805  into icons, regardless of the window man Line 805  into icons, regardless of the window man
805            (switch-to-buffer buf-B)            (switch-to-buffer buf-B)
806            (setq wind-B (selected-window))            (setq wind-B (selected-window))
807            ))            ))
808        
809      (if three-way-comparison      (if three-way-comparison
810          (or done-C  ; Buf C to be set in its own frame          (or done-C  ; Buf C to be set in its own frame
811                    ;;; or it was set before because use-same-frame = 1                    ;;; or it was set before because use-same-frame = 1
# Line 817  into icons, regardless of the window man Line 817  into icons, regardless of the window man
817                (switch-to-buffer buf-C)                (switch-to-buffer buf-C)
818                (setq wind-C (selected-window))                (setq wind-C (selected-window))
819                )))                )))
820        
821      (ediff-with-current-buffer control-buf      (ediff-with-current-buffer control-buf
822        (setq ediff-window-A wind-A        (setq ediff-window-A wind-A
823              ediff-window-B wind-B              ediff-window-B wind-B
# Line 826  into icons, regardless of the window man Line 826  into icons, regardless of the window man
826        (setq frame-A (window-frame ediff-window-A)        (setq frame-A (window-frame ediff-window-A)
827              designated-minibuffer-frame              designated-minibuffer-frame
828              (window-frame (minibuffer-window frame-A))))              (window-frame (minibuffer-window frame-A))))
829        
830      ;; It is unlikely that we'll implement a version of ediff-windows that      ;; It is unlikely that we'll implement a version of ediff-windows that
831      ;; would compare 3 windows at once.  So, we don't use buffer C here.      ;; would compare 3 windows at once.  So, we don't use buffer C here.
832      (if ediff-windows-job      (if ediff-windows-job
833          (progn          (progn
834            (set-window-start wind-A wind-A-start)            (set-window-start wind-A wind-A-start)
835            (set-window-start wind-B wind-B-start)))            (set-window-start wind-B wind-B-start)))
836        
837      (ediff-setup-control-frame control-buf designated-minibuffer-frame)      (ediff-setup-control-frame control-buf designated-minibuffer-frame)
838      ))      ))
839    
# Line 868  into icons, regardless of the window man Line 868  into icons, regardless of the window man
868    
869  (defun ediff-frame-has-dedicated-windows (frame)  (defun ediff-frame-has-dedicated-windows (frame)
870    (let (ans)    (let (ans)
871      (walk-windows      (walk-windows
872       (lambda (wind) (if (window-dedicated-p wind)       (lambda (wind) (if (window-dedicated-p wind)
873                          (setq ans t)))                          (setq ans t)))
874       'ignore-minibuffer       'ignore-minibuffer
# Line 896  into icons, regardless of the window man Line 896  into icons, regardless of the window man
896          ctl-frame old-ctl-frame lines          ctl-frame old-ctl-frame lines
897          ;; user-grabbed-mouse          ;; user-grabbed-mouse
898          fheight fwidth adjusted-parameters)          fheight fwidth adjusted-parameters)
899            
900      (ediff-with-current-buffer ctl-buffer      (ediff-with-current-buffer ctl-buffer
901        (ediff-cond-compile-for-xemacs-or-emacs        (ediff-cond-compile-for-xemacs-or-emacs
902         (set-buffer-menubar nil) ; xemacs         (set-buffer-menubar nil) ; xemacs
# Line 904  into icons, regardless of the window man Line 904  into icons, regardless of the window man
904         )         )
905        ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))        ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse))
906        (run-hooks 'ediff-before-setup-control-frame-hook))        (run-hooks 'ediff-before-setup-control-frame-hook))
907      
908      (setq old-ctl-frame (ediff-with-current-buffer ctl-buffer ediff-control-frame))      (setq old-ctl-frame (ediff-with-current-buffer ctl-buffer ediff-control-frame))
909      (ediff-with-current-buffer ctl-buffer      (ediff-with-current-buffer ctl-buffer
910        (setq ctl-frame (if (frame-live-p old-ctl-frame)        (setq ctl-frame (if (frame-live-p old-ctl-frame)
# Line 920  into icons, regardless of the window man Line 920  into icons, regardless of the window man
920             )             )
921          (error))          (error))
922        )        )
923        
924      (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))      (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))
925      (select-frame ctl-frame)      (select-frame ctl-frame)
926      (if (window-dedicated-p (selected-window))      (if (window-dedicated-p (selected-window))
927          ()          ()
928        (delete-other-windows)        (delete-other-windows)
929        (switch-to-buffer ctl-buffer))        (switch-to-buffer ctl-buffer))
930          
931      ;; must be before ediff-setup-control-buffer      ;; must be before ediff-setup-control-buffer
932      ;; just a precaution--we should be in ctl-buffer already      ;; just a precaution--we should be in ctl-buffer already
933      (ediff-with-current-buffer ctl-buffer      (ediff-with-current-buffer ctl-buffer
934        (make-local-variable 'frame-title-format)        (make-local-variable 'frame-title-format)
935        (make-local-variable 'frame-icon-title-format)    ; XEmacs        (make-local-variable 'frame-icon-title-format)    ; XEmacs
936        (make-local-variable 'icon-title-format))         ; Emacs        (make-local-variable 'icon-title-format))         ; Emacs
937        
938      (ediff-setup-control-buffer ctl-buffer)      (ediff-setup-control-buffer ctl-buffer)
939      (setq dont-iconify-ctl-frame      (setq dont-iconify-ctl-frame
940            (not (string= ediff-help-message ediff-brief-help-message)))            (not (string= ediff-help-message ediff-brief-help-message)))
941      (setq deiconify-ctl-frame      (setq deiconify-ctl-frame
942            (and (eq this-command 'ediff-toggle-help)            (and (eq this-command 'ediff-toggle-help)
943                 dont-iconify-ctl-frame))                 dont-iconify-ctl-frame))
944        
945      ;; 1 more line for the modeline      ;; 1 more line for the modeline
946      (setq lines (1+ (count-lines (point-min) (point-max)))      (setq lines (1+ (count-lines (point-min) (point-max)))
947            fheight lines            fheight lines
# Line 963  into icons, regardless of the window man Line 963  into icons, regardless of the window man
963                      '(auto-raise . nil)                      '(auto-raise . nil)
964                    '(auto-raise . t))                    '(auto-raise . t))
965                  adjusted-parameters))                  adjusted-parameters))
966        
967      ;; In XEmacs, buffer menubar needs to be killed before frame parameters      ;; In XEmacs, buffer menubar needs to be killed before frame parameters
968      ;; are changed.      ;; are changed.
969      (if (ediff-has-toolbar-support-p)      (if (ediff-has-toolbar-support-p)
# Line 980  into icons, regardless of the window man Line 980  into icons, regardless of the window man
980           nil ; emacs           nil ; emacs
981           )           )
982        )        )
983        
984      ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order      ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order
985      ;; to make sure that at least once we do it for non-iconified frame.  If      ;; to make sure that at least once we do it for non-iconified frame.  If
986      ;; appears that in the OS/2 port of Emacs, one can't modify frame      ;; appears that in the OS/2 port of Emacs, one can't modify frame
# Line 988  into icons, regardless of the window man Line 988  into icons, regardless of the window man
988      ;; windows-nt.      ;; windows-nt.
989      (if (memq system-type '(emx windows-nt windows-95))      (if (memq system-type '(emx windows-nt windows-95))
990          (modify-frame-parameters ctl-frame adjusted-parameters))          (modify-frame-parameters ctl-frame adjusted-parameters))
991          
992      ;; make or zap toolbar (if not requested)      ;; make or zap toolbar (if not requested)
993      (ediff-make-bottom-toolbar ctl-frame)      (ediff-make-bottom-toolbar ctl-frame)
994        
995      (goto-char (point-min))      (goto-char (point-min))
996    
997      (modify-frame-parameters ctl-frame adjusted-parameters)      (modify-frame-parameters ctl-frame adjusted-parameters)
998      (make-frame-visible ctl-frame)      (make-frame-visible ctl-frame)
999        
1000      ;; This works around a bug in 19.25 and earlier.  There, if frame gets      ;; This works around a bug in 19.25 and earlier.  There, if frame gets
1001      ;; iconified, the current buffer changes to that of the frame that      ;; iconified, the current buffer changes to that of the frame that
1002      ;; becomes exposed as a result of this iconification.      ;; becomes exposed as a result of this iconification.
1003      ;; So, we make sure the current buffer doesn't change.      ;; So, we make sure the current buffer doesn't change.
1004      (select-frame ctl-frame)      (select-frame ctl-frame)
1005      (ediff-refresh-control-frame)      (ediff-refresh-control-frame)
1006        
1007      (cond ((and ediff-prefer-iconified-control-frame      (cond ((and ediff-prefer-iconified-control-frame
1008                  (not ctl-frame-iconified-p) (not dont-iconify-ctl-frame))                  (not ctl-frame-iconified-p) (not dont-iconify-ctl-frame))
1009             (iconify-frame ctl-frame))             (iconify-frame ctl-frame))
1010            ((or deiconify-ctl-frame (not ctl-frame-iconified-p))            ((or deiconify-ctl-frame (not ctl-frame-iconified-p))
1011             (raise-frame ctl-frame)))             (raise-frame ctl-frame)))
1012        
1013      (set-window-dedicated-p (selected-window) t)      (set-window-dedicated-p (selected-window) t)
1014    
1015      ;; Now move the frame.  We must do it separately due to an obscure bug in      ;; Now move the frame.  We must do it separately due to an obscure bug in
# Line 1017  into icons, regardless of the window man Line 1017  into icons, regardless of the window man
1017      (modify-frame-parameters      (modify-frame-parameters
1018       ctl-frame       ctl-frame
1019       (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight))       (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight))
1020          
1021      ;; synchronize so the cursor will move to control frame      ;; synchronize so the cursor will move to control frame
1022      ;; per RMS suggestion      ;; per RMS suggestion
1023      (if (ediff-window-display-p)      (if (ediff-window-display-p)
# Line 1032  into icons, regardless of the window man Line 1032  into icons, regardless of the window man
1032          (ediff-reset-mouse ctl-frame          (ediff-reset-mouse ctl-frame
1033                             (or (eq this-command 'ediff-quit)                             (or (eq this-command 'ediff-quit)
1034                                 (not (eq ediff-grab-mouse t)))))                                 (not (eq ediff-grab-mouse t)))))
1035            
1036      (if ediff-xemacs-p      (if ediff-xemacs-p
1037          (ediff-with-current-buffer ctl-buffer          (ediff-with-current-buffer ctl-buffer
1038            (ediff-cond-compile-for-xemacs-or-emacs            (ediff-cond-compile-for-xemacs-or-emacs
# Line 1042  into icons, regardless of the window man Line 1042  into icons, regardless of the window man
1042            (add-hook            (add-hook
1043             'select-frame-hook 'ediff-xemacs-select-frame-hook nil 'local)             'select-frame-hook 'ediff-xemacs-select-frame-hook nil 'local)
1044            ))            ))
1045            
1046      (ediff-with-current-buffer ctl-buffer      (ediff-with-current-buffer ctl-buffer
1047        (run-hooks 'ediff-after-setup-control-frame-hook))        (run-hooks 'ediff-after-setup-control-frame-hook))
1048      ))      ))
1049    
1050        
1051  (defun ediff-destroy-control-frame (ctl-buffer)  (defun ediff-destroy-control-frame (ctl-buffer)
1052    (ediff-with-current-buffer ctl-buffer    (ediff-with-current-buffer ctl-buffer
1053      (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))      (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
# Line 1062  into icons, regardless of the window man Line 1062  into icons, regardless of the window man
1062    (ediff-skip-unsuitable-frames)    (ediff-skip-unsuitable-frames)
1063    ;;(ediff-reset-mouse nil)    ;;(ediff-reset-mouse nil)
1064    )    )
1065        
1066    
1067  ;; finds a good place to clip control frame  ;; finds a good place to clip control frame
1068  (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height)  (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height)
# Line 1075  into icons, regardless of the window man Line 1075  into icons, regardless of the window man
1075             (ctl-frame ediff-control-frame)             (ctl-frame ediff-control-frame)
1076             horizontal-adjustment upward-adjustment             horizontal-adjustment upward-adjustment
1077             ctl-frame-top ctl-frame-left)             ctl-frame-top ctl-frame-left)
1078          
1079        ;; Multiple control frames are clipped based on the value of        ;; Multiple control frames are clipped based on the value of
1080        ;; ediff-control-buffer-number.  This is done in order not to obscure        ;; ediff-control-buffer-number.  This is done in order not to obscure
1081        ;; other active control panels.        ;; other active control panels.
# Line 1107  into icons, regardless of the window man Line 1107  into icons, regardless of the window man
1107        ;; keep ctl frame within the visible bounds        ;; keep ctl frame within the visible bounds
1108        (setq ctl-frame-top (max ctl-frame-top 1)        (setq ctl-frame-top (max ctl-frame-top 1)
1109              ctl-frame-left (max ctl-frame-left 1))              ctl-frame-left (max ctl-frame-left 1))
1110          
1111        (list (cons 'top ctl-frame-top)        (list (cons 'top ctl-frame-top)
1112              (cons 'left ctl-frame-left))              (cons 'left ctl-frame-left))
1113        )))        )))
1114                                  
1115  (defun ediff-xemacs-select-frame-hook ()  (defun ediff-xemacs-select-frame-hook ()
1116    (if (and (equal (selected-frame) ediff-control-frame)    (if (and (equal (selected-frame) ediff-control-frame)
1117             (not ediff-use-long-help-message))             (not ediff-use-long-help-message))
1118        (raise-frame ediff-control-frame)))        (raise-frame ediff-control-frame)))
1119            
1120  (defun ediff-make-wide-display ()  (defun ediff-make-wide-display ()
1121    "Construct an alist of parameters for the wide display.    "Construct an alist of parameters for the wide display.
1122  Saves the old frame parameters in `ediff-wide-display-orig-parameters'.  Saves the old frame parameters in `ediff-wide-display-orig-parameters'.
# Line 1135  It assumes that it is called from within Line 1135  It assumes that it is called from within
1135            ediff-wide-display-frame frame-A)            ediff-wide-display-frame frame-A)
1136      (modify-frame-parameters frame-A (list (cons 'left cw)      (modify-frame-parameters frame-A (list (cons 'left cw)
1137                                                   (cons 'width wd)))))                                                   (cons 'width wd)))))
1138      
1139          
1140    
1141  ;; Revise the mode line to display which difference we have selected  ;; Revise the mode line to display which difference we have selected
1142  ;; Also resets modelines of buffers A/B, since they may be clobbered by  ;; Also resets modelines of buffers A/B, since they may be clobbered by
1143  ;; anothe invocations of Ediff.  ;; anothe invocations of Ediff.
1144  (defun ediff-refresh-mode-lines ()  (defun ediff-refresh-mode-lines ()
1145    (let (buf-A-state-diff buf-B-state-diff buf-C-state-diff buf-C-state-merge)    (let (buf-A-state-diff buf-B-state-diff buf-C-state-diff buf-C-state-merge)
1146        
1147      (if (ediff-valid-difference-p)      (if (ediff-valid-difference-p)
1148          (setq          (setq
1149           buf-C-state-diff (ediff-get-state-of-diff ediff-current-difference 'C)           buf-C-state-diff (ediff-get-state-of-diff ediff-current-difference 'C)
# Line 1172  It assumes that it is called from within Line 1172  It assumes that it is called from within
1172        (setq buf-A-state-diff ""        (setq buf-A-state-diff ""
1173              buf-B-state-diff ""              buf-B-state-diff ""
1174              buf-C-state-diff ""))              buf-C-state-diff ""))
1175        
1176      ;; control buffer format      ;; control buffer format
1177      (setq mode-line-format      (setq mode-line-format
1178            (if (ediff-narrow-control-frame-p)            (if (ediff-narrow-control-frame-p)
# Line 1185  It assumes that it is called from within Line 1185  It assumes that it is called from within
1185              (ediff-make-wide-control-buffer-id)))              (ediff-make-wide-control-buffer-id)))
1186      ;; Force mode-line redisplay      ;; Force mode-line redisplay
1187      (force-mode-line-update)      (force-mode-line-update)
1188        
1189      (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))      (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame))
1190          (ediff-refresh-control-frame))          (ediff-refresh-control-frame))
1191        
1192      (ediff-with-current-buffer ediff-buffer-A      (ediff-with-current-buffer ediff-buffer-A
1193        (setq ediff-diff-status buf-A-state-diff)        (setq ediff-diff-status buf-A-state-diff)
1194        (ediff-strip-mode-line-format)        (ediff-strip-mode-line-format)
# Line 1225  It assumes that it is called from within Line 1225  It assumes that it is called from within
1225                              (t ""))                              (t ""))
1226                        mode-line-format))))                        mode-line-format))))
1227      ))      ))
1228        
1229      
1230  (defun ediff-refresh-control-frame ()  (defun ediff-refresh-control-frame ()
1231    (if ediff-emacs-p    (if ediff-emacs-p
1232        ;; set frame/icon titles for Emacs        ;; set frame/icon titles for Emacs
# Line 1240  It assumes that it is called from within Line 1240  It assumes that it is called from within
1240            frame-icon-title-format (ediff-make-narrow-control-buffer-id))            frame-icon-title-format (ediff-make-narrow-control-buffer-id))
1241      ;; force an update of the frame title      ;; force an update of the frame title
1242      (modify-frame-parameters ediff-control-frame '(()))))      (modify-frame-parameters ediff-control-frame '(()))))
1243      
1244      
1245  (defun ediff-make-narrow-control-buffer-id (&optional skip-name)  (defun ediff-make-narrow-control-buffer-id (&optional skip-name)
1246    (concat    (concat
1247     (if skip-name     (if skip-name
# Line 1260  It assumes that it is called from within Line 1260  It assumes that it is called from within
1260    (concat    (concat
1261     (cdr (assoc 'name ediff-control-frame-parameters))     (cdr (assoc 'name ediff-control-frame-parameters))
1262     ediff-control-buffer-suffix))     ediff-control-buffer-suffix))
1263                      
1264  (defun ediff-make-wide-control-buffer-id ()  (defun ediff-make-wide-control-buffer-id ()
1265    (cond ((< ediff-current-difference 0)    (cond ((< ediff-current-difference 0)
1266           (list (format "%%b   At start of %d diffs"           (list (format "%%b   At start of %d diffs"
# Line 1281  It assumes that it is called from within Line 1281  It assumes that it is called from within
1281        (if ediff-xemacs-p        (if ediff-xemacs-p
1282            (get-buffer-window buff t)            (get-buffer-window buff t)
1283          (get-buffer-window buff 'visible))))          (get-buffer-window buff 'visible))))
1284            
1285    
1286  ;;; Functions to decide when to redraw windows  ;;; Functions to decide when to redraw windows
1287      
1288  (defun ediff-keep-window-config (control-buf)  (defun ediff-keep-window-config (control-buf)
1289    (and (eq control-buf (current-buffer))    (and (eq control-buf (current-buffer))
1290         (/= (buffer-size) 0)         (/= (buffer-size) 0)
# Line 1293  It assumes that it is called from within Line 1293  It assumes that it is called from within
1293                 (A-wind ediff-window-A)                 (A-wind ediff-window-A)
1294                 (B-wind ediff-window-B)                 (B-wind ediff-window-B)
1295                 (C-wind ediff-window-C))                 (C-wind ediff-window-C))
1296              
1297             (and             (and
1298              (ediff-window-visible-p A-wind)              (ediff-window-visible-p A-wind)
1299              (ediff-window-visible-p B-wind)              (ediff-window-visible-p B-wind)

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26