X-Loop: help-debbugs@HIDDEN Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sat, 25 Apr 2020 21:25:01 +0000 Resent-Message-ID: <handler.40856.B.158784988129802 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 40856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 40856 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs <bug-gnu-emacs@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.158784988129802 (code B ref -1); Sat, 25 Apr 2020 21:25:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Apr 2020 21:24:41 +0000 Received: from localhost ([127.0.0.1]:60506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1jSSHw-0007kc-SB for submit <at> debbugs.gnu.org; Sat, 25 Apr 2020 17:24:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:51395) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <cpitclaudel@HIDDEN>) id 1jSSHh-0007kF-IG for submit <at> debbugs.gnu.org; Sat, 25 Apr 2020 17:24:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52948) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from <cpitclaudel@HIDDEN>) id 1jSSHg-0006Gg-RB for bug-gnu-emacs@HIDDEN; Sat, 25 Apr 2020 17:24:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from <cpitclaudel@HIDDEN>) id 1jSSHg-0004GZ-0G for bug-gnu-emacs@HIDDEN; Sat, 25 Apr 2020 17:24:24 -0400 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]:46046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <cpitclaudel@HIDDEN>) id 1jSSHf-0004GP-Ia for bug-gnu-emacs@HIDDEN; Sat, 25 Apr 2020 17:24:23 -0400 Received: by mail-qv1-xf31.google.com with SMTP id p13so6528850qvt.12 for <bug-gnu-emacs@HIDDEN>; Sat, 25 Apr 2020 14:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=ZGQi2En9z9T1Q7b7v6cSUg9ae7sBBV1tMPVCr+OsQrU=; b=s1BTTFfSVCmYUxrcqyKn4wHlS13fQqocNaNulGP1sDwX1T3HiJ/kqj+UcK+40q5+ak d1FhYJuYO0StJkrAPyKsYusk7GzvnUHJpVY0n5uzCq724pjG882wMygVFnhJeIQde5uq MC90Lm0mo6Ktx86sN1VnJhsigUz13KTsncNfcLoPJsEu6kC8NeMvinVcKdpDzjYW1qzX z5bwOHAW5zDMHHfDTTs8xUXW1HhdVInQwEdALFPBNNl73BwC0GhTmQGdUGbkK4h7ra5H uAkddjZvBWCicewGdroPOx88E/UmbtFaYYVJPFppV1IaUQbQgn7RZeVcqxPQtwNXrrED XxpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=ZGQi2En9z9T1Q7b7v6cSUg9ae7sBBV1tMPVCr+OsQrU=; b=boZHstrXxYpemVnWn9Fk4rFzX1H9fqQDOMrZCKmBmWVpBcKYjJ2ayoQ7MtIGoH1xvs tjNP66wmJanDRI1xx/KSORgYKTygIgwkk+ZNWbIEo818G8wzLVt70BTxUY8OB9k34M7J Dy2Hy82Yd7JcjBW60L5Dpy0rrQWchCdiBm4n/drAuM2yuF+yW6q8lur+GTGXd4p5vUmx x/n7IyWvcZHqClt+74ceXk1AZGJS4YcjJwYEKo1AzCgY13bdbz8fakL5eOxG3Z9xewoh l/mnHkmJbS9gPx4LoA69n3QW/bNCcXqUtQPvq9DGACMc49mMQTpDYhHFtkKsblDGM1kX pUOQ== X-Gm-Message-State: AGi0PuZkDT+XFroo4hFY8JV9u18x5FgIdQ5oKAexanGRk9r+BEw7vVW4 feDNRqkDVcTa9K4mfUAQ8WPHm/cHaMY= X-Google-Smtp-Source: APiQypL1SWB7d3xANA9NaoEs68HM5Skt7dsDkBG75majRS1RTtr7ixdQoriGB6fcwV9toqLYmbK8Ag== X-Received: by 2002:a0c:e549:: with SMTP id n9mr15803208qvm.214.1587849862272; Sat, 25 Apr 2020 14:24:22 -0700 (PDT) Received: from ?IPv6:2601:184:4180:66e7:54d6:bfeb:aa49:9d3b? ([2601:184:4180:66e7:54d6:bfeb:aa49:9d3b]) by smtp.googlemail.com with ESMTPSA id 63sm6432185qkl.64.2020.04.25.14.24.21 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Apr 2020 14:24:21 -0700 (PDT) From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Message-ID: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> Date: Sat, 25 Apr 2020 17:24:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::f31; envelope-from=cpitclaudel@HIDDEN; helo=mail-qv1-xf31.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2607:f8b0:4864:20::f31 X-Spam-Score: -0.3 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) Hi all, The wrap-prefix property is very convenient, but it's hard to use for alignment when the width of the item to align to is not easy to compute. For example, to get the following effect, it's easy to use 'wrap-prefix " " - Test wrapped wrapped But take a more complex case, like this: xyz ⟝ abc wrapped wrapped Depending on the font in use, the ⟝ character may be more or less wide. So, the wrap prefix can't just be " " here; it needs to be calculated using `window-text-pixel-size`, which is costly if it needs to be repeated for many lines. Additionally, this calculation becomes obsolete and needs to be redone as soon as the user changes the font size. Or consider the first example again, but this time with non-monospace text: - Test wrapped wrapped Depending on the width of "-" and of the space in the current font, the with of the wrapping prefix should be different. Specified spaces can already measure the width of an image and many other elements. Could they be extended to measure an arbitrary string? Concretely, one would use (:space :width "- ") in the first case and (:space :width "⟝ ") in the second case, and get perfect alignment. This is similar to what LaTeX calls "phantoms": spaces whose width is exactly that of their argument text. Clément.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Subject: bug#40856: Acknowledgement (Feature request: support arbitrary propertized strings in wrap-prefix specifications) Message-ID: <handler.40856.B.158784988129802.ack <at> debbugs.gnu.org> References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> X-Gnu-PR-Message: ack 40856 X-Gnu-PR-Package: emacs Reply-To: 40856 <at> debbugs.gnu.org Date: Sat, 25 Apr 2020 21:25:01 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 40856 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 40856: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D40856 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 26 Apr 2020 15:34:02 +0000 Resent-Message-ID: <handler.40856.B40856.158791520710060 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 40856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Cc: 40856 <at> debbugs.gnu.org Received: via spool by 40856-submit <at> debbugs.gnu.org id=B40856.158791520710060 (code B ref 40856); Sun, 26 Apr 2020 15:34:02 +0000 Received: (at 40856) by debbugs.gnu.org; 26 Apr 2020 15:33:27 +0000 Received: from localhost ([127.0.0.1]:33933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1jSjHb-0002cC-7Z for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 11:33:27 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1jSjHZ-0002bz-Im for 40856 <at> debbugs.gnu.org; Sun, 26 Apr 2020 11:33:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44676) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jSjHU-0000VT-9q; Sun, 26 Apr 2020 11:33:20 -0400 Received: from [176.228.60.248] (port=1198 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1jSjHT-0001F8-Oc; Sun, 26 Apr 2020 11:33:20 -0400 Date: Sun, 26 Apr 2020 18:33:13 +0300 Message-Id: <83sggq5kjq.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> (message from =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel on Sat, 25 Apr 2020 17:24:19 -0400) References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Clément Pit-Claudel <cpitclaudel@HIDDEN> > Date: Sat, 25 Apr 2020 17:24:19 -0400 > > The wrap-prefix property is very convenient, but it's hard to use for alignment when the width of the item to align to is not easy to compute. For example, to get the following effect, it's easy to use 'wrap-prefix " " > > - Test > wrapped > wrapped > > But take a more complex case, like this: > > xyz > ⟝ abc > wrapped > wrapped > > Depending on the font in use, the ⟝ character may be more or less wide. So, the wrap prefix can't just be " " here; it needs to be calculated using `window-text-pixel-size`, which is costly if it needs to be repeated for many lines. Additionally, this calculation becomes obsolete and needs to be redone as soon as the user changes the font size. wrap-prefix can have value that uses :align-to, so I don't see why you'd need to call window-text-pixel-size many times. You could call it once, and then use the result in the subsequent values of prefix. > Specified spaces can already measure the width of an image and many other elements. Could they be extended to measure an arbitrary string? Concretely, one would use (:space :width "- ") in the first case and (:space :width "⟝ ") in the second case, and get perfect alignment. It should be possible to do that, but I'm not sure it will be cheaper than calling window-text-pixel-size or something similar, because (unlike with images) Emacs doesn't have the width already calculated and stashed somewhere, it would need to lay out the string and calculate the resulting pixel width each time it sees such a display spec.
X-Loop: help-debbugs@HIDDEN Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 26 Apr 2020 16:10:01 +0000 Resent-Message-ID: <handler.40856.B40856.158791738113572 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 40856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 40856 <at> debbugs.gnu.org Received: via spool by 40856-submit <at> debbugs.gnu.org id=B40856.158791738113572 (code B ref 40856); Sun, 26 Apr 2020 16:10:01 +0000 Received: (at 40856) by debbugs.gnu.org; 26 Apr 2020 16:09:41 +0000 Received: from localhost ([127.0.0.1]:33996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1jSjqe-0003Wp-Mv for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 12:09:40 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]:46058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <cpitclaudel@HIDDEN>) id 1jSjqd-0003Wc-Eb for 40856 <at> debbugs.gnu.org; Sun, 26 Apr 2020 12:09:39 -0400 Received: by mail-qk1-f173.google.com with SMTP id m67so15533872qke.12 for <40856 <at> debbugs.gnu.org>; Sun, 26 Apr 2020 09:09:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=zlVKwUAmz6s30JIwB2Xq7QS3hxwu/kCV0ESc9I7omFo=; b=VeffxYcZcBbK8PPov+z52+b4plt4qkliWXWtMZ6PSM7hq1PVqv0VMy7QUKbfgGMkhq BYfKkBF7sjkFeTBeoM8tA4CDx+10fIZzMEVHnxc7mY/W3JauhWd1yLh6lH5BA1jsX4JA dzzETbHTmBPEs3wKnsaHEPDyGqKe64XK6ogAGa5aKLDzABDxi4SbMl5Bd0FfplyDJk2K 8duZdpxtA11Px/ABR2xpalg84saagEg6EVdOtJMnrdcEo1IPeeOZANuc4ScQDivYSnmT nWd9CnTDaA4CHCVx3rEIgg+MTa9W2WpCGo0oHyg9w0CTXrKIHpmW3o1aMipcCdHZhc4f jiBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=zlVKwUAmz6s30JIwB2Xq7QS3hxwu/kCV0ESc9I7omFo=; b=hykmNYrJgLsdPW6UPP9JNwQmW5DFq7toX/JsjhrHXQxW+stUegwbDg0mbHPsJ9wF6V mjGQzDZ9kQmtbJ5Mb1avLZth3ycqeigZXk1U9s7ICGIe5UwMI66sfl0iLHinwgsYit6E NDzt3qbYQ2Dfe8TvBFabfXJckzHWxeW8IaYS7e90R2gUykkclzkmjcTccCQXA0LaM1dK PQyukpxwXW2RIYZGeQIyKwmLc0m96uNgTJiz/tt6jmI/PCED1NQGUkelmxGamD2vgWKK toenZcimdR7KjyaF7Rm9FbB54GMhYyx7lWDbSctSkF0w6nChB3FfP4JnzmyD0qyucH7M XV3g== X-Gm-Message-State: AGi0Pua8XWKxFGzNXDs58ynqPkFgNHKsdA7Iadlnz8sS34Ba3lpmgwEQ LwuEty2gUtchLNyPzdBup675CEkG X-Google-Smtp-Source: APiQypJySGfZdBgq2hMPU6TH4+iAUNjQ4GATDePxCY3wQ0mPLR7NT8JzHGqPN6OAuvmLQObqQaIKRQ== X-Received: by 2002:a37:3c2:: with SMTP id 185mr17391177qkd.123.1587917373619; Sun, 26 Apr 2020 09:09:33 -0700 (PDT) Received: from ?IPv6:2601:184:4180:66e7:54d6:bfeb:aa49:9d3b? ([2601:184:4180:66e7:54d6:bfeb:aa49:9d3b]) by smtp.googlemail.com with ESMTPSA id t7sm100730qtr.93.2020.04.26.09.09.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Apr 2020 09:09:33 -0700 (PDT) References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> <83sggq5kjq.fsf@HIDDEN> From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Message-ID: <c348cdf9-7cb8-a526-2e87-0b7f17b9f0ca@HIDDEN> Date: Sun, 26 Apr 2020 12:09:31 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <83sggq5kjq.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 26/04/2020 11.33, Eli Zaretskii wrote: >> From: Clément Pit-Claudel <cpitclaudel@HIDDEN> >> Date: Sat, 25 Apr 2020 17:24:19 -0400 >> >> The wrap-prefix property is very convenient, but it's hard to use for alignment when the width of the item to align to is not easy to compute. For example, to get the following effect, it's easy to use 'wrap-prefix " " >> >> - Test >> wrapped >> wrapped >> >> But take a more complex case, like this: >> >> xyz >> ⟝ abc >> wrapped >> wrapped >> >> Depending on the font in use, the ⟝ character may be more or less wide. So, the wrap prefix can't just be " " here; it needs to be calculated using `window-text-pixel-size`, which is costly if it needs to be repeated for many lines. Additionally, this calculation becomes obsolete and needs to be redone as soon as the user changes the font size. > > wrap-prefix can have value that uses :align-to, so I don't see why > you'd need to call window-text-pixel-size many times. You could call> it once, and then use the result in the subsequent values of prefix. True, if the prefix is the same on every line. But that calculation isn't very robust to changes in font sizes, other face options, and windows. >> Specified spaces can already measure the width of an image and many other elements. Could they be extended to measure an arbitrary string? Concretely, one would use (:space :width "- ") in the first case and (:space :width "⟝ ") in the second case, and get perfect alignment. > > It should be possible to do that, but I'm not sure it will be cheaper > than calling window-text-pixel-size or something similar, because > (unlike with images) Emacs doesn't have the width already calculated > and stashed somewhere, it would need to lay out the string and > calculate the resulting pixel width each time it sees such a display > spec. I think that would be great; the cost should be reasonable, since 1. it only applies to the part of the buffer that is being displayed and 2. it won't be costlier than using the stirng being measured as the wrap prefix. IOW, if we expect that it wouldn't be too costly to use a given string as the wrap-prefix, then it shouldn't be too costly to use a specified space of that width as the wrap prefix. Thanks a lot, Clément.
X-Loop: help-debbugs@HIDDEN Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 26 Apr 2020 17:15:02 +0000 Resent-Message-ID: <handler.40856.B40856.158792128723579 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 40856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Cc: 40856 <at> debbugs.gnu.org Received: via spool by 40856-submit <at> debbugs.gnu.org id=B40856.158792128723579 (code B ref 40856); Sun, 26 Apr 2020 17:15:02 +0000 Received: (at 40856) by debbugs.gnu.org; 26 Apr 2020 17:14:47 +0000 Received: from localhost ([127.0.0.1]:34802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1jSkre-00068E-Nj for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 13:14:46 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52878) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1jSkre-00067w-6P for 40856 <at> debbugs.gnu.org; Sun, 26 Apr 2020 13:14:46 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47348) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1jSkrY-00023r-Tw; Sun, 26 Apr 2020 13:14:40 -0400 Received: from [176.228.60.248] (port=3052 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1jSkkv-0000wh-H2; Sun, 26 Apr 2020 13:07:50 -0400 Date: Sun, 26 Apr 2020 20:07:43 +0300 Message-Id: <83h7x65g68.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> In-Reply-To: <c348cdf9-7cb8-a526-2e87-0b7f17b9f0ca@HIDDEN> (message from =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel on Sun, 26 Apr 2020 12:09:31 -0400) References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> <83sggq5kjq.fsf@HIDDEN> <c348cdf9-7cb8-a526-2e87-0b7f17b9f0ca@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Cc: 40856 <at> debbugs.gnu.org > From: Clément Pit-Claudel <cpitclaudel@HIDDEN> > Date: Sun, 26 Apr 2020 12:09:31 -0400 > > > wrap-prefix can have value that uses :align-to, so I don't see why > > you'd need to call window-text-pixel-size many times. You could call> it once, and then use the result in the subsequent values of prefix. > > True, if the prefix is the same on every line. > But that calculation isn't very robust to changes in font sizes, other face options, and windows. I don't think I follow. :align-to accepts pixel specification, so it should be insensitive to font changes. > > It should be possible to do that, but I'm not sure it will be cheaper > > than calling window-text-pixel-size or something similar, because > > (unlike with images) Emacs doesn't have the width already calculated > > and stashed somewhere, it would need to lay out the string and > > calculate the resulting pixel width each time it sees such a display > > spec. > > I think that would be great; the cost should be reasonable, since 1. it only applies to the part of the buffer that is being displayed and 2. it won't be costlier than using the stirng being measured as the wrap prefix. I don't think your 2. is necessarily correct, because you want the width computed each time the prefix spec is being used to produce glyphs, by which time the string is old history. > IOW, if we expect that it wouldn't be too costly to use a given string as the wrap-prefix, then it shouldn't be too costly to use a specified space of that width as the wrap prefix. I don't think I follow the logic. You intend to use :space in the prefix spec, not the string. So the display engine will have to perform layout of the string and compute its pixel width each time it produces a prefix for another line. The string itself is either not actually displayed, or is displayed on the first line of the paragraph, before all the wrapped lines. It may well be that redisplay needs to produce the display of just some lines, which don't even include the one with the string itself.
X-Loop: help-debbugs@HIDDEN Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Resent-From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 26 Apr 2020 17:24:01 +0000 Resent-Message-ID: <handler.40856.B40856.158792180824528 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 40856 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii <eliz@HIDDEN> Cc: 40856 <at> debbugs.gnu.org Received: via spool by 40856-submit <at> debbugs.gnu.org id=B40856.158792180824528 (code B ref 40856); Sun, 26 Apr 2020 17:24:01 +0000 Received: (at 40856) by debbugs.gnu.org; 26 Apr 2020 17:23:28 +0000 Received: from localhost ([127.0.0.1]:34814 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1jSl04-0006NY-8E for submit <at> debbugs.gnu.org; Sun, 26 Apr 2020 13:23:28 -0400 Received: from mail-qk1-f173.google.com ([209.85.222.173]:33746) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <cpitclaudel@HIDDEN>) id 1jSkzy-0006NH-HR for 40856 <at> debbugs.gnu.org; Sun, 26 Apr 2020 13:23:26 -0400 Received: by mail-qk1-f173.google.com with SMTP id 23so10908283qkf.0 for <40856 <at> debbugs.gnu.org>; Sun, 26 Apr 2020 10:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=npwsxIRJ4pRJNGvn3QAcNOc5xLAyV2GT5F17j6Qm7lk=; b=gP1IiV0A9EXdNyuxcYhAr3gzaOV/dVRO2/YbDLScwqsm697NhNA3/kysJYwmE+lSys qIgzUsA5Eo5RNh5sPV2vSNjLc1a7fjbvg2GK+C8QaV8ZIj5ihyojm6xCevxR/kIOSR1u iJt517iESic5VzjaTrZl+PR50noDWxThimna496icVKgA7+zos7nWn1nNiUUC+MKakRq sdnxOU4/1yv8wHxljw41sGqEcQI1hF9D+6PtODY53acZBH2mBOxK7aUNN/Ewgk3A/3Xx dVzTq9y35hAJhrRFnxuQF+BCEyndipruNFI2JA0StywDVvmOq3HJsdezWTsJl8neCU24 W/bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=npwsxIRJ4pRJNGvn3QAcNOc5xLAyV2GT5F17j6Qm7lk=; b=VLq8LyJO4OmSauagkU9IL7ngxKlFcqe6xF39WCwaj2FX3LKR9CS2Cn/3t1klERvJ5/ m0MZrwzEgpcv+Cd0ERCF2GCgSH6A4StFQOwS7H1ahzPQoMINnFAW7fbREk3oISYrHpO/ bdwPZUKOWsfXw8zCB9AtT3/9hYNXFmppjUPBK7768xPQDyzvqz/DtWcBMs5U6A34GGpL SzeiV3RKrZLu53wT5tGQr9EbHVbccv/nyNTkJnMV+OEJTGY8x+Q/yZixhCcoTIV5ueIp FX7Oa4uK+eiJgYtOy2wjUCIytV1doGdoP/m164T1aRqZ3kOTD6jjfsp++UhBDp1dK/fs 441w== X-Gm-Message-State: AGi0PubnA9MV5ppytej3cp3MEpOyCCPS9V5XstYZPcOzJ0N8uFtcr/1S efY/IMwBJ1cIZfjG0fhDeF1EWWckkaA= X-Google-Smtp-Source: APiQypLP4jiOa66kJSOvsL2cWVMmp5A6h9SSM9Iw+bNxRd5jL0aRdd3+XL3rAzl7FBVDCFsewu+Ltg== X-Received: by 2002:a05:620a:13eb:: with SMTP id h11mr17487098qkl.404.1587921796792; Sun, 26 Apr 2020 10:23:16 -0700 (PDT) Received: from ?IPv6:2601:184:4180:66e7:54d6:bfeb:aa49:9d3b? ([2601:184:4180:66e7:54d6:bfeb:aa49:9d3b]) by smtp.googlemail.com with ESMTPSA id q32sm8609144qta.13.2020.04.26.10.23.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Apr 2020 10:23:16 -0700 (PDT) References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@HIDDEN> <83sggq5kjq.fsf@HIDDEN> <c348cdf9-7cb8-a526-2e87-0b7f17b9f0ca@HIDDEN> <83h7x65g68.fsf@HIDDEN> From: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel <cpitclaudel@HIDDEN> Message-ID: <6e0f2005-2c33-52eb-702a-b945ac1d09ac@HIDDEN> Date: Sun, 26 Apr 2020 13:23:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <83h7x65g68.fsf@HIDDEN> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 26/04/2020 13.07, Eli Zaretskii wrote: >> Cc: 40856 <at> debbugs.gnu.org >> From: Clément Pit-Claudel <cpitclaudel@HIDDEN> >> Date: Sun, 26 Apr 2020 12:09:31 -0400 >> >>> wrap-prefix can have value that uses :align-to, so I don't see why >>> you'd need to call window-text-pixel-size many times. You could call> it once, and then use the result in the subsequent values of prefix. >> >> True, if the prefix is the same on every line. >> But that calculation isn't very robust to changes in font sizes, other face options, and windows. > > I don't think I follow. :align-to accepts pixel specification, so it > should be insensitive to font changes. I typically want to align text relative to a prefix whose length depends on face properties, so if I use window-text-pixel-size, I need to redo the computation every time faces change. >> I think that would be great; the cost should be reasonable, since 1. it only applies to the part of the buffer that is being displayed and 2. it won't be costlier than using the stirng being measured as the wrap prefix. > > I don't think your 2. is necessarily correct, because you want the > width computed each time the prefix spec is being used to produce > glyphs, by which time the string is old history. > >> IOW, if we expect that it wouldn't be too costly to use a given string as the wrap-prefix, then it shouldn't be too costly to use a specified space of that width as the wrap prefix. > > I don't think I follow the logic. You intend to use :space in the > prefix spec, not the string. So the display engine will have to > perform layout of the string and compute its pixel width each time it > produces a prefix for another line. The string itself is either not > actually displayed, or is displayed on the first line of the > paragraph, before all the wrapped lines. It may well be that > redisplay needs to produce the display of just some lines, which don't > even include the one with the string itself. What I meant to say is that if it's cheap enough to draw this: ⟝ bbbbbbbbbbb ⟝ bbbbbbbbbbb ⟝ bbbbbbbbbbb ⟝ bbbbbbbbbbb ⟝ bbbbbbbbbbb (where "⟝" is a wrap-prefix on all lines but the first) … then it should be cheap enough to draw this: ⟝ bbbbbbbbbbb bbbbbbbbbbb bbbbbbbbbbb bbbbbbbbbbb bbbbbbbbbbb where the indentation is a specified space as wide as "⟝". Clément.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.