unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 45688@debbugs.gnu.org
Subject: bug#45688: 28.0.50; New action for display-buffer?
Date: Mon, 11 Jan 2021 19:55:03 +0100	[thread overview]
Message-ID: <c42c070f-8948-1583-4011-0ee97650e1fe@gmx.at> (raw)
In-Reply-To: <b9059f39-b3af-3ec7-c0ee-d1a493a3a2f5@gmx.at>

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

 > Let's try to clean up the height value when copying the 'quit-restore'
 > parameter as attached.

Just found a related bug in the code.  When 'display-buffer' makes a new
window on the left or right, it sets that value to the window's width
which doesn't make any sense.  The current code can handle only height
values as for 'shrink-window-if-larger-than-buffer' or the default
'fit-window-to-buffer'.  So please use the patch attached here.

martin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: split-window-quit-restore.diff --]
[-- Type: text/x-patch; name="split-window-quit-restore.diff", Size: 2456 bytes --]

diff --git a/lisp/window.el b/lisp/window.el
index a6cdd4dec2..c09d9532e3 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5543,10 +5543,12 @@ split-window-below
 Otherwise, the window starts are chosen so as to minimize the
 amount of redisplay; this is convenient on slow terminals."
   (interactive "P")
-  (let ((old-window (selected-window))
-	(old-point (window-point))
-	(size (and size (prefix-numeric-value size)))
-        moved-by-window-height moved new-window bottom)
+  (let* ((old-window (selected-window))
+	 (old-point (window-point))
+	 (size (and size (prefix-numeric-value size)))
+         (quit-restore (window-parameter old-window 'quit-restore))
+	 (quad (nth 1 quit-restore))
+         moved-by-window-height moved new-window bottom)
     (when (and size (< size 0) (< (- size) window-min-height))
       ;; `split-window' would not signal an error here.
       (error "Size of new window too small"))
@@ -5574,10 +5576,18 @@ split-window-below
 	     (<= (window-start new-window) old-point)
 	     (set-window-point new-window old-point)
 	     (select-window new-window))))
-    ;; Always copy quit-restore parameter in interactive use.
-    (let ((quit-restore (window-parameter old-window 'quit-restore)))
-      (when quit-restore
-	(set-window-parameter new-window 'quit-restore quit-restore)))
+
+    (when quit-restore
+      (when (and (listp quad) (integerp (nth 3 quad)))
+        ;; nth 3 of quad is the old-window height of OLD-WINDOW.  This
+        ;; value is meaningless in NEW-WINDOW so set it to the present
+        ;; height of NEW-WINDOW.
+        (setq quit-restore (copy-tree quit-restore))
+        (rplaca (cdddr (nth 1 quit-restore))
+                (window-total-height new-window)))
+
+      (set-window-parameter new-window 'quit-restore quit-restore))
+
     new-window))

 (defalias 'split-window-vertically 'split-window-below)
@@ -6440,9 +6450,7 @@ display-buffer-record-window
 		     ;; Preserve window-point-insertion-type (Bug#12855).
 		     (copy-marker
 		      (window-point window) window-point-insertion-type)
-		     (if (window-combined-p window)
-                         (window-total-height window)
-                       (window-total-width window)))
+                     (window-total-height window))
 	       (selected-window) buffer)))))
    ((eq type 'window)
     ;; WINDOW has been created on an existing frame.

  reply	other threads:[~2021-01-11 18:55 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06 12:02 bug#45688: 28.0.50; New action for display-buffer? Lars Ingebrigtsen
2021-01-06 13:36 ` martin rudalics
2021-01-06 14:09   ` Lars Ingebrigtsen
2021-01-06 15:52     ` martin rudalics
2021-01-07 11:45       ` Lars Ingebrigtsen
2021-01-07 13:18         ` martin rudalics
2021-01-07 14:47           ` Lars Ingebrigtsen
2021-01-07 15:17             ` martin rudalics
2021-01-07 15:35             ` martin rudalics
2021-01-07 15:49               ` Lars Ingebrigtsen
2021-01-07 16:54                 ` martin rudalics
2021-01-06 15:45 ` Eli Zaretskii
2021-01-06 17:20   ` Lars Ingebrigtsen
2021-01-06 18:17     ` Eli Zaretskii
2021-01-07 11:40       ` Lars Ingebrigtsen
2021-01-07 13:17         ` martin rudalics
2021-01-07 15:39           ` Lars Ingebrigtsen
2021-01-07 16:54             ` martin rudalics
2021-01-10 11:24               ` Lars Ingebrigtsen
2021-01-10 16:05                 ` martin rudalics
2021-01-10 16:14                   ` martin rudalics
2021-01-11 14:43                     ` Lars Ingebrigtsen
2021-01-11 18:23                       ` martin rudalics
2021-01-11 18:55                         ` martin rudalics [this message]
2021-01-19  3:20                           ` Lars Ingebrigtsen
2021-01-11 19:05                         ` Lars Ingebrigtsen
2021-01-12  9:06                           ` martin rudalics
2021-01-19  3:26                             ` Lars Ingebrigtsen
2021-01-20  8:08                               ` martin rudalics
2021-01-20 16:34                                 ` Lars Ingebrigtsen
2021-01-20 17:11                                   ` martin rudalics
2021-01-19 17:50                             ` Juri Linkov
2021-01-20  8:09                               ` martin rudalics
2021-01-20 21:45                                 ` Juri Linkov
2021-01-25 19:03                                   ` martin rudalics
2021-01-25 20:08                                     ` Juri Linkov
2021-01-26 15:57                                       ` martin rudalics
2021-01-27  9:38                                         ` Juri Linkov
2021-01-28  9:40                                           ` martin rudalics
2021-10-03 18:12                                         ` Juri Linkov
2021-10-04  8:28                                           ` martin rudalics
2021-10-04 17:31                                             ` Juri Linkov
2021-10-05  6:43                                               ` Lars Ingebrigtsen
2021-10-05  8:10                                               ` martin rudalics
2021-10-05 16:49                                                 ` Juri Linkov
2021-10-06  7:41                                                   ` martin rudalics
2021-10-06 17:45                                               ` Juri Linkov
2021-10-13  8:36                                                 ` martin rudalics
2021-01-11 14:45                   ` Lars Ingebrigtsen
2021-01-07 18:43         ` Juri Linkov
2021-01-08  8:31           ` martin rudalics
2021-01-10 11:26             ` Lars Ingebrigtsen
2021-01-12 18:36               ` Juri Linkov
2021-01-19 17:52                 ` Juri Linkov
2021-01-25 20:10                   ` Juri Linkov
2021-01-26 15:57                     ` martin rudalics
2021-01-27  9:35                       ` Juri Linkov
2021-01-28  9:40                         ` martin rudalics
2021-01-28 18:46                           ` Juri Linkov
2021-01-29  7:51                             ` martin rudalics
2021-01-06 17:41 ` Juri Linkov
2021-01-06 18:28   ` Drew Adams
2021-01-06 18:47   ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c42c070f-8948-1583-4011-0ee97650e1fe@gmx.at \
    --to=rudalics@gmx.at \
    --cc=45688@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).