From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62606: [PATCH] function to align mode-line elements to right Date: Tue, 06 Jun 2023 14:24:11 +0300 Message-ID: <83zg5c3kbo.fsf@gnu.org> References: <83355iygw3.fsf@gnu.org> <83mt2hfrr4.fsf@gnu.org> <4b872ecc12e3995d5b7dfffa580e297d@heagren.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23209"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62606@debbugs.gnu.org To: hugo@heagren.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 06 13:25:13 2023 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 1q6UoK-0005su-Qv for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Jun 2023 13:25:12 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6UoB-0000j4-BR; Tue, 06 Jun 2023 07:25:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6UoA-0000iw-CL for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q6UoA-00041T-3n for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:25:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q6Uo9-0004eK-Vk for bug-gnu-emacs@gnu.org; Tue, 06 Jun 2023 07:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Jun 2023 11:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62606 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 62606-submit@debbugs.gnu.org id=B62606.168605067717833 (code B ref 62606); Tue, 06 Jun 2023 11:25:01 +0000 Original-Received: (at 62606) by debbugs.gnu.org; 6 Jun 2023 11:24:37 +0000 Original-Received: from localhost ([127.0.0.1]:51069 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6Unl-0004dZ-4C for submit@debbugs.gnu.org; Tue, 06 Jun 2023 07:24:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q6UnZ-0004d8-ET for 62606@debbugs.gnu.org; Tue, 06 Jun 2023 07:24:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6UnT-0003qF-Fk; Tue, 06 Jun 2023 07:24:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=96+PC7Tupxs02lhb/JXWm+i0tWQKRe9qx9BMIgWrQIg=; b=cgM4zs+vbC9U IlUHpgP0jXF9wF/ghH65G4fhR9gxWxEYk+pWVt721cpfpebRpmMEg72SKlVY+kiL0Sm/yyOXBOYs+ zAYlToP9RcplGJvvE10v4lY0miuVOgDB9WL5nVRjpgR/pQZW4TJzj9akN7yHgGRsLuduu8o1GlgLD 6B+tcAoXgj88Ug4N094/y/rvqPombLjd7VLPck3f5Q9Kb7/YyGZv2epYKYghFroueMAxCEcYpCVaU HLlgQUIS23KvYfPvJa1rbaXgoTBM+Q5VOGJyja9xVee/z8Y9r277F9BgpOiOKLqcWGKB5lXzFIxTI dBmpOVeXL4blj8+vSzWB0g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6UnN-000880-Fk; Tue, 06 Jun 2023 07:24:19 -0400 In-Reply-To: <4b872ecc12e3995d5b7dfffa580e297d@heagren.com> (hugo@heagren.com) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263048 Archived-At: > Date: Mon, 05 Jun 2023 21:45:17 +0100 > From: hugo@heagren.com > Cc: 62606@debbugs.gnu.org > > On 2023-05-06 15:39, Eli Zaretskii wrote: > > > > One possible issue with right alignment is that when the total size of > > > > the mode-line text changes (e.g., the mode lighter changes), the > > > > leftmost part of it will move horizontally, something that could be > > > > unpleasant and even annoying. > > > > > > This doesn't happen with my proposed setup (though I agree it would be > > > annoying if it did!). The user includes the symbol > > > `mode-line-format-right-align' in their mode line format. This is a > > > variable which holds a mode-line construct `(:> eval > > > (mode-line-format-right-align))'. So whenever the mode-line is reloaded > > > (and therefore, whenever the length could change), the space used to pad > > > the right-aligned part to the right is recalculated. > > > > That recalculation is what I alluded to: the space will be different > > depending on the size of the mode-line text. > > I confess I am very confused. Let's say we have a modeline like this, > with parts L (left-aligned), M (middle - displays as empty space) and R > (right-aligned): > > |--L--|-------M-------|-R-| > Foo bar X > > If L gets longer then: > - M will get shorter > - R will stay the same > > So we get: > |--L-----|----M-------|-R-| > Foo barrrr X > > Is this what you're worried about? If so, I don't think it's much of a > cause for concern. No, I was talking about the case where the R part becomes longer. > I modelled my function on > `tab-bar-format-align-right', which works in a very similar way. IMNSHO, that mopdel is not the ideal one. > It also > strikes me that something like this happens anyway already: if we have a > mode-line with just a left-aligned lighter, and the lighter gets longer > (or > shorter), then the space between the end of the lighter and the edge of > the screen (i.e. M+R) gets smaller (or bigger). Isn't this to be > expected? Yes. But with left alignment the beginning of the text never moves, only the end. With right alignment, the beginning moves. It's jarring, IMO.