unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: John Shahid <jvshahid@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size)
Date: Tue, 30 Apr 2019 18:26:35 -0400	[thread overview]
Message-ID: <87muk7yvs4.fsf@gmail.com> (raw)
In-Reply-To: <87imuw8uk2.fsf@gmail.com>

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


I just realized that the initial term-height didn't use floor to round
down the value of window-text-height.  This was masked by a hook I have
in my configuration.  I attached another patch that fixes the issue.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Consider-line-spacing-and-font-height-when-deriving-.patch --]
[-- Type: text/x-patch, Size: 2089 bytes --]

From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001
From: John Shahid <jvshahid@gmail.com>
Date: Sat, 27 Apr 2019 12:21:38 -0400
Subject: [PATCH] Consider line spacing and font height when deriving proc
 window size

* lisp/window.el (window-adjust-process-window-size): Use
  window-screen-lines instead of window-body-height.
* lisp/term.el (term-mode): Use window-screen-lines to set the initial
  window height.
---
 lisp/term.el   | 2 +-
 lisp/window.el | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/term.el b/lisp/term.el
index 586a887a29..8a28e6df28 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1024,7 +1024,7 @@ term-mode
   (setq indent-tabs-mode nil)
   (setq buffer-display-table term-display-table)
   (set (make-local-variable 'term-home-marker) (copy-marker 0))
-  (set (make-local-variable 'term-height) (window-text-height))
+  (set (make-local-variable 'term-height) (floor (window-screen-lines)))
   (set (make-local-variable 'term-width) (window-max-chars-per-line))
   (set (make-local-variable 'term-last-input-start) (make-marker))
   (set (make-local-variable 'term-last-input-end) (make-marker))
diff --git a/lisp/window.el b/lisp/window.el
index b4f5ac5cc4..c8fc1248ab 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -9425,10 +9425,12 @@ window-adjust-process-window-size
 the given windows."
   (when windows
     (let ((width (window-max-chars-per-line (car windows)))
-          (height (window-body-height (car windows))))
+          (height (with-selected-window (car windows)
+                    (floor (window-screen-lines)))))
       (dolist (window (cdr windows))
         (setf width (funcall reducer width (window-max-chars-per-line window)))
-        (setf height (funcall reducer height (window-body-height window))))
+        (setf height (funcall reducer height (with-selected-window window
+                                               (floor (window-screen-lines))))))
       (cons width height))))
 
 (defun window-adjust-process-window-size-smallest (_process windows)
-- 
2.21.0


  reply	other threads:[~2019-04-30 22:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-14 14:54 using window-screen-lines in window-adjust-process-window-size John Shahid
2019-01-16 14:10 ` John Shahid
2019-04-27 10:43   ` Using window-screen-lines in window-adjust-process-window-size (was: Re: using window-screen-lines in window-adjust-process-window-size) John Shahid
2019-04-27 10:50     ` Eli Zaretskii
2019-04-29 19:45       ` John Shahid
2019-04-30 22:26         ` John Shahid [this message]
2019-05-13 12:03           ` John Shahid
2019-06-07  9:10             ` Eli Zaretskii

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=87muk7yvs4.fsf@gmail.com \
    --to=jvshahid@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.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).