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#74817: 31.0.50; mode-line-format-right-align doesn't work well on header-line Date: Sat, 28 Dec 2024 13:32:59 +0200 Message-ID: <86a5cgt53o.fsf@gnu.org> References: <87ikrp42as.fsf@Mufasa.mail-host-address-is-not-set> <86ikrmv8jf.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22432"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74817-done@debbugs.gnu.org, execvy@gmail.com To: Ship Mints Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 28 12:34:23 2024 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 1tRV5L-0005gu-8I for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Dec 2024 12:34:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRV53-0003DJ-DP; Sat, 28 Dec 2024 06:34:05 -0500 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 1tRV51-0003Cq-6M for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:34:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRV50-00088m-St for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:34:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=LPHTLeLEFxSwZmO4k3dR37+gyqFQAxBiTpJ9sXZ/Ers=; b=NFU/N7MYK5BeOWJ7r6M5pLBNs3iPPHR0rSSgLyCwNfKNKqQ7pILoJ0KbpDUc0Wq/W6ngVOIiV9nk8KlXAEIEedDfUtLdq1UUH0tGer4wRnQVVZCZiTNEh5vwXlev7biRG0/TAWM7fHnoVutbKEX/lwAKAUssc+rAKu4/i8HmXZy6zffc0u2XVT569fkubVRb5geoekPSrbGnn9DBAH8M1lrvmaauDgv4pFXiJAWldPVCpLiYHxAoDfLFNk5n0imsQtbldh4ThZy2AuTD8PkIpQDAUz38Wud7b53ZRjthuPJqfObTZ9tOokmstTTqWO4YxOmYQtKa9wL3TTg28E7DJw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRV50-0008Bd-NP for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 06:34:02 -0500 Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2024 11:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 74817 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug wontfix Mail-Followup-To: 74817@debbugs.gnu.org, eliz@gnu.org, execvy@gmail.com Original-Received: via spool by 74817-done@debbugs.gnu.org id=D74817.173538558831383 (code D ref 74817); Sat, 28 Dec 2024 11:34:02 +0000 Original-Received: (at 74817-done) by debbugs.gnu.org; 28 Dec 2024 11:33:08 +0000 Original-Received: from localhost ([127.0.0.1]:49474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRV48-0008A7-6c for submit@debbugs.gnu.org; Sat, 28 Dec 2024 06:33:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRV46-00089A-TL for 74817-done@debbugs.gnu.org; Sat, 28 Dec 2024 06:33:07 -0500 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 1tRV41-00082b-Le; Sat, 28 Dec 2024 06:33:01 -0500 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=LPHTLeLEFxSwZmO4k3dR37+gyqFQAxBiTpJ9sXZ/Ers=; b=T/beYt6Dnp7O RmdrXfj4B0IX3YFrAiTdUUMYbT11PKkYYjkrihBw1Qal/O4jhgvaiaphNwAc5QSDKQpOwgrGsPkKT Mno1R1ai+but+ohIR9M+QTM2cDDOCywqcyCpQhoVvFQUJOcQx7ayjuZM3oYSX0lbyjbVWHxdN+1t8 dckSEqXep+oOUFZAn2wL3FKkBcl1a7IQ9QckbmOp5bBVlt2lvsLjkMdaweBbyp6xhcFd0ME57u/5L QexhAbl+S8DYpwvj2QrTK+cHM6DNRX4KTUQo/5Vv9WsGDbm2OBk3Imhd9LQ/uG84zzs9j3TRtswVH xzjRiZaJ0o0GNPFcjii4bQ==; In-Reply-To: (message from Ship Mints on Sun, 15 Dec 2024 15:25:19 -0500) 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:297883 Archived-At: > From: Ship Mints > Date: Sun, 15 Dec 2024 15:25:19 -0500 > Cc: Eval Exec , 74817@debbugs.gnu.org > > To emulate the desired behavior, I lifted this from tab-bar's implementation for a proof-of-concept. > > (defun header-line-format-align-right () > "Align the rest of `header-line' items to the right." > (let* ((rest (cdr (member '(:eval (header-line-format-align-right)) header-line-format))) > (rest (tab-bar-format-list rest)) ; replace tab-bar-format-list with your own beyond this POC > (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) > (hpos (progn > (add-face-text-property 0 (length rest) 'header-line t rest) > (string-pixel-width rest))) > (str (propertize " " 'display > ;; The `right' spec doesn't work on TTY frames > ;; when windows are split horizontally (bug#59620) > (if (window-system) > `(space :align-to (- right (,hpos))) > `(space :align-to (,(- (frame-inner-width) hpos))))))) > `((align-right menu-item ,str ignore)))) > > (setq header-line-format '("TEST HEADER LINE" (:eval (header-line-format-align-right)) (lambda () "FOO > BAR BAZ"))) > > One gotcha is that tab-bar-format-list relies on "rest" being a list of functions, hence the lambda at the end. > > Adapt as you see fit. No further comments in 2 weeks, so I'm now closing this bug.