all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Heime <heimeborgia@protonmail.com>
Cc: 72309@debbugs.gnu.org
Subject: bug#72309: propertized-buffer-identification with maximum width
Date: Sun, 28 Jul 2024 07:55:43 +0300	[thread overview]
Message-ID: <86bk2i15f4.fsf@gnu.org> (raw)
In-Reply-To: <CA55pVwcw396ss3MV5_ckc0DeBQ5Zcnctz9cEFdB9aiN2kERTPZLiHFxqwm2_r02f0PPaLsdGx0Qw6CWKPefLClxosfIaMUO7dTln-HDPqY=@protonmail.com> (message from Heime on Sat, 27 Jul 2024 20:49:05 +0000)

> Date: Sat, 27 Jul 2024 20:49:05 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: 72309@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
> 
> On Sunday, July 28th, 2024 at 3:27 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 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.





  reply	other threads:[~2024-07-28  4:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 19:04 bug#72309: propertized-buffer-identification with maximum width Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27  5:48 ` Eli Zaretskii
2024-07-27  9:22   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 12:05     ` Eli Zaretskii
2024-07-27 12:23       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 13:00         ` Eli Zaretskii
2024-07-27 13:08           ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 13:29             ` Eli Zaretskii
2024-07-27 14:56               ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 15:27                 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 20:49                   ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28  4:55                     ` Eli Zaretskii [this message]
2024-07-28 10:55                       ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28 12:18                         ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28 12:29                           ` Eli Zaretskii
2024-07-28 12:51                             ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28 14:07                               ` Eli Zaretskii
2024-07-28 14:19                                 ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-28 14:32                                   ` Eli Zaretskii
2024-07-28 14:40                                     ` Heime via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bk2i15f4.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=72309@debbugs.gnu.org \
    --cc=heimeborgia@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.