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.help Subject: Re: Operation of format-mode-line Date: Sat, 27 Jul 2024 09:01:02 +0300 Message-ID: <86frrv2x29.fsf@gnu.org> References: <87frrxjpx8.fsf@web.de> <87ttgco01g.fsf@web.de> <875xss2siz.fsf@web.de> <_01tHilZxepAwWZA2gcrpDUtHoVEW2HZsloVV432KbtYCSGgtnpgjju0nPyLvUaoqaVld3sid3SAWzx3IZM6BOYkN59GQEl81KFPoVUlszI=@protonmail.com> <87ed7f28wy.fsf@web.de> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13544"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 27 08:01:50 2024 Return-path: Envelope-to: geh-help-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 1sXaV4-0003P1-Br for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 27 Jul 2024 08:01:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXaUW-0001KF-F6; Sat, 27 Jul 2024 02:01:16 -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 1sXaUO-0001Jj-Bh for help-gnu-emacs@gnu.org; Sat, 27 Jul 2024 02:01:08 -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 1sXaUN-0001Cj-6T for help-gnu-emacs@gnu.org; Sat, 27 Jul 2024 02:01:07 -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=PX85M6zJQw/TxL/dJXdkkRRydD/xfpvRnETthBGYgl0=; b=JHvQr4H6N2TT /OMh0K4RoWRWws0IMB30uneY31O1BXzNaY4NhxHOWO4hBfkDzlkbU9hvm6ADI+qaL/ldSv/yCRjhD SmzkD5Hf+l719CnrNc8mEwrpQfzP7c3JpisX1iws50WjxrHTFLN+5fNLOcCOpk8/VESef7LYXeWyJ wloEOLZEzaDHNP3Q3SBH6fbehdw+BysU3QUDKIvptMXbRfO3eB2lCmGBWyshkj0J9HBQpqwCtyG+e FWjO7XWRFAMBfegomZOidrYM18sxA1IGhBMD8QKQ+9n73kD7cKrkHPrI2iPvHPzctcJcs8bYcrVnv MReVi8NvST3vKEfbw0EFFQ==; In-Reply-To: <87ed7f28wy.fsf@web.de> (message from Michael Heerdegen via Users list for the GNU Emacs text editor on Fri, 26 Jul 2024 22:30:21 +0200) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147392 Archived-At: > Date: Fri, 26 Jul 2024 22:30:21 +0200 > From: Michael Heerdegen via Users list for the GNU Emacs text editor > > > (setq-default mode-line-buffer-identification > > (propertized-buffer-identification > > (format " %s " > > (let ( (name (buffer-name)) ) > > (if (> (length name) wmax) > > (concat (substring name 0 (- wmax 3)) "...") > > name))))) ) > > This is expected: the display engine doesn't switch buffers when drawing > mode-lines all the time. With other words: In the above context the > return value of `buffer-name' does not always correspond to the buffer > of the window whose mode-line gets computed. IOW, instead of (buffer-name), one should probably use something like (buffer-name (window-buffer))