unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Gary Fredericks <fredericksgary@gmail.com>, 32720@debbugs.gnu.org
Subject: bug#32720: term-mode ignores certain window size changes
Date: Sun, 04 Nov 2018 10:56:13 +0100	[thread overview]
Message-ID: <5BDEC23D.4080707@gmx.at> (raw)
In-Reply-To: <CAMMdeLhGococHomNV5gbaW2X0LoL9tU4BUhy5Jstp5dCWbHPgg@mail.gmail.com>

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

 > *Affects*: version 26 (git-bisected to commit 8e7712c7afc)
 >
 > Note: I have only tried this on --without-x emacs
 >
 > *Steps to reproduce*
 >
 >     1. start emacs
 >     2. start a term buffer with M-x term
 >     3. run `seq 1000` at the bash prompt to fill the screen
 >     4. enlarge the terminal window that emacs is running in, so that the
 >     window size changes as well
 >     5. run `seq 1000` again, and observe that the new space at the bottom of
 >     the buffer is not being used
 >
 > *Analysis notes*
 >
 > term-mode *does* pick up changes after more explicit window configurations,
 > like splits; my workaround for months has been to split and join the
 > terminal window whenever I've resized it.
 >
 > As best I can tell, term-mode subscribes to window size changes by adding
 > advice to the window-adjust-process-window-size-function variable, and the
 > 8e7712c7afc reduced the set of situations in which that function is called.
 >
 > I've developed a more automated workaround with a term-load-hook of this
 > form:
 >
 > (add-hook 'window-size-change-functions (lambda (_frame)
 > (window--adjust-process-windows)))
 >
 > It might be that adding this line to the term-mode setup steps would be
 > sufficient, but I'm not familiar enough with the window.el code to have a
 > guess whether that's actually a good approach.

While all you write above is correct and I agree with the fix you
propose, I tend to restore the old behavior as with the attached
patch.  The reason is that I have no idea in how many more yet
unrevealed occasions my commit had adverse effects so I'd rather be on
the safe side for Emacs 26.2.  Please try the patch and tell me
whether it indeed restores the old behavior.

Thanks, martin

[-- Attachment #2: run-window-configuration-change.diff --]
[-- Type: text/plain, Size: 1849 bytes --]

diff --git a/src/frame.c b/src/frame.c
index 0a6ca26..8076eba 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -779,6 +779,8 @@ struct frame *
 
   unblock_input ();
 
+  run_window_configuration_change_hook (f);
+
 #ifdef HAVE_WINDOW_SYSTEM
   {
     /* Adjust size of F's child frames.  */
diff --git a/src/window.c b/src/window.c
index 9026a7b..ef88fde 100644
--- a/src/window.c
+++ b/src/window.c
@@ -57,7 +57,6 @@ static bool foreach_window_1 (struct window *,
 static bool window_resize_check (struct window *, bool);
 static void window_resize_apply (struct window *, bool);
 static void select_window_1 (Lisp_Object, bool);
-static void run_window_configuration_change_hook (struct frame *);
 
 static struct window *set_window_fringes (struct window *, Lisp_Object,
 					  Lisp_Object, Lisp_Object);
@@ -3319,7 +3318,7 @@ depends on the value of (window-start WINDOW), so if calling this
     Fselect_frame (frame, Qt);
 }
 
-static void
+void
 run_window_configuration_change_hook (struct frame *f)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
diff --git a/src/window.h b/src/window.h
index 629283a..bc6d8ab 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1016,6 +1016,7 @@ extern Lisp_Object window_from_coordinates (struct frame *, int, int,
 extern void shrink_mini_window (struct window *, bool);
 extern int window_relative_x_coord (struct window *, enum window_part, int);
 
+void run_window_configuration_change_hook (struct frame *f);
 void run_window_size_change_functions (Lisp_Object);
 
 /* Make WINDOW display BUFFER.  RUN_HOOKS_P means it's allowed
diff --git a/src/xfns.c b/src/xfns.c
index 1381fee..574f0bb 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1599,4 +1599,5 @@ struct mouse_cursor_data {
     }
 #endif /* not USE_X_TOOLKIT && not USE_GTK */
   adjust_frame_glyphs (f);
+  run_window_configuration_change_hook (f);
 }

  parent reply	other threads:[~2018-11-04  9:56 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-12 12:09 bug#32720: term-mode ignores certain window size changes Gary Fredericks
2018-09-13  8:07 ` martin rudalics
2018-09-13 14:06   ` Eli Zaretskii
2018-09-14  8:32     ` martin rudalics
2018-11-04  9:56 ` martin rudalics [this message]
2018-11-16 12:15   ` Gary Fredericks
2018-11-16 12:57     ` martin rudalics
2018-11-16 13:15       ` Gary Fredericks
2018-11-18  9:22         ` martin rudalics
2018-11-16 14:45       ` Eli Zaretskii
2018-11-17  9:20         ` martin rudalics
2018-11-17  9:43           ` Eli Zaretskii
2018-11-17 18:40             ` martin rudalics
2018-11-18  3:30               ` Eli Zaretskii
2018-11-18  9:22                 ` martin rudalics
2018-11-18 15:21                   ` Eli Zaretskii
2018-11-18 19:37                     ` martin rudalics
2018-11-18 20:10                       ` Eli Zaretskii
2018-11-19  9:41                         ` martin rudalics
2018-11-19 15:04                           ` Gary Fredericks
2018-11-19 15:14                             ` martin rudalics
2018-12-22 22:53                               ` Gary Fredericks
2018-12-23  9:38                                 ` martin rudalics
2018-12-23 13:16                                   ` Gary Fredericks
2018-12-23 13:40                                     ` martin rudalics
2018-12-23 13:47                                       ` Gary Fredericks
2018-12-23 18:02                                         ` martin rudalics
2018-12-23 18:54                                           ` Gary Fredericks
2018-12-25  9:51                                             ` martin rudalics
2018-12-29 23:23                                               ` Gary Fredericks
2018-12-30  9:53                                                 ` martin rudalics
2018-12-31 12:45                                                   ` Gary Fredericks
2018-12-31 14:16                                                     ` martin rudalics
2019-01-01 15:37                                                       ` Gary Fredericks
2019-01-01 17:25                                                         ` martin rudalics
2019-01-01 17:31                                                           ` Gary Fredericks
2019-01-01 17:55                                                             ` martin rudalics
2019-01-06 22:51                                                               ` Gary Fredericks
2019-01-07 12:29                                                                 ` Gary Fredericks
2019-01-07 16:11                                                                   ` martin rudalics
2019-01-11  9:24                                                                   ` martin rudalics
2019-01-16 14:07                                                                     ` Gary Fredericks
2019-01-16 17:30                                                                       ` martin rudalics
2019-01-16 17:44                                                                         ` Gary Fredericks
2020-08-22 14:59                                                                           ` Lars Ingebrigtsen
2020-08-22 16:57                                                                             ` Gary Fredericks

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=5BDEC23D.4080707@gmx.at \
    --to=rudalics@gmx.at \
    --cc=32720@debbugs.gnu.org \
    --cc=fredericksgary@gmail.com \
    /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).