From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Paul W. Rankin" via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: Horizontal centering in the display engine Date: Thu, 15 Apr 2021 15:13:43 +1000 Message-ID: <66A8ED9D-F4C1-4DC0-9D8D-7EB82EA82DF4@bydasein.com> Reply-To: "Paul W. Rankin" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.7\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14182"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , emacs-devel@gnu.org To: sbaugh@catern.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 15 07:15:08 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lWuLM-0003bL-BE for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Apr 2021 07:15:08 +0200 Original-Received: from localhost ([::1]:41374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lWuLL-0002PZ-CG for ged-emacs-devel@m.gmane-mx.org; Thu, 15 Apr 2021 01:15:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37186) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWuKO-0001xN-Kd for emacs-devel@gnu.org; Thu, 15 Apr 2021 01:14:08 -0400 Original-Received: from sendmail.purelymail.com ([34.202.193.197]:50490) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lWuKN-0005og-89 for emacs-devel@gnu.org; Thu, 15 Apr 2021 01:14:08 -0400 DKIM-Signature: a=rsa-sha256; b=RVsosFgy4/F2b+4YTnPjDHXiPUrkWGSugLT4mBC6/e7G1k6lRf3fkmMURhdlEEaUJycIj5etfqAu0nRY5dGncAwzHJLqb3TknbHf0So/WTgF4oJJWglXdjhi0bn9gGf5zSBWHqSttqG+JGFdVhCZMbW9T+DwStnDQ28NWF77SPinR6xUYFEgfT7FgxH6vYDd9kD0srY4i3BOP7QgXNS1QhtdR6SR07o+zjou497Gg4UbeZElOFskUsj2FdBquKfoGCMNWqlBEm3kEtR6PUDdNtpW+zIyxmyFc3CJM/eM4emw9cZlo0D44sVNZvMfHKXoi//45AFs3Q2iX2MYrUz3cw==; s=purelymail2; d=bydasein.com; v=1; bh=dTqEGOaoFSPH2jv6P9bcr2kaTgi0VsuU1f5n+uKD9So=; h=Received:From:To; DKIM-Signature: a=rsa-sha256; b=qRDUETnfH8W0+d0Q9TLZbDmbuYwsuv4huUQZMXsFQPLHoPwpNeKXpxaF/HdQXj/efKjM8VlLfzwMZnZRU6pwPAj7t7b3K12bvdfGdjHFpBCTwqlRJXb/fJ44IvFs/fy/OkFEC5qz3DC5wV+cY4DVUwRA4V0MbAcHfQw3vODVe4JWaZ2u6IE2j4z6Z7FQ/khCKueN0AuNOjS+dU5AB/wdYqVj3jFEq2eG67RlQuFqv6CjainONdEpem6LYhwfEkgTwaLNCkcmXRdlfLbOxqkiCUWY1XqGXSYOilA4AKKc3KPNFJdkBh43G1q4XAzJysstfzSQA5mJV0oJBwvgcsbtiQ==; s=purelymail2; d=purelymail.com; v=1; bh=dTqEGOaoFSPH2jv6P9bcr2kaTgi0VsuU1f5n+uKD9So=; h=Feedback-ID:Received:From:To; Feedback-ID: 791:353:null:purelymail X-Pm-Original-To: emacs-devel@gnu.org Original-Received: by ip-172-30-0-124.ec2.internal (JAMES SMTP Server ) with ESMTPA ID 303055508; Thu, 15 Apr 2021 05:13:49 +0000 (UTC) X-Mailer: Apple Mail (2.3445.9.7) Received-SPF: pass client-ip=34.202.193.197; envelope-from=pwr@bydasein.com; helo=sendmail.purelymail.com X-Spam_score_int: 7 X-Spam_score: 0.7 X-Spam_bar: / X-Spam_report: (0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FAKE_REPLY_B=2.784, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:268074 Archived-At: > From: sbaugh@catern.com > Date: Wed, 14 Apr 2021 11:25:41 -0400 > > Yes, that makes sense. So I'm asking about how difficult it would be = to > add a new element to the :align-to expression language, one which > specifies the width of the current line. I apologise in advance if I've misunderstood your aims, but you can use = the line-prefix text property and compute the value of :align-to based on = the line width and the window text width: (defun center-align-line () (let (line-width align-col) (setq line-width (- (line-end-position) (line-beginning-position))) (setq align-col (/ (- (window-body-width) line-width) 2)) (put-text-property (line-beginning-position) (line-end-position) 'line-prefix `(space :align-to ,align-col)))) Achieving this dynamically is dependent upon your major mode; if you're = using a markup syntax, you could use font-lock and a regular expression, or if = manually applied you could use a text property flag.=