From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add function window-line-width Date: Fri, 08 Nov 2019 15:18:06 +0200 Message-ID: <83ftiycxrl.fsf@gnu.org> References: <8846a8ad-0299-1ff7-cc9a-0aaed18e76c0@gmx.at> <125a5b4a-5ac8-426f-5762-af0e91962c78@gmx.at> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="77547"; mail-complaints-to="usenet@blaine.gmane.org" Cc: sebastien@chapu.is, emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 08 14:23: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.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iT4EW-000K1d-VH for ged-emacs-devel@m.gmane.org; Fri, 08 Nov 2019 14:23:25 +0100 Original-Received: from localhost ([::1]:54254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iT4EV-0001RJ-Ex for ged-emacs-devel@m.gmane.org; Fri, 08 Nov 2019 08:23:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53257) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iT49z-0006kW-J8 for emacs-devel@gnu.org; Fri, 08 Nov 2019 08:18:44 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47267) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iT49r-0001vw-Ff; Fri, 08 Nov 2019 08:18:37 -0500 Original-Received: from [176.228.60.248] (port=1652 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iT49n-0007tm-QQ; Fri, 08 Nov 2019 08:18:35 -0500 In-reply-to: <125a5b4a-5ac8-426f-5762-af0e91962c78@gmx.at> (message from martin rudalics on Fri, 8 Nov 2019 10:21:45 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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:241979 Archived-At: > From: martin rudalics > Date: Fri, 8 Nov 2019 10:21:45 +0100 > Cc: emacs-devel@gnu.org > > > The first point is important for my use case, so if 'window-line-width' is > > not accepted, would you agree for a patch > > adding a parameter to 'window-lines-pixel-dimensions' controlling this > > behavior ? > > I certainly would but it's up to Eli to decide. If window-text-pixel-size fits the bill, I don't see why we need another function or a new argument to window-lines-pixel-dimensions. > > 'window-text-pixel-size' uses a display iterator to compute values, I don't > > know the details of this iterator but it seems to > > be slower than fetching values directly from the glyph matrix. As > > mentioned, I need the width of all lines on window. > > It would be good to know how much slower 'window-text-pixel-size' then > is. If it is significantly slower, we probably should replace it with > a function based on directly accessing the glyph matrix. Can you try > to measure the respective performances? I would be very surprised to learn that it's significantly slower. Do you need to invoke this function in a tight loop or something? If not, a single invocation, even if slower, won't matter much. In general, functions that use only the glyph matrices have a significant disadvantage in that they will fail when display is not up to date, something that can happen out of control of a Lisp program that calls the function. So I very much prefer window-text-pixel-size to an alternative that uses the glyph matrices. If we find that using the glyph matrices is much faster, then I'd prefer to fix window-text-pixel-size to use the glyph matrices when possible, and otherwise fall back to its current method. See move-point-visually for one example of how this can be done.