From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72309: propertized-buffer-identification with maximum width Date: Sat, 27 Jul 2024 20:49:05 +0000 Message-ID: References: <8eYtcka1bg4aOfbQVrzRShsG1EtNIu1JLO9XlRoQXZ4Q7yqojew5kxXcml4s-JdvwA7hgEdo_0-YEQf0zknb2wq9aS_-rgwEZB0ZT9y6QWM=@protonmail.com> <86jzh72xml.fsf@gnu.org> <86v80r11mk.fsf@gnu.org> <86plqz0z2g.fsf@gnu.org> <4NGOfJklhGgHco35Z3hgQLAbDA27v3FQW-VrjVbIMZ19Giduj_FYccq70KrUy7HlB2FgttLYBhiUJHL32RFS73-Ex6XnFwoaQqpdfQcn7_8=@protonmail.com> <86o76j0xps.fsf@gnu.org> Reply-To: Heime 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="27037"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72309@debbugs.gnu.org, Eli Zaretskii To: Heime Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 27 22:50:16 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 1sXoMp-0006vI-JK for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jul 2024 22:50:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXoMV-0001gK-5i; Sat, 27 Jul 2024 16:49:55 -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 1sXoMS-0001ft-FW for bug-gnu-emacs@gnu.org; Sat, 27 Jul 2024 16:49:53 -0400 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 1sXoMS-0003vh-68 for bug-gnu-emacs@gnu.org; Sat, 27 Jul 2024 16:49:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=SCBuK2kfjIRE6leju8XLoNpQ1tsaMQeEVaq37mQDqCM=; b=hhIt1HVceUSY/2lF2k7kZm0+zZui8/gdGXpvM9TkgTtF1HNV4VS0BicCkgbVHY8vaCaUoKXOBQxxKgE9xufNQYgkqNdiji1jSHK1ZbbcY5jzW2Ue6SJFVq17RlokZzvDdEiYvWGKwAyfpWmhFok6SPhJFEnnhy2DRmOtvMciE8rsqd9AMoqyN+quLV3OF+WiVziTtLf4Myrm56biE8hrfo5kkKvkdrK/FpF58ejZVPBksWj78uI23TsG/TGlp8qzeq/prj3AszrxFNfg1xgihuy8VgX9pT2OWP9JV1FWngB4vaTnqgRAoHUcTrxFbZcgOY4HILaA6ofnT9NMQIzJ6w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXoMc-0007Pb-77 for bug-gnu-emacs@gnu.org; Sat, 27 Jul 2024 16:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Heime Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jul 2024 20:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72309 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 72309-submit@debbugs.gnu.org id=B72309.172211336828433 (code B ref 72309); Sat, 27 Jul 2024 20:50:02 +0000 Original-Received: (at 72309) by debbugs.gnu.org; 27 Jul 2024 20:49:28 +0000 Original-Received: from localhost ([127.0.0.1]:42471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXoM4-0007OW-B0 for submit@debbugs.gnu.org; Sat, 27 Jul 2024 16:49:28 -0400 Original-Received: from mail-43167.protonmail.ch ([185.70.43.167]:45897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXoM2-0007OJ-9K for 72309@debbugs.gnu.org; Sat, 27 Jul 2024 16:49:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1722113349; x=1722372549; bh=SCBuK2kfjIRE6leju8XLoNpQ1tsaMQeEVaq37mQDqCM=; 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=LwWGQ0nzBoTIMED1NJcpZILOJPtQEZMXR63BP0Fe5eTLclAnGiYz+uvVnK0+xkl1Y b/m+F2724o/ymcFap5T6wDnTgupFobfraR3shq9w8B8KwI76kOKeSQTDyWsJSoawYT kdGJO1Z27a5IhBHlfdgCtz5kjRZbamq1someYjE3srhkDUahcGE/Ufpy8Fvzr/ZYsV e/vgKgWVWrfx1dF2cZSZznr4asfhpyC6YxtWkMrJT0PylTIoOTQijPATzn02TB1Q6s Tdge0rKccKQ/3MwZ16VXwtbRWkyJjdcDEC+kgEKoOW1ze2vrkcDc0vbMJPnucLtAJg 8jrFwVItatQ1g== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: fbcd7ba1b1981ff4b0ed9af1764aec71afc1cd14 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:289445 Archived-At: On Sunday, July 28th, 2024 at 3:27 AM, Heime via "Bug reports for GNU Emacs= , the Swiss army knife of text editors" wrote: > Sent with Proton Mail secure email. >=20 > On Sunday, July 28th, 2024 at 2:56 AM, Heime via "Bug reports for GNU Ema= cs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote: >=20 > > Sent with Proton Mail secure email. > >=20 > > On Sunday, July 28th, 2024 at 1:29 AM, Eli Zaretskii eliz@gnu.org wrote= : > >=20 > > > > Date: Sat, 27 Jul 2024 13:08:31 +0000 > > > > From: Heime heimeborgia@protonmail.com > > > > Cc: 72309@debbugs.gnu.org > > > >=20 > > > > On Sunday, July 28th, 2024 at 1:00 AM, Eli Zaretskii eliz@gnu.org w= rote: > > > >=20 > > > > > Yes, but the (WIDTH something) construct is not for truncating lo= ng > > > > > names, it's for ensuring the string produced by "something" doesn= 't > > > > > take too many columns. So you are using this for a wrong purpose.= If > > > > > you want to truncate a buffer's name, use truncate-string-to-widt= h > > > > > instead, which is also capable of showing the ellipsis at the end= . > > > >=20 > > > > I do not know how to access the buffer name and apply truncate-stri= ng-to-width > > > > when setting mode-line-buffer-identification on propertized-buffer-= identification. > > >=20 > > > Use :eval. > >=20 > > I have done it without success > >=20 > > (defun vodil-rtgbfn (wmin) > > (setq-default mode-line-buffer-identification > > (propertized-buffer-identification (format " %%%db " wmin)))) > >=20 > > (vodil-rtgbfn 8) > >=20 > > (setq-default mode-line-format > > '( "%e" (:eval (truncate-string-to-width mode-line-buffer-identificatio= n 13)) > > vodil-panelit-bfselec)) >=20 >=20 >=20 > Have now done, but now the buffer name is not displayed. Why has there > to be so much torture to change the defaults ! >=20 > (defun vodil-tkbfn-ellipses (wmax) > "Get the buffer name truncated to WMAX width with ellipsis." >=20 > (let* ( (bfname (buffer-name (window-buffer))) > (tkname (if (> (length bfname) wmax) >=20 > (truncate-string-to-width bfname wmax nil nil "...") > bfname))) > (propertized-buffer-identification (format " %s " tkname)))) >=20 >=20 > (defun vodil-tkbfn (wmax) > "Set mode-line-buffer-identification with WMAX maximum width." >=20 > (setq-default mode-line-buffer-identification > '(:eval (vodil-tkbfn-ellipses wmax)))) >=20 What is the big problem of showing how to implement this, buffer name with truncation ellipses using mode-line-buffer-identification ? Can there be some additional commands to make this possibility less cumbersome. For instance, an option that gives mode-line-buffer-identifica= tion with truncation ellipses.=20