From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: hugo@heagren.com Newsgroups: gmane.emacs.bugs Subject: bug#62606: [PATCH] function to align mode-line elements to right Date: Sat, 01 Apr 2023 23:27:31 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=_24881bbfb92ffd7312e7ba18a498982a" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34154"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Roundcube Webmail/1.5.2 To: 62606@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 02 06:48:46 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 1pipe2-0008bU-21 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 02 Apr 2023 06:48:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pipdi-0002Oi-8p; Sun, 02 Apr 2023 00:48:26 -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 1pipdM-0002MA-Py for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 00:48:10 -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 1pipdL-0003Oh-HY for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 00:48:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pipdL-0007ql-Dg for bug-gnu-emacs@gnu.org; Sun, 02 Apr 2023 00:48:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: hugo@heagren.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 02 Apr 2023 04:48:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62606 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168041086330010 (code B ref -1); Sun, 02 Apr 2023 04:48:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Apr 2023 04:47:43 +0000 Original-Received: from localhost ([127.0.0.1]:38829 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pipd0-0007ns-IA for submit@debbugs.gnu.org; Sun, 02 Apr 2023 00:47:43 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49992) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pijhp-0003Nm-8I for submit@debbugs.gnu.org; Sat, 01 Apr 2023 18:28:17 -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 1pijho-00033e-Ml for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 18:28:16 -0400 Original-Received: from whuk14.whukhost.com ([5.77.41.174]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pijhm-0002m3-Ji for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 18:28:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=heagren.com ; s=default; h=Content-Type:Message-ID:Subject:To:From:Date:MIME-Version: Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0yszpcTSwM+XHSMKg+uZuGQ0iqm9tCkDCcSOFqXMoHk=; b=wCpMzHkrd5T/vfrYSqo60piJfS WYMkbLsbFQMxBvpZL/m1uQSRmlKApqz4YccZH7f2HUBcsVotbc90s05bWS+wpV5tvUcl6Uk54kJET ejtmVjfUnDnh9btf/tqXbn8eU10foh1QcKjIf0DB6hlvG10DkonXrjG1gbthhlb2L4s82dMZLbSWF WF9embtXkw3s234wz6TdvAiKUuMNsHx7hQOZeVQXmkLDFMmena2Vo1ihXtXG9K72ozMwXVJI/F8nt H1Mkheb6d8g8Xgf3nEI9DAchddc81Cz1iddKX48S4RmqLMcn/SAj0UsFOmIFG4Oof+XZ6I5AQI9NH fTs/E32Q==; Original-Received: from [::1] (port=37808 helo=whuk14.whukhost.com) by whuk14.whukhost.com with esmtpa (Exim 4.96) (envelope-from ) id 1pijh4-00GvcD-1w for bug-gnu-emacs@gnu.org; Sat, 01 Apr 2023 23:27:31 +0100 X-Sender: hugo@heagren.com X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - whuk14.whukhost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - heagren.com X-Get-Message-Sender-Via: whuk14.whukhost.com: authenticated_id: hugo@heagren.com X-Authenticated-Sender: whuk14.whukhost.com: hugo@heagren.com Received-SPF: pass client-ip=5.77.41.174; envelope-from=hugo@heagren.com; helo=whuk14.whukhost.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 02 Apr 2023 00:47:38 -0400 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:259084 Archived-At: --=_24881bbfb92ffd7312e7ba18a498982a Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed I wanted to be able to right-align some elements of the mode-line. I used `tab-bar-format-align-right' as a base and modified it to work with the mode-line. The functin aligns to the right /fringe/ rather than the margin because some modes (e.g. [visual-fill-column-mode]) mess around the margin size, but the right-align should be unaffected by this. Patch attached. I want to know that the code is good before I do NEWS and docs etc. Obviously it would be useful to document this in info (elisp) Mode Line Variables and maybe in the `mode-line-format' docstring. Blue skies, Hugo [visual-fill-column-mode] --=_24881bbfb92ffd7312e7ba18a498982a Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=0001-Support-right-align-in-mode-line.patch Content-Disposition: attachment; filename=0001-Support-right-align-in-mode-line.patch; size=2418 RnJvbSAxOTRlYWQzNzE5M2ExMzQwNDBhYzNmOTA3MTk5Y2JhZTIwNTdlZmJiIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBIdWdvIEhlYWdyZW4gPGh1Z29AaGVhZ3Jlbi5jb20+CkRhdGU6 IFNhdCwgMSBBcHIgMjAyMyAyMjoyNzoyNSArMDEwMApTdWJqZWN0OiBbUEFUQ0hdIFN1cHBvcnQg cm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