From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#52129: 29.0.50; Wish: Extend `:align-to center' to work on lines in buffer Date: Sat, 27 Nov 2021 12:06:19 +0100 Message-ID: References: <83o86616m2.fsf@gnu.org> <834k7y0xjv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20089"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 52129@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 27 12:07:24 2021 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 1mqvYA-00050O-2L for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Nov 2021 12:07:23 +0100 Original-Received: from localhost ([::1]:47320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mqvY8-0002h6-NA for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Nov 2021 06:07:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54732) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mqvXr-0002ey-29 for bug-gnu-emacs@gnu.org; Sat, 27 Nov 2021 06:07:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mqvXq-00034L-PG for bug-gnu-emacs@gnu.org; Sat, 27 Nov 2021 06:07:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mqvXq-000654-I4 for bug-gnu-emacs@gnu.org; Sat, 27 Nov 2021 06:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Nov 2021 11:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52129 X-GNU-PR-Package: emacs Original-Received: via spool by 52129-submit@debbugs.gnu.org id=B52129.163801118823328 (code B ref 52129); Sat, 27 Nov 2021 11:07:02 +0000 Original-Received: (at 52129) by debbugs.gnu.org; 27 Nov 2021 11:06:28 +0000 Original-Received: from localhost ([127.0.0.1]:33038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqvXI-00064C-CD for submit@debbugs.gnu.org; Sat, 27 Nov 2021 06:06:28 -0500 Original-Received: from mail-db8eur05olkn2059.outbound.protection.outlook.com ([40.92.89.59]:14977 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mqvXG-000641-PS for 52129@debbugs.gnu.org; Sat, 27 Nov 2021 06:06:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLhfarJp73crcizSuQcNTbjEI9R9s7yrR72117QUbRUKBWx2URsAigH29wReHBoHp9YrGSGoUt87F0/7hPmm/hYx9sAe2eVKeSNMKb+6ioNd8WllYB2irrIKKQDGMurk1H+OVs/ohEM3/aXFYXqbKcNS/ES2LoqxtB6FsKVeovW1VPJ8FUxsLlHHM92smBUb00lGilP5H+dsb67hqag6uz6LqrhrMpj6i4y7vqBbk7p5+rGP9GnL9DEyeAwVnMFGxSTJe0XkFr9XksoNjPgsdfDsCzhjV77b1+UbiJiTjY8unw3qcA6H7nIaeftzOdUsNr57YBfjGRhW4XhYTVHO9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uEyq6UDvqJiwEF74ForwWpNZrvackSeazKuOvnPf6aQ=; b=h/56m1CG+n6XiKZ+02L4hrqrMZxYJOXtsycI5JjgB4TQtsZG5f1ZNhNBaaG7hciSDL8r6qSxw4AHXqCT9IBmzss4mo3nng2reH+eebrEp7fVPJggDk9vK9l5TAIf/MQoUXLJUVy53rKN9qBqtw9mBWBWD2X8lUhGxf7bGXdk0SZuDXuR2wnTBRTvqi8IXJS0ef23uvZ6IGXE6XIxS5jqrlXd0Ly4n+xe5HqmfR6/BlmHTwnjS1zn6hjfm0CLZyap5RhbtFtC9tPEAqOeuSPZ9NWyeNIZfjj2HjUe/CuVFRYfjtLNCdv7xWimdkn/YPaLdkuIuf8aHDGL8zesK3eUOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uEyq6UDvqJiwEF74ForwWpNZrvackSeazKuOvnPf6aQ=; b=o8IK4sBHSDtCEweoMkUF//7ZhI59RREXX+tAS1wiz40N442pYXjf/XwoHSWKJeB/OWwbj8Q4jUYD6vT9SYsZJZSgbxNondGmbbjlvX7uCSq3abYwwujlTTwbH7JVxmwew7xTPcmcxyMxoUknXTTbkBFVPSw/HVxBmLow+eWqWLSt+7M9XVY3CoNe6uNlLjUoMiE4XQpPesrts8NUdsR2dzy3gwhXGXeWpDMm4l9eI547nVxCsyvoOt+oXnDuhrivHMh8samfKgbedJcR15GrnppMdBd5nI/4Mk+yb5cno87JOp4JISt7VwTsX+Annxx+PK3MgVOpVn5ee/tF+0zzsQ== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by AM0PR09MB2705.eurprd09.prod.outlook.com (2603:10a6:208:127::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.23; Sat, 27 Nov 2021 11:06:19 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c05b:e2ca:5b8a:56d2%9]) with mapi id 15.20.4734.023; Sat, 27 Nov 2021 11:06:19 +0000 In-Reply-To: <834k7y0xjv.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Nov 2021 04:15:12 -0500") X-TMN: [70xQM0qef6cKkN4uiWl2pMQHo4OuMh8N] X-ClientProxiedBy: AS9PR06CA0221.eurprd06.prod.outlook.com (2603:10a6:20b:45e::6) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87ilwdsvro.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AS9PR06CA0221.eurprd06.prod.outlook.com (2603:10a6:20b:45e::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.20 via Frontend Transport; Sat, 27 Nov 2021 11:06:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4da82e2d-323d-4e59-af1f-08d9b195f0b3 X-MS-TrafficTypeDiagnostic: AM0PR09MB2705: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: md2KhqyA7FMXnD/5NPbijtrD/soJ2+rBjZDaATMFLXd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lsw7D6+I1aw8Qt18cyi/6hYd1xsoGCaTkxrMhkA9+9b7GfFQVo4YDTv8ConZohTSmsgMOp8Fnbw+OkAWTuSwxNjPngnT5JCI9u2Ojupr2Dl9BsEt6k6qb5jSyRcBCFY9IlhfvCy0loUW76RFBFKvT4tG2pzwtG7ay5cMJoRFfcWlktsdP8F7eGuVZCrqH4x8WD7eVY1mJm+EevBKEQzLBl+nsSzo9Q+4gVQh8Hjl5GV3OKY9ISw0YMlQpdbe3c8RO/ORObjKAHGgCNaGXnzCgNn9HNyh66Pcj sLXVbhZmLdAEuVCB3CTi+MKISi6Odt8U08RZSYqV+1IHW9cxvixdydtFj1k1uafucUuRI3udJ9NXKLXQlkwRZFgl1v1KHt9Qv1 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-72e6e.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 4da82e2d-323d-4e59-af1f-08d9b195f0b3 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2021 11:06:19.9173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2705 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:220899 Archived-At: Eli Zaretskii writes: >> From: Arthur Miller >> Cc: 52129@debbugs.gnu.org >> Date: Sat, 27 Nov 2021 09:47:58 +0100 >> >> Eli Zaretskii writes: >> >> > I don't understand what exactly are you asking for. Is your problem >> > that you have to prepend some character to the string and put the >> > :align-to spec on that character? Because AFAIU that simple measure >> > should achieve your goal. >> >> You mean something like this: >> >> #+begin_src emacs-lisp >> (defun evc--time () >> (propertize >> (time-stamp-string " %H:%M") 'face evc--time-face 'display '(space :align-to center))) >> >> (defun evc--date () >> (propertize >> (concat >> " " >> (capitalize (time-stamp-string "%A")) ". " >> (capitalize (time-stamp-string "%B %d"))) 'face evc--date-face 'display '(space :align-to center))) > > No, I mean to put this property: > > 'display '(space :align-to center) > > on a space character (or any other character, which will not be > displayed) that is prepended to the time-stamp-string you want to > display. Aha, like this?: (defun evc--time () (concat (propertize " " 'display '(space :align-to center)) (propertize (time-stamp-string " %H:%M") 'face evc--time-face))) That still seems to be dependanble on when the time string is inserted? Because when I test to insert like this: (defun evc--update () (let ((time (evc--time)) (date (evc--date))) (when (frame-live-p evc--frame) (select-frame evc--frame)) (with-current-buffer evc--buffer (erase-buffer) (insert time "\n" date) (goto-char 1)))) the string is not centered correctly; there is ~70 pixels difference between left and right margins. Maybe if I inserted longer string first, fitted frame to buffer, and than inserted time, but I don't think it is relevant if you say it is not possible to do it due to renderer only looking at one char at a time. > Because the Emacs display code examines buffer text one character at a > time, left to right, and produces the glyphs for display for each > character before it goes to the next. You are asking the display > engine to know the display width of your string before it performs the > layout calculations for that string, and that cannot work. The > display code cannot even assume that it will traverse all the > characters of a line, it could be forced to stop before it reaches the > end of the line, in which case it cannot know that width even > post-factum. > >> Also what if the text is longer then visual line? Would it be possible for the >> rendering engine to center part of the tring with 'aligne-to center' property, >> and cull extensive part on sides that are outside. That is not acheavable with a spacer. > > You want the display engine to decide where to break such a long line? > Or do you want to decide that up front and indicate that via the > portion of the text on which you put this hypothetical property? IOW, Meant mostly that display engine would keep marked portion of the string centered on the display, for example if there is some more important of the string or so, but at the second thought I don't see much use of such feature. Anyway, I understand now when you say that renderer only looks at one char at a time. Is there any way to make it aware of surrounding context, like entire line? Or would that be too demanding computationally? I guess there is a reason why it is made one char at a time.