From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: John Shahid Newsgroups: gmane.emacs.devel 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: Mon, 13 May 2019 08:03:19 -0400 Message-ID: <871s12tvco.fsf@gmail.com> References: <87va64lguo.fsf@gmail.com> <87tvi8r8w4.fsf@gmail.com> <87wojfvidf.fsf@gmail.com> <83wojfvi0p.fsf@gnu.org> <87imuw8uk2.fsf@gmail.com> <87muk7yvs4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="203073"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.1.0; emacs 27.0.50 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 13 14:03:44 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQ9gF-000qij-SL for ged-emacs-devel@m.gmane.org; Mon, 13 May 2019 14:03:43 +0200 Original-Received: from localhost ([127.0.0.1]:55878 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQ9gE-0008SW-P4 for ged-emacs-devel@m.gmane.org; Mon, 13 May 2019 08:03:42 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQ9g0-0008Pk-6s for emacs-devel@gnu.org; Mon, 13 May 2019 08:03:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQ9fx-0004XI-Ux for emacs-devel@gnu.org; Mon, 13 May 2019 08:03:27 -0400 Original-Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]:32858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQ9fw-0004Ud-C1; Mon, 13 May 2019 08:03:24 -0400 Original-Received: by mail-qt1-x833.google.com with SMTP id m32so11267488qtf.0; Mon, 13 May 2019 05:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=nUiwduBe+mDqU2PsWIOcJCqt8kfGEszvyjDbkNSQI+0=; b=VBdQtYXuQMZNhyMgi0xus8p5iR4/Wedh2aHCug58qS1Sry3tKfLvXns2v3LgOtCGdC l/3/+d1ZzlWZV1OB1FkDBOjjZHgb6K77ibPfjbSUhpU5eJfJOMSDnTDopkfQCRCmveMB PDRDf49RZJENYuEbMc4/m4ifbScOqLi4Z9SLrinbYQK2GNIyNYqqFji9sPA6k42Ukoou FWzzLmS1wBI8atPb8kE5A0N/AGIljmmKKmgJfm6D1ioS8lD4b9PB4ReAa+7/6fGQxv3s OWQ/J1jHxH2+uL85LUTAG4DSj+qJN511Xoea2zi5XcLI/WET8nmS7bThfE2sYzA3z8VO jQ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=nUiwduBe+mDqU2PsWIOcJCqt8kfGEszvyjDbkNSQI+0=; b=aUU79Bx42BqdoTZyya0DFPZzZ96Zf09tbzRixBayHkHQiNg6wtV8+8tVvLtsM/HVM9 9EQTO9RE1f42mdMX9Can+L1BmZ6VfcDwKA/M/o8nxC320igwNzDzQ7nCFgaQTDYfWUES mW/qKWbqiNw+J/X2LdiUggGcU89JUTXUA1YvKF7S70lPF1u1x5yoMg+ROoruyXY2N0Dr dDDsYR1O37L289IR3vI3YIDL0U6UT67M7ACPokorppY68fBtqMCAeo6/8UG+gCAwl2IW soCfQc8xkcl3DM1vnlR4etExUMnNBurCKDEfTTNZFiRJuRw5nSYAjtyiGUATC7Wrb9on ujMQ== X-Gm-Message-State: APjAAAXxMkmAEZJ4Ni/kdWw+YnzZvhcB6XsYxeLJQs2gKpv39EY4veV8 6JiMHOlpkGsUDx+4A09SKeTgpljl X-Google-Smtp-Source: APXvYqxQXtCDY8jca4b1OlqihTlnYE2U5NmzjteRrLEBNmhhRRw5vaCriqjm/FZhOj92o52IxxqPng== X-Received: by 2002:a0c:8aad:: with SMTP id 42mr22426415qvv.200.1557749001662; Mon, 13 May 2019 05:03:21 -0700 (PDT) Original-Received: from amun (cpe-104-162-85-46.nyc.res.rr.com. [104.162.85.46]) by smtp.gmail.com with ESMTPSA id x65sm6779125qke.58.2019.05.13.05.03.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 May 2019 05:03:19 -0700 (PDT) In-reply-to: <87muk7yvs4.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::833 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236462 Archived-At: It looks like no one objects to my earlier patch. If that is the case, can you push the change to master. I don't have commit access. Thanks, JS John Shahid writes: > 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. > > From 92825356ddf320a480c1dd4068cac3f995043faf Mon Sep 17 00:00:00 2001 > From: John Shahid > 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)