From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#40856: Feature request: support arbitrary propertized strings in wrap-prefix specifications Date: Sun, 26 Apr 2020 18:33:13 +0300 Message-ID: <83sggq5kjq.fsf@gnu.org> References: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="93847"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40856@debbugs.gnu.org To: =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 26 17:34:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jSjIK-000OJd-DK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 17:34:12 +0200 Original-Received: from localhost ([::1]:33458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSjIJ-0002Yt-E5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Apr 2020 11:34:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37444) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSjIB-0002YA-8o for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 11:34:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jSjIA-000374-TC for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 11:34:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jSjIA-00036y-HE for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 11:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jSjIA-0002dK-FF for bug-gnu-emacs@gnu.org; Sun, 26 Apr 2020 11:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Apr 2020 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40856 X-GNU-PR-Package: emacs Original-Received: via spool by 40856-submit@debbugs.gnu.org id=B40856.158791520710060 (code B ref 40856); Sun, 26 Apr 2020 15:34:02 +0000 Original-Received: (at 40856) by debbugs.gnu.org; 26 Apr 2020 15:33:27 +0000 Original-Received: from localhost ([127.0.0.1]:33933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSjHb-0002cC-7Z for submit@debbugs.gnu.org; Sun, 26 Apr 2020 11:33:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jSjHZ-0002bz-Im for 40856@debbugs.gnu.org; Sun, 26 Apr 2020 11:33:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44676) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jSjHU-0000VT-9q; Sun, 26 Apr 2020 11:33:20 -0400 Original-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 ) id 1jSjHT-0001F8-Oc; Sun, 26 Apr 2020 11:33:20 -0400 In-Reply-To: <30e6aa63-d0f9-d548-3fb9-959f16571b3d@gmail.com> (message from =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel on Sat, 25 Apr 2020 17:24:19 -0400) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:179078 Archived-At: > From: Clément Pit-Claudel > 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.