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#72309: propertized-buffer-identification with maximum width Date: Sun, 28 Jul 2024 07:55:43 +0300 Message-ID: <86bk2i15f4.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10090"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72309@debbugs.gnu.org To: Heime Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 28 06:59:07 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 1sXvzu-0002TD-GL for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jul 2024 06:59:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sXvzD-0007gc-88; Sun, 28 Jul 2024 00:58:23 -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 1sXvxj-0007ZP-9o for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:56:51 -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 1sXvxj-0005zC-1p for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:56:51 -0400 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=grEWIi39AC5H7+akTVUErUvXYS+OukneEwNyvjfElNE=; b=LKL5S/FsQfzv8xhaW1Z7sImRGS14NiP22fy2/6yevft+LGesiQoES9vOzMLftiGqQgcGGe6d6FCkC84fywzMBveiGDIHwryW6SHJSRwKjfyxEjMGISXp/SnqscvHykB2OM7tfLlWY300JBEC9Pl5puVpAFhzCEjEudADJO4iObIs/2mGHnncORKsjN/HYvBXy5N+5QN1RuYB1ASy+ofcoRQUkHFN1hrEbPsIgQ3b9kouh63kQhk3DQHl82iOhFI+FTZEm9957mX2NTvZ5FPvlK3QRNcCXSo8pX/WTyi2tpM2JtyNxQvAqsTvKoIw+mv/cA//t0FJJRNl1VH71ITwXA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sXvxt-0004BW-Q9 for bug-gnu-emacs@gnu.org; Sun, 28 Jul 2024 00:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jul 2024 04:57:01 +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.172214256816026 (code B ref 72309); Sun, 28 Jul 2024 04:57:01 +0000 Original-Received: (at 72309) by debbugs.gnu.org; 28 Jul 2024 04:56:08 +0000 Original-Received: from localhost ([127.0.0.1]:42601 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXvx2-0004AQ-BN for submit@debbugs.gnu.org; Sun, 28 Jul 2024 00:56:08 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42584) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sXvx0-00049u-Cm for 72309@debbugs.gnu.org; Sun, 28 Jul 2024 00:56:06 -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 1sXvwg-0005sR-Ls; Sun, 28 Jul 2024 00:55:49 -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=grEWIi39AC5H7+akTVUErUvXYS+OukneEwNyvjfElNE=; b=EpQMyjCpM9qY mhJFuN2fxHt/Hf2WUR0JjO+pbneWkL8zSYDj+ldwbapvMVLGjJ94/YolP3Vj+eB1x89L2AHtcinH6 iASO0IcS3ZT0h8CqDPTsxmjLvJq39RXFmvr9xZENI6BjGWBxEI+E5ppuB4D8qw57hMxf+yDEE7Xim 7VTFTyEpcP40uPZ9GNO0d4Q1ZBr1oJO7dCWG0zbLD4dPT/tq218mzM99dbDNEj2+NlkzS3X25ehSA MuBpwyeMgmw5hJokKL8Wcw9wuKurZWJ0y8UFGFFv3HGm0/9YFdUZE9FflWwBwbOrddusENhFPE8LS DljxQqXsz9jhMR9aBPANow==; In-Reply-To: (message from Heime on Sat, 27 Jul 2024 20:49:05 +0000) 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:289454 Archived-At: > Date: Sat, 27 Jul 2024 20:49:05 +0000 > From: Heime > Cc: 72309@debbugs.gnu.org, Eli Zaretskii > > 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. > > > > On Sunday, July 28th, 2024 at 2:56 AM, Heime via "Bug reports for GNU Emacs, the Swiss army knife of text editors" bug-gnu-emacs@gnu.org wrote: > > > > > Sent with Proton Mail secure email. > > > > > > On Sunday, July 28th, 2024 at 1:29 AM, Eli Zaretskii eliz@gnu.org wrote: > > > > > > > > Date: Sat, 27 Jul 2024 13:08:31 +0000 > > > > > From: Heime heimeborgia@protonmail.com > > > > > Cc: 72309@debbugs.gnu.org > > > > > > > > > > On Sunday, July 28th, 2024 at 1:00 AM, Eli Zaretskii eliz@gnu.org wrote: > > > > > > > > > > > Yes, but the (WIDTH something) construct is not for truncating long > > > > > > 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-width > > > > > > instead, which is also capable of showing the ellipsis at the end. > > > > > > > > > > I do not know how to access the buffer name and apply truncate-string-to-width > > > > > when setting mode-line-buffer-identification on propertized-buffer-identification. > > > > > > > > Use :eval. > > > > > > I have done it without success > > > > > > (defun vodil-rtgbfn (wmin) > > > (setq-default mode-line-buffer-identification > > > (propertized-buffer-identification (format " %%%db " wmin)))) > > > > > > (vodil-rtgbfn 8) > > > > > > (setq-default mode-line-format > > > '( "%e" (:eval (truncate-string-to-width mode-line-buffer-identification 13)) > > > vodil-panelit-bfselec)) > > > > > > > > Have now done, but now the buffer name is not displayed. Why has there > > to be so much torture to change the defaults ! > > > > (defun vodil-tkbfn-ellipses (wmax) > > "Get the buffer name truncated to WMAX width with ellipsis." > > > > (let* ( (bfname (buffer-name (window-buffer))) > > (tkname (if (> (length bfname) wmax) > > > > (truncate-string-to-width bfname wmax nil nil "...") > > bfname))) > > (propertized-buffer-identification (format " %s " tkname)))) > > > > > > (defun vodil-tkbfn (wmax) > > "Set mode-line-buffer-identification with WMAX maximum width." > > > > (setq-default mode-line-buffer-identification > > '(:eval (vodil-tkbfn-ellipses wmax)))) > > > > What is the big problem of showing how to implement this, buffer name > with truncation ellipses using mode-line-buffer-identification ? We don't have people here whose job is to write code for others. This is a volunteer-based project, where people help you with ideas, but the actual job of writing and debugging the code is yours. So please take the ideas, read the documentation, and work on the implementation you want. If you have questions about the implementation, please ask them on help-gnu-emacs, which is where user-level help should be sought. > Can there be some additional commands to make this possibility less > cumbersome. For instance, an option that gives mode-line-buffer-identification > with truncation ellipses. No.