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, 29 Apr 2019 15:45:31 -0400 Message-ID: <87imuw8uk2.fsf@gmail.com> References: <87va64lguo.fsf@gmail.com> <87tvi8r8w4.fsf@gmail.com> <87wojfvidf.fsf@gmail.com> <83wojfvi0p.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="24588"; 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 Apr 29 21:46:25 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 1hLCEJ-0006E2-EJ for ged-emacs-devel@m.gmane.org; Mon, 29 Apr 2019 21:46:23 +0200 Original-Received: from localhost ([127.0.0.1]:34390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLCEI-00074i-G6 for ged-emacs-devel@m.gmane.org; Mon, 29 Apr 2019 15:46:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLCDb-0006zG-NI for emacs-devel@gnu.org; Mon, 29 Apr 2019 15:45:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLCDa-0000AZ-NH for emacs-devel@gnu.org; Mon, 29 Apr 2019 15:45:39 -0400 Original-Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:46617) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLCDZ-00009V-K9; Mon, 29 Apr 2019 15:45:38 -0400 Original-Received: by mail-qt1-x832.google.com with SMTP id i31so4657884qti.13; Mon, 29 Apr 2019 12:45:36 -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:message-id:in-reply-to :date:mime-version; bh=ivtNZvkmhSooWUqn51DyJoO8A3G59TRPlj17n4QNyuA=; b=dbVjzDbAw4eNz4xqQHqRJbPAn8A2KIKmvnfLb2ctlmC+9VgpSkTMOGKmpMr+eBBeRC E+1JlfQkgNtHQ+yvGt7nT5BJHcvmP8Ec3hjjNPzgtqlC+NrnL5k/m9FvPwIIxnxV+OyM +PYDj4jCkIG1Y/TNBl9Wh2ewqTegfzSqGG8y0EYbMl1eJQnxu99TVjsJsizTI7cVWbKN ACQFtfOX0FO+GOWckRS20kAfp5kgVksTxvs3fJwOoh2OyXiwQLjlvemdMhDt97cMbLSS 6jOY0YsCWCOFxJyssEkQ5h9SaEctXXU9DtGm7QwL5/SzK/1IhSP876Cpzyg8QenMN3RK mxtw== 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 :message-id:in-reply-to:date:mime-version; bh=ivtNZvkmhSooWUqn51DyJoO8A3G59TRPlj17n4QNyuA=; b=qaOYnwZdrZHsoArZMnvA7ZHI+zCoMfhYc3GX6m5Uz3xJePn1vQ8/0oCK/Up6dxYrRz yawZ1GabcnNzBnX/I0Cvr1gF+ogJmfoWbcQwvQo6OSctT+ARJ0zQNwrm6Ek8m5m2jknB 3TP3JeioQtIhEoDLD1ZWPJfgtDHgZ8Yp5YXRBxCc/hG5eI9lxbBPuFjJpwtm45b4B3E8 /iwOuTtZbQP2yAtNPdlYEBZ9myZDSjZAbprWDxMLPUyvMr7pHV4EwRXhMxV7Nljdrm5x f6SegLCEf9kZeC5TWpcdxbDQpwbyQE48zoKKjZl6aIV/EwCs03dISCVeZXJKRWaj1eju 8Q7g== X-Gm-Message-State: APjAAAXdwcrNCcKUiCAJ+/lG7SYNg10+9C8CYBc9UrpgLgx1XEhYID4D qsUSRD9T4Isb6hpoUTx+WwNyQsRy X-Google-Smtp-Source: APXvYqwnKdvJkKUiKvRYI77626zMIfKDRcagami6vfqXOANZP5kIVUy2LXjBI/16TyWQnJmDvrMuvA== X-Received: by 2002:a0c:b505:: with SMTP id d5mr49722916qve.62.1556567135120; Mon, 29 Apr 2019 12:45:35 -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 d55sm4071022qtb.59.2019.04.29.12.45.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Apr 2019 12:45:33 -0700 (PDT) In-reply-to: <83wojfvi0p.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::832 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:236034 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: [...] > I think you are on the right track, so please show a patch to do that, > and let's take it from there. Thanks for getting back to me. I attached the patch below. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Consider-line-spacing-and-font-height-when-deriving-.patch >From e9cefa049b6c709e728109eb07cfb186024ef581 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..b5949c4600 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) (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 --=-=-=--