From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Proportional fonts in the mode line (one month test) Date: Wed, 24 Nov 2021 09:32:01 -0800 Message-ID: References: <87h7c1u0cg.fsf@gnus.org> <9B381C7A-A84D-4585-8D37-6CC8AE6511D1@gmail.com> <87wnkxwl12.fsf@gnus.org> Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.20.0.1.32\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13773"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 24 18:34:48 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 1mpwAS-0003M1-Id for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 18:34:48 +0100 Original-Received: from localhost ([::1]:57596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpwAQ-0004Et-CG for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Nov 2021 12:34:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpw7p-0000v5-Up for emacs-devel@gnu.org; Wed, 24 Nov 2021 12:32:06 -0500 Original-Received: from [2607:f8b0:4864:20::834] (port=33585 helo=mail-qt1-x834.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpw7n-0000oP-Tf for emacs-devel@gnu.org; Wed, 24 Nov 2021 12:32:05 -0500 Original-Received: by mail-qt1-x834.google.com with SMTP id n15so3472055qta.0 for ; Wed, 24 Nov 2021 09:32:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DifC6lnm9xTykcViecNPv1MJw1GHy643+nMZbYVb/uE=; b=L8I5/8E5ORVfZdH5m6GcXaCB0x62Wg5Z7KkDgeW5RcxITK/NILgY3+j3c2NRIUfstk 7FOdxtovuW2Wx2gc7Kt/ylq1uCLVxrj3MwLH4eLCNU7Tbqq/TIwt1LooA3mRar+1RwGq ZAiXf/G5KLUTQ4eTOAl3rB/C6BiU89XIm3EvCH/D/FlMU1VaFc/ThGFb2LAfJnMF5/2y BHROfhl1KBABOTaB7Ej8UlGZNoJomozuV9Tvof9kCJHKZ74fMP6Mk/DM5c5ZY3kTCixY kO90TZ2rx/L1FJ+Svlgu6aqMPeXlIGWD+JdGW4USsTCSItT878kzGHtpSdYz6R1dXglF H66A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=DifC6lnm9xTykcViecNPv1MJw1GHy643+nMZbYVb/uE=; b=VXsxX6K6bty279mVp8z/8uXnYbcz65kDT6hfeFjm2VthhMXvLv06bej1yrbWjl/W// DSkf35cMRK4IcRFhuVaObIGKFv7VAbdr4DL3wOsnrXrmEZWYJbOMffdCOKBAC4RFiOuC MBygXubTmYIP3TNVNdrMJric57kc7knI3Wik3S1eXcPegmH+vXu55zxeN/e8wechSc4K pxOM5bRUS7zlJ268+d0D55bV93GqzzymiMjh2jF21eZ4Ais76qqR65sU7qYkPCjKqRiE c6EIh0xi6HoRyOtQVTBYHAL/7SX1jwT4Plsfj12B6/UWaZt+BaZQHeG6RkiQXIsS6rS/ fURQ== X-Gm-Message-State: AOAM532KFKuk1o/FkNBQio2dSm+UO4Rri19UFYbCDWpApSqvvaLOj8Ep Jq1haErw14KBDcNNQNn2FZM= X-Google-Smtp-Source: ABdhPJxeXY1jdItbXAFRfBT5kBCBm4FgYhSlXGdc9a24zwrm4wN4RZXPYnMenMgLdw9ApIzC3AcH9g== X-Received: by 2002:ac8:59c9:: with SMTP id f9mr520947qtf.581.1637775122893; Wed, 24 Nov 2021 09:32:02 -0800 (PST) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:1567:ff0f:8ef5:fc6d]) by smtp.gmail.com with ESMTPSA id i6sm201183qti.40.2021.11.24.09.32.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Nov 2021 09:32:02 -0800 (PST) In-Reply-To: <87wnkxwl12.fsf@gnus.org> X-Mailer: Apple Mail (2.3693.20.0.1.32) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::834 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=casouri@gmail.com; helo=mail-qt1-x834.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=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.29 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:280029 Archived-At: > On Nov 24, 2021, at 8:55 AM, Lars Ingebrigtsen wrote: >=20 > Yuan Fu writes: >=20 >> The only complication is that with proportional font, >> there is no nontrivial way to right-align some text: In fixed-width >> environment, you just pad enough spaces, but in proportional >> environment, you have to pad (space :align-to (- (+ right >> right-margin) (PIXEL_WIDTH))) where PIXEL_WIDTH =3D pixel width of = the >> stuff on right. >=20 > Yes, I guess right-aligning text on the mode line is pretty hard = (unless > you switch to l2r on the mode line)? >=20 >> And there is no easy way to calculate the pixel width >> of a piece of text. >=20 > There's `string-pixel-width' in Emacs 29 now, and it actually works = now > (after Martin's fix yesterdayish =F0=9F=98=84). Fantastic! I pulled the master and it works really well. I remember = trying window-text-pixel-size but had some problem with it, I guess = Martin fixed that :-D (defun luna-mode-line-with-padding (text) "Return TEXT with padding on the left. The padding pushes TEXT to the right edge of the mode-line." (let* ((len (string-pixel-width text)) (padding (propertize "-" 'display `(space :align-to (- (+ right right-margin) (,len)))))) (concat padding text))) Yuan=