unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
@ 2021-06-29 16:24 Trust me I am a Doctor
  2021-06-30  7:37 ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Trust me I am a Doctor @ 2021-06-29 16:24 UTC (permalink / raw)
  To: 49277

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]


I have a bug when calling ediff3, the layout is not a balanced.

Ultimately I found that combining this settings were the culprit :

(setq window-combination-resize t
      even-window-sizes nil)

;; you can test it with eg :
(setq default-directory "/home/user")
(ediff3 ".bashrc"
        ".bash_history"
        ".bash_logout")

Removing the manual resizing when splitting windows and relying rather
on 'window-combinaison-resize' to balance the layout, solve the issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix ediff3 with window-combinaison-resize --]
[-- Type: text/x-diff, Size: 3232 bytes --]

From ddb8cda5b0c21807c884b9e5a72b0da7ee9605a2 Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@riseup.net>
Date: Tue, 29 Jun 2021 19:22:04 +0200
Subject: [PATCH] Fix ediff3 with window-combinaison-resize

* lisp/vc/ediff-wind.el (ediff-setup-windows-plain-compare): When
'window-combination-resize' is set to t and 'even-window-sizes'
is set to nil, the 3 window layout as in ediff3 does not produce
a balanced layout. Getting rid of the manual resizing and relying
rather on window.el to automatically resize the windows with
'window-combination-resize', solve that issue.
(ediff-setup-windows-multiframe-compare): Tiddo.
---
 lisp/vc/ediff-wind.el | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index fc6ea944ae..361eecd01e 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -400,7 +400,8 @@ ediff-setup-windows-plain-compare
   ;; skip dedicated and unsplittable frames
   (ediff-destroy-control-frame control-buffer)
   (let ((window-min-height 1)
-	split-window-function wind-width-or-height
+        (window-combination-resize t)
+	split-window-function
 	three-way-comparison
 	wind-A-start wind-B-start wind-A wind-B wind-C)
     (with-current-buffer control-buffer
@@ -427,14 +428,7 @@ ediff-setup-windows-plain-compare
     (other-window 1)
     (switch-to-buffer buf-A)
     (setq wind-A (selected-window))
-    (if three-way-comparison
-	(setq wind-width-or-height
-	      (/ (if (eq split-window-function #'split-window-vertically)
-		     (window-height wind-A)
-		   (window-width wind-A))
-		 3)))
-
-    (funcall split-window-function wind-width-or-height)
+    (funcall split-window-function)
 
     (if (eq (selected-window) wind-A)
 	(other-window 1))
@@ -443,7 +437,7 @@ ediff-setup-windows-plain-compare
 
     (if three-way-comparison
 	(progn
-	  (funcall split-window-function) ; equally
+	  (funcall split-window-function)
 	  (if (eq (selected-window) wind-B)
 	      (other-window 1))
 	  (switch-to-buffer buf-C)
@@ -746,6 +740,7 @@ ediff-setup-windows-multiframe-compare
 			     (and (not (frame-live-p frame-A))
 				  (or ctl-frame-exists-p
 				      (eq frame-B (selected-frame))))))
+         (window-combination-resize t)
 	 wind-A-start wind-B-start
 	 designated-minibuffer-frame)
 
@@ -758,7 +753,7 @@ ediff-setup-windows-multiframe-compare
 			   'B ediff-narrow-bounds))))
 
     (if use-same-frame
-	(let (wind-width-or-height) ; this affects 3way setups only
+        (progn
 	  (if (and (eq frame-A frame-B) (frame-live-p frame-A))
 	      (select-frame frame-A)
 	    ;; avoid dedicated and non-splittable windows
@@ -767,15 +762,7 @@ ediff-setup-windows-multiframe-compare
 	  (switch-to-buffer buf-A)
 	  (setq wind-A (selected-window))
 
-	  (if three-way-comparison
-	      (setq wind-width-or-height
-		    (/
-		     (if (eq split-window-function #'split-window-vertically)
-			 (window-height wind-A)
-		       (window-width wind-A))
-		     3)))
-
-	  (funcall split-window-function wind-width-or-height)
+          (funcall split-window-function)
 	  (if (eq (selected-window) wind-A)
 	      (other-window 1))
 	  (switch-to-buffer buf-B)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-06-29 16:24 bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize Trust me I am a Doctor
@ 2021-06-30  7:37 ` martin rudalics
  2021-07-08 13:33   ` marmote-te
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2021-06-30  7:37 UTC (permalink / raw)
  To: Trust me I am a Doctor, 49277

 > I have a bug when calling ediff3, the layout is not a balanced.
 >
 > Ultimately I found that combining this settings were the culprit :
 >
 > (setq window-combination-resize t
 >        even-window-sizes nil)
 >
 > ;; you can test it with eg :
 > (setq default-directory "/home/user")
 > (ediff3 ".bashrc"
 >          ".bash_history"
 >          ".bash_logout")
 >
 > Removing the manual resizing when splitting windows and relying rather
 > on 'window-combinaison-resize' to balance the layout, solve the issue.

I think we can easily do that but it does not handle the

(setq window-combination-resize t
       even-window-sizes nil
       ediff-window-setup-function 'ediff-setup-windows-plain)

case here.  Shouldn't we fix that too?

Thanks, martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-06-30  7:37 ` martin rudalics
@ 2021-07-08 13:33   ` marmote-te
  2021-07-19 16:07     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: marmote-te @ 2021-07-08 13:33 UTC (permalink / raw)
  To: martin rudalics; +Cc: 49277

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]


martin rudalics <rudalics@gmx.at> writes:

>> I have a bug when calling ediff3, the layout is not a balanced.
>>
>> Ultimately I found that combining this settings were the culprit :
>>
>> (setq window-combination-resize t
>>        even-window-sizes nil)
>>
>> ;; you can test it with eg :
>> (setq default-directory "/home/user")
>> (ediff3 ".bashrc"
>>          ".bash_history"
>>          ".bash_logout")
>>
>> Removing the manual resizing when splitting windows and relying rather
>> on 'window-combinaison-resize' to balance the layout, solve the issue.
>
> I think we can easily do that but it does not handle the
>
> (setq window-combination-resize t
>       even-window-sizes nil
>       ediff-window-setup-function 'ediff-setup-windows-plain)
>
> case here.  Shouldn't we fix that too?
>
> Thanks, martin

Yes, I missed that one ; it worked only in plain window with
(setq ediff-split-window-function #'split-window-horizontally)

I guess that is the control buffer that is interfering somehow
with the resizing ?

I tried to apply on it a 'window-preserve parameter on its window,
without much success.

So in this one, for the plain window setup, I only create the control
window at the end of the layout.
It does not seemed necessary to setup the control buffer twice.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Fix ediff3 with window-combinaison-resize 2 --]
[-- Type: text/x-diff, Size: 3929 bytes --]

From 96b03d92ea2c46d5cb9716383ad2248a3d701c72 Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@riseup.net>
Date: Tue, 29 Jun 2021 19:22:04 +0200
Subject: [PATCH] Fix ediff3 with window-combinaison-resize

* lisp/vc/ediff-wind.el (ediff-setup-windows-plain-compare): When
'window-combination-resize' is set to t and 'even-window-sizes'
is set to nil, the 3 window layout as in ediff3 does not produce
a balanced layout. Getting rid of the manual resizing and relying
rather on window.el to automatically resize the windows with
'window-combination-resize', solve that issue.
(ediff-setup-windows-multiframe-compare): Tiddo.
---
 lisp/vc/ediff-wind.el | 34 ++++++++++------------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index fc6ea944ae..7c90348b5d 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -400,7 +400,8 @@ ediff-setup-windows-plain-compare
   ;; skip dedicated and unsplittable frames
   (ediff-destroy-control-frame control-buffer)
   (let ((window-min-height 1)
-	split-window-function wind-width-or-height
+        (window-combination-resize t)
+	split-window-function
 	three-way-comparison
 	wind-A-start wind-B-start wind-A wind-B wind-C)
     (with-current-buffer control-buffer
@@ -419,22 +420,12 @@ ediff-setup-windows-plain-compare
 	(select-window (next-window nil 'ignore-minibuf)))
     (delete-other-windows)
     (set-window-dedicated-p (selected-window) nil)
-    (split-window-vertically)
-    (ediff-select-lowest-window)
-    (ediff-setup-control-buffer control-buffer)
 
     ;; go to the upper window and split it betw A, B, and possibly C
     (other-window 1)
     (switch-to-buffer buf-A)
     (setq wind-A (selected-window))
-    (if three-way-comparison
-	(setq wind-width-or-height
-	      (/ (if (eq split-window-function #'split-window-vertically)
-		     (window-height wind-A)
-		   (window-width wind-A))
-		 3)))
-
-    (funcall split-window-function wind-width-or-height)
+    (funcall split-window-function)
 
     (if (eq (selected-window) wind-A)
 	(other-window 1))
@@ -443,7 +434,7 @@ ediff-setup-windows-plain-compare
 
     (if three-way-comparison
 	(progn
-	  (funcall split-window-function) ; equally
+	  (funcall split-window-function)
 	  (if (eq (selected-window) wind-B)
 	      (other-window 1))
 	  (switch-to-buffer buf-C)
@@ -461,7 +452,9 @@ ediff-setup-windows-plain-compare
 	  (set-window-start wind-A wind-A-start)
 	  (set-window-start wind-B wind-B-start)))
 
-    (ediff-select-lowest-window)
+    (select-window (display-buffer-in-direction
+                    control-buffer
+                    '((direction . bottom))))
     (ediff-setup-control-buffer control-buffer)
     ))
 
@@ -746,6 +739,7 @@ ediff-setup-windows-multiframe-compare
 			     (and (not (frame-live-p frame-A))
 				  (or ctl-frame-exists-p
 				      (eq frame-B (selected-frame))))))
+         (window-combination-resize t)
 	 wind-A-start wind-B-start
 	 designated-minibuffer-frame)
 
@@ -758,7 +752,7 @@ ediff-setup-windows-multiframe-compare
 			   'B ediff-narrow-bounds))))
 
     (if use-same-frame
-	(let (wind-width-or-height) ; this affects 3way setups only
+        (progn
 	  (if (and (eq frame-A frame-B) (frame-live-p frame-A))
 	      (select-frame frame-A)
 	    ;; avoid dedicated and non-splittable windows
@@ -767,15 +761,7 @@ ediff-setup-windows-multiframe-compare
 	  (switch-to-buffer buf-A)
 	  (setq wind-A (selected-window))
 
-	  (if three-way-comparison
-	      (setq wind-width-or-height
-		    (/
-		     (if (eq split-window-function #'split-window-vertically)
-			 (window-height wind-A)
-		       (window-width wind-A))
-		     3)))
-
-	  (funcall split-window-function wind-width-or-height)
+          (funcall split-window-function)
 	  (if (eq (selected-window) wind-A)
 	      (other-window 1))
 	  (switch-to-buffer buf-B)
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 244 bytes --]



There is also the merge job layouts, that are a little bit different,
but as far I understand them, they are not affected by this issue. If it
feels cleaner, I could however apply the same modification to the setup
of the control buffer.

--

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-07-08 13:33   ` marmote-te
@ 2021-07-19 16:07     ` Lars Ingebrigtsen
  2021-07-20  7:20       ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ingebrigtsen @ 2021-07-19 16:07 UTC (permalink / raw)
  To: marmote-te; +Cc: 49277

marmote-te <marmot-te@riseup.net> writes:

> So in this one, for the plain window setup, I only create the control
> window at the end of the layout.
> It does not seemed necessary to setup the control buffer twice.

Martin, did this version of the patch look OK to you?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-07-19 16:07     ` Lars Ingebrigtsen
@ 2021-07-20  7:20       ` martin rudalics
  2021-07-21 11:12         ` Trust me I am a Doctor
  0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2021-07-20  7:20 UTC (permalink / raw)
  To: Lars Ingebrigtsen, marmote-te; +Cc: 49277

 > Martin, did this version of the patch look OK to you?

So far it's OK here with

(custom-set-variables
  '(ediff-split-window-function 'split-window-horizontally)
  '(ediff-window-setup-function 'ediff-setup-windows-plain))

but with plain

(custom-set-variables
  '(ediff-window-setup-function 'ediff-setup-windows-plain))

`ediff3' makes the topmost window occupy half of the frame which is not
TRT.

martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-07-20  7:20       ` martin rudalics
@ 2021-07-21 11:12         ` Trust me I am a Doctor
  2021-08-18  8:02           ` martin rudalics
  0 siblings, 1 reply; 9+ messages in thread
From: Trust me I am a Doctor @ 2021-07-21 11:12 UTC (permalink / raw)
  To: martin rudalics; +Cc: 49277, Lars Ingebrigtsen

[-- Attachment #1: Type: text/plain, Size: 69 bytes --]


please try this one. I swear it is not again the same buggy patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: corrected --]
[-- Type: text/x-diff, Size: 3929 bytes --]

From 96b03d92ea2c46d5cb9716383ad2248a3d701c72 Mon Sep 17 00:00:00 2001
From: Trust me I am a doctor <pillule@riseup.net>
Date: Tue, 29 Jun 2021 19:22:04 +0200
Subject: [PATCH] Fix ediff3 with window-combinaison-resize

* lisp/vc/ediff-wind.el (ediff-setup-windows-plain-compare): When
'window-combination-resize' is set to t and 'even-window-sizes'
is set to nil, the 3 window layout as in ediff3 does not produce
a balanced layout. Getting rid of the manual resizing and relying
rather on window.el to automatically resize the windows with
'window-combination-resize', solve that issue.
(ediff-setup-windows-multiframe-compare): Tiddo.
---
 lisp/vc/ediff-wind.el | 34 ++++++++++------------------------
 1 file changed, 10 insertions(+), 24 deletions(-)

diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index fc6ea944ae..7c90348b5d 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -400,7 +400,8 @@ ediff-setup-windows-plain-compare
   ;; skip dedicated and unsplittable frames
   (ediff-destroy-control-frame control-buffer)
   (let ((window-min-height 1)
-	split-window-function wind-width-or-height
+        (window-combination-resize t)
+	split-window-function
 	three-way-comparison
 	wind-A-start wind-B-start wind-A wind-B wind-C)
     (with-current-buffer control-buffer
@@ -419,22 +420,12 @@ ediff-setup-windows-plain-compare
 	(select-window (next-window nil 'ignore-minibuf)))
     (delete-other-windows)
     (set-window-dedicated-p (selected-window) nil)
-    (split-window-vertically)
-    (ediff-select-lowest-window)
-    (ediff-setup-control-buffer control-buffer)
 
     ;; go to the upper window and split it betw A, B, and possibly C
     (other-window 1)
     (switch-to-buffer buf-A)
     (setq wind-A (selected-window))
-    (if three-way-comparison
-	(setq wind-width-or-height
-	      (/ (if (eq split-window-function #'split-window-vertically)
-		     (window-height wind-A)
-		   (window-width wind-A))
-		 3)))
-
-    (funcall split-window-function wind-width-or-height)
+    (funcall split-window-function)
 
     (if (eq (selected-window) wind-A)
 	(other-window 1))
@@ -443,7 +434,7 @@ ediff-setup-windows-plain-compare
 
     (if three-way-comparison
 	(progn
-	  (funcall split-window-function) ; equally
+	  (funcall split-window-function)
 	  (if (eq (selected-window) wind-B)
 	      (other-window 1))
 	  (switch-to-buffer buf-C)
@@ -461,7 +452,9 @@ ediff-setup-windows-plain-compare
 	  (set-window-start wind-A wind-A-start)
 	  (set-window-start wind-B wind-B-start)))
 
-    (ediff-select-lowest-window)
+    (select-window (display-buffer-in-direction
+                    control-buffer
+                    '((direction . bottom))))
     (ediff-setup-control-buffer control-buffer)
     ))
 
@@ -746,6 +739,7 @@ ediff-setup-windows-multiframe-compare
 			     (and (not (frame-live-p frame-A))
 				  (or ctl-frame-exists-p
 				      (eq frame-B (selected-frame))))))
+         (window-combination-resize t)
 	 wind-A-start wind-B-start
 	 designated-minibuffer-frame)
 
@@ -758,7 +752,7 @@ ediff-setup-windows-multiframe-compare
 			   'B ediff-narrow-bounds))))
 
     (if use-same-frame
-	(let (wind-width-or-height) ; this affects 3way setups only
+        (progn
 	  (if (and (eq frame-A frame-B) (frame-live-p frame-A))
 	      (select-frame frame-A)
 	    ;; avoid dedicated and non-splittable windows
@@ -767,15 +761,7 @@ ediff-setup-windows-multiframe-compare
 	  (switch-to-buffer buf-A)
 	  (setq wind-A (selected-window))
 
-	  (if three-way-comparison
-	      (setq wind-width-or-height
-		    (/
-		     (if (eq split-window-function #'split-window-vertically)
-			 (window-height wind-A)
-		       (window-width wind-A))
-		     3)))
-
-	  (funcall split-window-function wind-width-or-height)
+          (funcall split-window-function)
 	  (if (eq (selected-window) wind-A)
 	      (other-window 1))
 	  (switch-to-buffer buf-B)
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 5 bytes --]



--

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-07-21 11:12         ` Trust me I am a Doctor
@ 2021-08-18  8:02           ` martin rudalics
  2021-08-18 18:25             ` Trust me I am a Doctor
  2021-08-18 18:25             ` Trust me I am a Doctor
  0 siblings, 2 replies; 9+ messages in thread
From: martin rudalics @ 2021-08-18  8:02 UTC (permalink / raw)
  To: Trust me I am a Doctor; +Cc: 49277, Lars Ingebrigtsen

 > please try this one. I swear it is not again the same buggy patch.

Installed as well.  Please have a look and consider closing this and the
other bug.

Thanks, martin





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-08-18  8:02           ` martin rudalics
@ 2021-08-18 18:25             ` Trust me I am a Doctor
  2021-08-18 18:25             ` Trust me I am a Doctor
  1 sibling, 0 replies; 9+ messages in thread
From: Trust me I am a Doctor @ 2021-08-18 18:25 UTC (permalink / raw)
  To: martin rudalics; +Cc: 49277, Lars Ingebrigtsen


> Installed as well.  Please have a look and consider closing this and the
> other bug.
>
> Thanks, martin


Fine, thanks for your time Martin.

I am closing them.
--





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize
  2021-08-18  8:02           ` martin rudalics
  2021-08-18 18:25             ` Trust me I am a Doctor
@ 2021-08-18 18:25             ` Trust me I am a Doctor
  1 sibling, 0 replies; 9+ messages in thread
From: Trust me I am a Doctor @ 2021-08-18 18:25 UTC (permalink / raw)
  To: control; +Cc: 49277


close 49277
thanks

--





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-08-18 18:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-29 16:24 bug#49277: 28.0.50; [PATCH] Fix ediff3 with window-combinaison-resize Trust me I am a Doctor
2021-06-30  7:37 ` martin rudalics
2021-07-08 13:33   ` marmote-te
2021-07-19 16:07     ` Lars Ingebrigtsen
2021-07-20  7:20       ` martin rudalics
2021-07-21 11:12         ` Trust me I am a Doctor
2021-08-18  8:02           ` martin rudalics
2021-08-18 18:25             ` Trust me I am a Doctor
2021-08-18 18:25             ` Trust me I am a Doctor

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).