all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Manuel Giraud <manuel@ledu-giraud.fr>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: eliding in mode-line-format
Date: Fri, 1 Oct 2021 21:23:08 +0700	[thread overview]
Message-ID: <CAP_d_8VnOD90T8mxVqDstdw0ZMoUqBDGgu6ZM3dCeHfU3Ha8Tw@mail.gmail.com> (raw)
In-Reply-To: <875yugrgj0.fsf@elite.giraud>

On Fri, 1 Oct 2021 at 21:02, Manuel Giraud <manuel@ledu-giraud.fr> wrote:

> I'd like to have some kind eliding feature in the mode line.
>
> As a usage example, I'd like to be able to have "a buffer with a really
> long and meaning full name" that I'm able to track down (with icomplete
> for instance) but I want its "%b" mode line representation to be
> truncated to say n characters ("a buffer with…" for instance).

$ emacs -Q

(setq-default mode-line-buffer-identification
    '(-15 (:eval (propertized-buffer-identification "%b"))))

Now you have buffer names truncated to 15 characters.

(See documentation on mode-line-format, also see the default value of
mode-line-format and all the parts it gets built from.)

Instead of using a list with a negative number at the front, you might
prefer defining a function to ellipsize a string. You then get to
choose an ellipsis character and whether to truncate from the start,
end or middle.



  reply	other threads:[~2021-10-01 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 14:00 eliding in mode-line-format Manuel Giraud
2021-10-01 14:23 ` Yuri Khan [this message]
2021-10-01 16:49   ` Stephen Berman

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=CAP_d_8VnOD90T8mxVqDstdw0ZMoUqBDGgu6ZM3dCeHfU3Ha8Tw@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=manuel@ledu-giraud.fr \
    /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.