From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Re: Operation of format-mode-line Date: Fri, 26 Jul 2024 17:32:05 +0000 Message-ID: <_01tHilZxepAwWZA2gcrpDUtHoVEW2HZsloVV432KbtYCSGgtnpgjju0nPyLvUaoqaVld3sid3SAWzx3IZM6BOYkN59GQEl81KFPoVUlszI=@protonmail.com> References: <87frrxjpx8.fsf@web.de> <87ttgco01g.fsf@web.de> <875xss2siz.fsf@web.de> Mime-Version: 1.0 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="18712"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuri Khan , Michael Heerdegen , help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 26 19:33:02 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 1sXOoO-0004hx-TL for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 26 Jul 2024 19:33:00 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXOnn-0000Jv-Mt; Fri, 26 Jul 2024 13:32: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 1sXOni-0000Ja-3v for help-gnu-emacs@gnu.org; Fri, 26 Jul 2024 13:32:19 -0400 Original-Received: from mail-4027.protonmail.ch ([185.70.40.27]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sXOnf-0000nF-U2 for help-gnu-emacs@gnu.org; Fri, 26 Jul 2024 13:32:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1722015134; x=1722274334; bh=aHxmW92OqCfkzemdrxJSRKjRgqqJKdpca0BDRbppNFQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=PTBAG1SwWb67q3skAE/BMSnV4u11dOPjMNsM+0KNoh3e6fbDJWekPV1Gd50UrhOy2 xOW/G4E7AGUM2mAc029CWJzr+6FX3tDn9fGbyhNPEr2YKaYf4XEm4llXM4BGhxQt/v SMyTIXhYxCaMM/ZG7QICTJrTRlJD+eI7Yb/KZnB1Hr1bc1ikEeCCu1T24vM35EfqaO 5w0NwHvPfaarty+8BonoZV5Lzb9v8r7TXGbiUb4MGPekNLfewWZCEtbiS4V8Kvm6WH eX0ipacntcM/1ydn7VzhF6wM31cenNlNIO43HoIfMB2avvI8aVsnjgOgHolww9WS5O 9mowaCrWh0k1A== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 958c49455ba885150d546ffe5acc4f0519b052d7 Received-SPF: pass client-ip=185.70.40.27; envelope-from=heimeborgia@protonmail.com; helo=mail-4027.protonmail.ch X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TO_EQ_FM_DIRECT_MX=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:147387 Archived-At: Sent with Proton Mail secure email. On Saturday, July 27th, 2024 at 3:03 AM, Heime = wrote: >=20 >=20 >=20 >=20 >=20 > Sent with Proton Mail secure email. >=20 >=20 > On Saturday, July 27th, 2024 at 2:40 AM, Yuri Khan yuri.v.khan@gmail.com = wrote: >=20 > > On Fri, 26 Jul 2024 at 21:19, Heime heimeborgia@protonmail.com wrote: > >=20 > > > > | =E2=80=98(WIDTH REST...)=E2=80=99 > > > > | A list whose first element is an integer specifies truncation or > > > > | padding of the results of REST. The remaining elements REST are > > > > | processed recursively as mode line constructs and concatenated > > > > | together. When WIDTH is positive, the result is space filled on > > > > | the right if its width is less than WIDTH. When WIDTH is negative= , > > > > | the result is truncated on the right to =E2=88=92WIDTH columns if= its width > > > > | exceeds =E2=88=92WIDTH. > > >=20 > > > For case of (WIDTH REST...), what do I have to do exactly ? > >=20 > > Have you read the explanation about positive and negative WIDTHs above? > >=20 > > > Certainly not this way > > >=20 > > > (setq-default mode-line-buffer-identification > > > (list 8 > > > (propertized-buffer-identification (format "%%%db" width)))) > >=20 > > This seems to work for me: > >=20 > > (setq-default mode-line-buffer-identification > > (list -8 (propertized-buffer-identification "%b"))) > >=20 > > -8 specifies truncation to 8 characters. And we don=E2=80=99t need to p= ad if > > we=E2=80=99re going to truncate anyway. > >=20 > > (8 is way too small for a buffer name though.) >=20 I wanted to add ... for long names but the buffer name is not correct.=20 (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))))) )