* Operation of format-mode-line
@ 2024-07-22 21:58 Heime
2024-07-22 23:35 ` Heime
2024-07-23 11:08 ` Eli Zaretskii
0 siblings, 2 replies; 55+ messages in thread
From: Heime @ 2024-07-22 21:58 UTC (permalink / raw)
To: Heime via Users list for the GNU Emacs text editor
What does this do exactly ?
(format-mode-line mode-line-buffer-identification)
The documentation states that
"Format a string out of a mode line format specification."
But what does that mean ? What is actually returned ?
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-22 21:58 Operation of format-mode-line Heime
@ 2024-07-22 23:35 ` Heime
2024-07-23 11:11 ` Eli Zaretskii
2024-07-23 11:08 ` Eli Zaretskii
1 sibling, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-22 23:35 UTC (permalink / raw)
To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor
On Tuesday, July 23rd, 2024 at 9:58 AM, Heime <heimeborgia@protonmail.com> wrote:
> What does this do exactly ?
>
> (format-mode-line mode-line-buffer-identification)
>
> The documentation states that
>
> "Format a string out of a mode line format specification."
>
> But what does that mean ? What is actually returned ?
I also have
(text-properties-at 0 (format-mode-line mode-line-buffer-identification))
What does it mean that POSITION is a 0-based index into the string ?
Does it matter if POSITION is set to 0 or 1 or 2 ?
Synopsis for text-properties-at is (text-properties-at POSITION &optional OBJECT)
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-22 21:58 Operation of format-mode-line Heime
2024-07-22 23:35 ` Heime
@ 2024-07-23 11:08 ` Eli Zaretskii
2024-07-23 16:37 ` Heime
1 sibling, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-23 11:08 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Mon, 22 Jul 2024 21:58:23 +0000
> From: Heime <heimeborgia@protonmail.com>
>
>
> What does this do exactly ?
>
> (format-mode-line mode-line-buffer-identification)
>
> The documentation states that
>
> "Format a string out of a mode line format specification."
>
> But what does that mean ? What is actually returned ?
The formatted string.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-22 23:35 ` Heime
@ 2024-07-23 11:11 ` Eli Zaretskii
0 siblings, 0 replies; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-23 11:11 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Mon, 22 Jul 2024 23:35:15 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
> (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
>
> What does it mean that POSITION is a 0-based index into the string ?
It means the first character has POSITION zero, the next one has
POSITION 1, etc. IOW, this is a general feature of Lisp strings: the
string's character positions are zero-based (as opposed to buffer
positions, which are 1-based).
> Does it matter if POSITION is set to 0 or 1 or 2 ?
Yes, you will get the text properties at a different character.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 11:08 ` Eli Zaretskii
@ 2024-07-23 16:37 ` Heime
2024-07-23 17:48 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-23 16:37 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Tuesday, July 23rd, 2024 at 11:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 22 Jul 2024 21:58:23 +0000
> > From: Heime heimeborgia@protonmail.com
> >
> > What does this do exactly ?
> >
> > (format-mode-line mode-line-buffer-identification)
> >
> > The documentation states that
> >
> > "Format a string out of a mode line format specification."
> >
> > But what does that mean ? What is actually returned ?
>
>
> The formatted string.
In the context of (format-mode-line mode-line-buffer-identification)
what is the formatted string ? Is it the buffer name together with
the text properties for display by the modeline. Seems that the text
properties are the same for each character.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 16:37 ` Heime
@ 2024-07-23 17:48 ` Eli Zaretskii
2024-07-23 18:56 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-23 17:48 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 23 Jul 2024 16:37:38 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
>
> On Tuesday, July 23rd, 2024 at 11:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > > (format-mode-line mode-line-buffer-identification)
> > >
> > > The documentation states that
> > >
> > > "Format a string out of a mode line format specification."
> > >
> > > But what does that mean ? What is actually returned ?
> >
> >
> > The formatted string.
>
> In the context of (format-mode-line mode-line-buffer-identification)
> what is the formatted string ?
The string produced by following the mode-line format. It's similar
to what you see on the mode line itself.
> Is it the buffer name together with the text properties for display
> by the modeline.
More or less, yes.
> Seems that the text properties are the same for each character.
They are not.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 17:48 ` Eli Zaretskii
@ 2024-07-23 18:56 ` Heime
2024-07-23 19:07 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-23 18:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Wednesday, July 24th, 2024 at 5:48 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Tue, 23 Jul 2024 16:37:38 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > On Tuesday, July 23rd, 2024 at 11:08 PM, Eli Zaretskii eliz@gnu.org wrote:
> >
> > > > (format-mode-line mode-line-buffer-identification)
> > > >
> > > > The documentation states that
> > > >
> > > > "Format a string out of a mode line format specification."
> > > >
> > > > But what does that mean ? What is actually returned ?
> > >
> > > The formatted string.
> >
> > In the context of (format-mode-line mode-line-buffer-identification)
> > what is the formatted string ?
>
>
> The string produced by following the mode-line format. It's similar
> to what you see on the mode line itself.
>
> > Is it the buffer name together with the text properties for display
> > by the modeline.
>
>
> More or less, yes.
>
> > Seems that the text properties are the same for each character.
>
>
> They are not.
If the buffer name is provodilac.el, what is the difference in text proporties
between the different characters ? I see there are faces and code for mouse
action whether I use position 0, 1, 2, etc.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 18:56 ` Heime
@ 2024-07-23 19:07 ` Eli Zaretskii
2024-07-23 19:13 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-23 19:07 UTC (permalink / raw)
To: Heime; +Cc: help-gnu-emacs
> Date: Tue, 23 Jul 2024 18:56:47 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> > > Seems that the text properties are the same for each character.
> >
> >
> > They are not.
>
> If the buffer name is provodilac.el, what is the difference in text proporties
> between the different characters ? I see there are faces and code for mouse
> action whether I use position 0, 1, 2, etc.
All the characters that belong to the buffer name indeed have the same
properties. But not all of the characters of the string returned by
format-mode-line.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 19:07 ` Eli Zaretskii
@ 2024-07-23 19:13 ` Heime
2024-07-24 2:25 ` Eli Zaretskii
2024-07-24 2:26 ` Eli Zaretskii
0 siblings, 2 replies; 55+ messages in thread
From: Heime @ 2024-07-23 19:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Sent with Proton Mail secure email.
On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > > > Seems that the text properties are the same for each character.
> > >
> > > They are not.
> >
> > If the buffer name is provodilac.el, what is the difference in text proporties
> > between the different characters ? I see there are faces and code for mouse
> > action whether I use position 0, 1, 2, etc.
>
>
> All the characters that belong to the buffer name indeed have the same
> properties. But not all of the characters of the string returned by
> format-mode-line.
Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
(text-properties-at 0 (format-mode-line mode-line-buffer-identification))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 19:13 ` Heime
@ 2024-07-24 2:25 ` Eli Zaretskii
2024-07-24 2:26 ` Eli Zaretskii
1 sibling, 0 replies; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 2:25 UTC (permalink / raw)
To: help-gnu-emacs
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-23 19:13 ` Heime
2024-07-24 2:25 ` Eli Zaretskii
@ 2024-07-24 2:26 ` Eli Zaretskii
2024-07-24 10:18 ` Heime
1 sibling, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 2:26 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 23 Jul 2024 19:13:32 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > From: Heime heimeborgia@protonmail.com
> > > Cc: help-gnu-emacs@gnu.org
> > >
> > > > > Seems that the text properties are the same for each character.
> > > >
> > > > They are not.
> > >
> > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > between the different characters ? I see there are faces and code for mouse
> > > action whether I use position 0, 1, 2, etc.
> >
> >
> > All the characters that belong to the buffer name indeed have the same
> > properties. But not all of the characters of the string returned by
> > format-mode-line.
>
> Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
>
> (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
I don't understand your question, sorry. Is what correct?
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 2:26 ` Eli Zaretskii
@ 2024-07-24 10:18 ` Heime
2024-07-24 11:47 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-24 10:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Wednesday, July 24th, 2024 at 2:26 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Tue, 23 Jul 2024 19:13:32 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii eliz@gnu.org wrote:
> >
> > > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > > From: Heime heimeborgia@protonmail.com
> > > > Cc: help-gnu-emacs@gnu.org
> > > >
> > > > > > Seems that the text properties are the same for each character.
> > > > >
> > > > > They are not.
> > > >
> > > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > > between the different characters ? I see there are faces and code for mouse
> > > > action whether I use position 0, 1, 2, etc.
> > >
> > > All the characters that belong to the buffer name indeed have the same
> > > properties. But not all of the characters of the string returned by
> > > format-mode-line.
> >
> > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> >
> > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
>
>
> I don't understand your question, sorry. Is what correct?
I want to have buffer identification in the modeline without the "%12b"
so that the buffer name does not get truncated. What can I do ? Have
been copying the text properties.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 10:18 ` Heime
@ 2024-07-24 11:47 ` Eli Zaretskii
2024-07-24 12:21 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 11:47 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 10:18:44 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> On Wednesday, July 24th, 2024 at 2:26 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > > Date: Tue, 23 Jul 2024 19:13:32 +0000
> > > From: Heime heimeborgia@protonmail.com
> > > Cc: help-gnu-emacs@gnu.org
> > >
> > > On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii eliz@gnu.org wrote:
> > >
> > > > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > > > From: Heime heimeborgia@protonmail.com
> > > > > Cc: help-gnu-emacs@gnu.org
> > > > >
> > > > > > > Seems that the text properties are the same for each character.
> > > > > >
> > > > > > They are not.
> > > > >
> > > > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > > > between the different characters ? I see there are faces and code for mouse
> > > > > action whether I use position 0, 1, 2, etc.
> > > >
> > > > All the characters that belong to the buffer name indeed have the same
> > > > properties. But not all of the characters of the string returned by
> > > > format-mode-line.
> > >
> > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > >
> > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> >
> >
> > I don't understand your question, sorry. Is what correct?
>
> I want to have buffer identification in the modeline without the "%12b"
> so that the buffer name does not get truncated. What can I do ? Have
> been copying the text properties.
It depends on what you replace "%12b" with.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 11:47 ` Eli Zaretskii
@ 2024-07-24 12:21 ` Heime
2024-07-24 12:33 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-24 12:21 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Wednesday, July 24th, 2024 at 11:47 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 10:18:44 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > On Wednesday, July 24th, 2024 at 2:26 PM, Eli Zaretskii eliz@gnu.org wrote:
> >
> > > > Date: Tue, 23 Jul 2024 19:13:32 +0000
> > > > From: Heime heimeborgia@protonmail.com
> > > > Cc: help-gnu-emacs@gnu.org
> > > >
> > > > On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii eliz@gnu.org wrote:
> > > >
> > > > > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > > > > From: Heime heimeborgia@protonmail.com
> > > > > > Cc: help-gnu-emacs@gnu.org
> > > > > >
> > > > > > > > Seems that the text properties are the same for each character.
> > > > > > >
> > > > > > > They are not.
> > > > > >
> > > > > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > > > > between the different characters ? I see there are faces and code for mouse
> > > > > > action whether I use position 0, 1, 2, etc.
> > > > >
> > > > > All the characters that belong to the buffer name indeed have the same
> > > > > properties. But not all of the characters of the string returned by
> > > > > format-mode-line.
> > > >
> > > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > > >
> > > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> > >
> > > I don't understand your question, sorry. Is what correct?
> >
> > I want to have buffer identification in the modeline without the "%12b"
> > so that the buffer name does not get truncated. What can I do ? Have
> > been copying the text properties.
>
>
> It depends on what you replace "%12b" with.
I want to replace it to a larger value.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 12:21 ` Heime
@ 2024-07-24 12:33 ` Eli Zaretskii
2024-07-24 12:45 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 12:33 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 12:21:49 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> On Wednesday, July 24th, 2024 at 11:47 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
> > > Date: Wed, 24 Jul 2024 10:18:44 +0000
> > > From: Heime heimeborgia@protonmail.com
> > > Cc: help-gnu-emacs@gnu.org
> > >
> > > On Wednesday, July 24th, 2024 at 2:26 PM, Eli Zaretskii eliz@gnu.org wrote:
> > >
> > > > > Date: Tue, 23 Jul 2024 19:13:32 +0000
> > > > > From: Heime heimeborgia@protonmail.com
> > > > > Cc: help-gnu-emacs@gnu.org
> > > > >
> > > > > On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii eliz@gnu.org wrote:
> > > > >
> > > > > > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > > > > > From: Heime heimeborgia@protonmail.com
> > > > > > > Cc: help-gnu-emacs@gnu.org
> > > > > > >
> > > > > > > > > Seems that the text properties are the same for each character.
> > > > > > > >
> > > > > > > > They are not.
> > > > > > >
> > > > > > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > > > > > between the different characters ? I see there are faces and code for mouse
> > > > > > > action whether I use position 0, 1, 2, etc.
> > > > > >
> > > > > > All the characters that belong to the buffer name indeed have the same
> > > > > > properties. But not all of the characters of the string returned by
> > > > > > format-mode-line.
> > > > >
> > > > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > > > >
> > > > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> > > >
> > > > I don't understand your question, sorry. Is what correct?
> > >
> > > I want to have buffer identification in the modeline without the "%12b"
> > > so that the buffer name does not get truncated. What can I do ? Have
> > > been copying the text properties.
> >
> >
> > It depends on what you replace "%12b" with.
>
> I want to replace it to a larger value.
You mean, instead of "%12b" something like "%20b"? Then you shouldn't
need to do anything.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 12:33 ` Eli Zaretskii
@ 2024-07-24 12:45 ` Heime
2024-07-24 12:49 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-24 12:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Thursday, July 25th, 2024 at 12:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 12:21:49 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > On Wednesday, July 24th, 2024 at 11:47 PM, Eli Zaretskii eliz@gnu.org wrote:
> >
> > > > Date: Wed, 24 Jul 2024 10:18:44 +0000
> > > > From: Heime heimeborgia@protonmail.com
> > > > Cc: help-gnu-emacs@gnu.org
> > > >
> > > > On Wednesday, July 24th, 2024 at 2:26 PM, Eli Zaretskii eliz@gnu.org wrote:
> > > >
> > > > > > Date: Tue, 23 Jul 2024 19:13:32 +0000
> > > > > > From: Heime heimeborgia@protonmail.com
> > > > > > Cc: help-gnu-emacs@gnu.org
> > > > > >
> > > > > > On Wednesday, July 24th, 2024 at 7:07 AM, Eli Zaretskii eliz@gnu.org wrote:
> > > > > >
> > > > > > > > Date: Tue, 23 Jul 2024 18:56:47 +0000
> > > > > > > > From: Heime heimeborgia@protonmail.com
> > > > > > > > Cc: help-gnu-emacs@gnu.org
> > > > > > > >
> > > > > > > > > > Seems that the text properties are the same for each character.
> > > > > > > > >
> > > > > > > > > They are not.
> > > > > > > >
> > > > > > > > If the buffer name is provodilac.el, what is the difference in text proporties
> > > > > > > > between the different characters ? I see there are faces and code for mouse
> > > > > > > > action whether I use position 0, 1, 2, etc.
> > > > > > >
> > > > > > > All the characters that belong to the buffer name indeed have the same
> > > > > > > properties. But not all of the characters of the string returned by
> > > > > > > format-mode-line.
> > > > > >
> > > > > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > > > > >
> > > > > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> > > > >
> > > > > I don't understand your question, sorry. Is what correct?
> > > >
> > > > I want to have buffer identification in the modeline without the "%12b"
> > > > so that the buffer name does not get truncated. What can I do ? Have
> > > > been copying the text properties.
> > >
> > > It depends on what you replace "%12b" with.
> >
> > I want to replace it to a larger value.
>
>
> You mean, instead of "%12b" something like "%20b"? Then you shouldn't
> need to do anything.
Yes. Maybe I do not need to do a lot, but the number is not going to change
all by itself.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 12:45 ` Heime
@ 2024-07-24 12:49 ` Eli Zaretskii
2024-07-24 13:08 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 12:49 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 12:45:50 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> > > > > > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > > > > > >
> > > > > > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> > > > > >
> > > > > > I don't understand your question, sorry. Is what correct?
> > > > >
> > > > > I want to have buffer identification in the modeline without the "%12b"
> > > > > so that the buffer name does not get truncated. What can I do ? Have
> > > > > been copying the text properties.
> > > >
> > > > It depends on what you replace "%12b" with.
> > >
> > > I want to replace it to a larger value.
> >
> >
> > You mean, instead of "%12b" something like "%20b"? Then you shouldn't
> > need to do anything.
>
> Yes. Maybe I do not need to do a lot, but the number is not going to change
> all by itself.
I meant you don't need to do anything _except_ change the number,
i.e. replace "12" with "20" (or whatever number you want there).
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 12:49 ` Eli Zaretskii
@ 2024-07-24 13:08 ` Heime
2024-07-24 13:23 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-24 13:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Thursday, July 25th, 2024 at 12:49 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 12:45:50 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > > > > > > > Returning the text properties from position 0 would ensure that the properties one gets are associated with the the buffer name. Is this correct when doing
> > > > > > > >
> > > > > > > > (text-properties-at 0 (format-mode-line mode-line-buffer-identification))
> > > > > > >
> > > > > > > I don't understand your question, sorry. Is what correct?
> > > > > >
> > > > > > I want to have buffer identification in the modeline without the "%12b"
> > > > > > so that the buffer name does not get truncated. What can I do ? Have
> > > > > > been copying the text properties.
> > > > >
> > > > > It depends on what you replace "%12b" with.
> > > >
> > > > I want to replace it to a larger value.
> > >
> > > You mean, instead of "%12b" something like "%20b"? Then you shouldn't
> > > need to do anything.
> >
> > Yes. Maybe I do not need to do a lot, but the number is not going to change
> > all by itself.
>
>
> I meant you don't need to do anything except change the number,
> i.e. replace "12" with "20" (or whatever number you want there).
How can I do it with elisp code ? I am constructing my own modeline.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 13:08 ` Heime
@ 2024-07-24 13:23 ` Eli Zaretskii
2024-07-24 14:01 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 15:40 ` Heime
0 siblings, 2 replies; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 13:23 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 13:08:15 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> > I meant you don't need to do anything except change the number,
> > i.e. replace "12" with "20" (or whatever number you want there).
>
> How can I do it with elisp code ? I am constructing my own modeline.
mode-line-format is a variable, so you can use setq to modify its
value. Or you could modify just the value of
mode-line-buffer-identification, another variable (which is used to
construct the value of mode-line-format), which is where "%12b" comes
from.
More generally, take a look at lisp/bindings.el, where all the parts
of mode-line-format are defined and then used to produce the final
value of that variable.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 13:23 ` Eli Zaretskii
@ 2024-07-24 14:01 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 15:40 ` Heime
1 sibling, 0 replies; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-24 14:01 UTC (permalink / raw)
To: help-gnu-emacs
Eli Zaretskii <eliz@gnu.org> writes:
> mode-line-format is a variable, so you can use setq to modify its
> value. Or you could modify just the value of
> mode-line-buffer-identification, another variable (which is used to
> construct the value of mode-line-format), which is where "%12b" comes
> from.
And also please not that `mode-line-buffer-identification' is a buffer
local variable. Which means that some major modes are using a value
different from the default one.
Which means: your settings will either not effect every buffer, or will
have to handle several cases individually, or will override the
individual settings of some modes which might give unexpected results.
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 13:23 ` Eli Zaretskii
2024-07-24 14:01 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-24 15:40 ` Heime
2024-07-24 16:07 ` Yuri Khan
2024-07-24 16:35 ` Eli Zaretskii
1 sibling, 2 replies; 55+ messages in thread
From: Heime @ 2024-07-24 15:40 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Sent with Proton Mail secure email.
On Thursday, July 25th, 2024 at 1:23 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 13:08:15 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > > I meant you don't need to do anything except change the number,
> > > i.e. replace "12" with "20" (or whatever number you want there).
> >
> > How can I do it with elisp code ? I am constructing my own modeline.
>
>
> mode-line-format is a variable, so you can use setq to modify its
> value. Or you could modify just the value of
> mode-line-buffer-identification, another variable (which is used to
> construct the value of mode-line-format), which is where "%12b" comes
> from.
>
> More generally, take a look at lisp/bindings.el, where all the parts
> of mode-line-format are defined and then used to produce the final
> value of that variable.
If I change mode-line-buffer-identification, would I not loose the text
properties and the local-map for the mouse action ? Somehow I have to put
those back.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 15:40 ` Heime
@ 2024-07-24 16:07 ` Yuri Khan
2024-07-24 16:30 ` Heime
2024-07-24 16:35 ` Eli Zaretskii
1 sibling, 1 reply; 55+ messages in thread
From: Yuri Khan @ 2024-07-24 16:07 UTC (permalink / raw)
To: Heime; +Cc: Eli Zaretskii, help-gnu-emacs
On Wed, 24 Jul 2024 at 22:40, Heime <heimeborgia@protonmail.com> wrote:
> On Thursday, July 25th, 2024 at 1:23 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > More generally, take a look at lisp/bindings.el, where all the parts
> > of mode-line-format are defined and then used to produce the final
> > value of that variable.
>
> If I change mode-line-buffer-identification, would I not loose the text
> properties and the local-map for the mouse action ? Somehow I have to put
> those back.
Have you actually looked at the definition of mode-line-buffer-identification?
(defvar-local mode-line-buffer-identification
(propertized-buffer-identification "%12b")
"…docstring…")
Reuse the wrapper. Change the payload.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 16:07 ` Yuri Khan
@ 2024-07-24 16:30 ` Heime
2024-07-25 7:18 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-24 16:30 UTC (permalink / raw)
To: Yuri Khan; +Cc: Eli Zaretskii, help-gnu-emacs
On Thursday, July 25th, 2024 at 4:07 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Wed, 24 Jul 2024 at 22:40, Heime heimeborgia@protonmail.com wrote:
>
> > On Thursday, July 25th, 2024 at 1:23 AM, Eli Zaretskii eliz@gnu.org wrote:
> >
> > > More generally, take a look at lisp/bindings.el, where all the parts
> > > of mode-line-format are defined and then used to produce the final
> > > value of that variable.
> >
> > If I change mode-line-buffer-identification, would I not loose the text
> > properties and the local-map for the mouse action ? Somehow I have to put
> > those back.
>
>
> Have you actually looked at the definition of mode-line-buffer-identification?
>
> (defvar-local mode-line-buffer-identification
> (propertized-buffer-identification "%12b")
> "…docstring…")
>
> Reuse the wrapper. Change the payload.
I am not sure whether there are hidden text properties. You all talk to me
in the abstract, expecting me to know what to do.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 15:40 ` Heime
2024-07-24 16:07 ` Yuri Khan
@ 2024-07-24 16:35 ` Eli Zaretskii
2024-07-24 16:45 ` Heime
1 sibling, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-24 16:35 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 15:40:01 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: help-gnu-emacs@gnu.org
>
> > mode-line-format is a variable, so you can use setq to modify its
> > value. Or you could modify just the value of
> > mode-line-buffer-identification, another variable (which is used to
> > construct the value of mode-line-format), which is where "%12b" comes
> > from.
> >
> > More generally, take a look at lisp/bindings.el, where all the parts
> > of mode-line-format are defined and then used to produce the final
> > value of that variable.
>
> If I change mode-line-buffer-identification, would I not loose the text
> properties and the local-map for the mouse action ? Somehow I have to put
> those back.
If you only change the "12" part of the value of that variable, and
leave the rest (in particular, the 'propertize' part) intact, the
properties will still be the same.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 16:35 ` Eli Zaretskii
@ 2024-07-24 16:45 ` Heime
0 siblings, 0 replies; 55+ messages in thread
From: Heime @ 2024-07-24 16:45 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Thursday, July 25th, 2024 at 4:35 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 15:40:01 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: help-gnu-emacs@gnu.org
> >
> > > mode-line-format is a variable, so you can use setq to modify its
> > > value. Or you could modify just the value of
> > > mode-line-buffer-identification, another variable (which is used to
> > > construct the value of mode-line-format), which is where "%12b" comes
> > > from.
> > >
> > > More generally, take a look at lisp/bindings.el, where all the parts
> > > of mode-line-format are defined and then used to produce the final
> > > value of that variable.
> >
> > If I change mode-line-buffer-identification, would I not loose the text
> > properties and the local-map for the mouse action ? Somehow I have to put
> > those back.
>
>
> If you only change the "12" part of the value of that variable, and
> leave the rest (in particular, the 'propertize' part) intact, the
> properties will still be the same.
Like this ?
(let ((current-value (symbol-value 'mode-line-buffer-identification)))
(when (and (listp current-value)
(stringp (car current-value)) )
(let ((new-value (replace-regexp-in-string "%12b" "%20b" (car current-value))))
(setcar current-value new-value)
(setq mode-line-buffer-identification current-value))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-24 16:30 ` Heime
@ 2024-07-25 7:18 ` Eli Zaretskii
[not found] ` <xcc1gVM6XKE-ico4XNriwG861wQPgutbXkfzbmOm-zJodpgHcHGR1huyU9K6BxLKj74YmoIgW1gJ=5FKLijHm5xBpeE8=5FZOS0Gt004N88wyoI=3D@protonmail.com>
2024-07-25 12:39 ` Heime
0 siblings, 2 replies; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-25 7:18 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Wed, 24 Jul 2024 16:30:51 +0000
> From: Heime <heimeborgia@protonmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, help-gnu-emacs@gnu.org
>
> > > > More generally, take a look at lisp/bindings.el, where all the parts
> > > > of mode-line-format are defined and then used to produce the final
> > > > value of that variable.
> > >
> > > If I change mode-line-buffer-identification, would I not loose the text
> > > properties and the local-map for the mouse action ? Somehow I have to put
> > > those back.
> >
> >
> > Have you actually looked at the definition of mode-line-buffer-identification?
> >
> > (defvar-local mode-line-buffer-identification
> > (propertized-buffer-identification "%12b")
> > "…docstring…")
> >
> > Reuse the wrapper. Change the payload.
>
> I am not sure whether there are hidden text properties. You all talk to me
> in the abstract, expecting me to know what to do.
The text properties are all generated by
propertized-buffer-identification, so if you leave that intact and
only change "%12b" to "%20b", all the rest should be as it was before.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 7:18 ` Eli Zaretskii
[not found] ` <xcc1gVM6XKE-ico4XNriwG861wQPgutbXkfzbmOm-zJodpgHcHGR1huyU9K6BxLKj74YmoIgW1gJ=5FKLijHm5xBpeE8=5FZOS0Gt004N88wyoI=3D@protonmail.com>
@ 2024-07-25 12:39 ` Heime
2024-07-25 12:50 ` Yuri Khan
1 sibling, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-25 12:39 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
Sent with Proton Mail secure email.
On Thursday, July 25th, 2024 at 7:18 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Wed, 24 Jul 2024 16:30:51 +0000
> > From: Heime heimeborgia@protonmail.com
> > Cc: Eli Zaretskii eliz@gnu.org, help-gnu-emacs@gnu.org
> >
> > > > > More generally, take a look at lisp/bindings.el, where all the parts
> > > > > of mode-line-format are defined and then used to produce the final
> > > > > value of that variable.
> > > >
> > > > If I change mode-line-buffer-identification, would I not loose the text
> > > > properties and the local-map for the mouse action ? Somehow I have to put
> > > > those back.
> > >
> > > Have you actually looked at the definition of mode-line-buffer-identification?
> > >
> > > (defvar-local mode-line-buffer-identification
> > > (propertized-buffer-identification "%12b")
> > > "…docstring…")
> > >
> > > Reuse the wrapper. Change the payload.
> >
> > I am not sure whether there are hidden text properties. You all talk to me
> > in the abstract, expecting me to know what to do.
>
>
> The text properties are all generated by
> propertized-buffer-identification, so if you leave that intact and
> only change "%12b" to "%20b", all the rest should be as it was before.
You really need to assist me with the code. Have been working on modifying
the width as seen in vodil-width.
propertized-buffer-identification is a function that is used to construct
all the details including the keymap. You previously mentioned that I do not
need to handle any keymade, but just change the numeric value
(defun vodil-width (new-width)
"Update the width of the buffer name in the mode line to NEW-WIDTH."
(let* ( (current-format
(format-mode-line mode-line-buffer-identification))
(new-format
(replace-regexp-in-string "%[0-9]+b"
(format "%%%db" new-width) current-format)))
(setq mode-line-buffer-identification new-format)))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 12:39 ` Heime
@ 2024-07-25 12:50 ` Yuri Khan
2024-07-25 13:20 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Yuri Khan @ 2024-07-25 12:50 UTC (permalink / raw)
To: Heime; +Cc: Eli Zaretskii, help-gnu-emacs
On Thu, 25 Jul 2024 at 19:39, Heime <heimeborgia@protonmail.com> wrote:
> > The text properties are all generated by
> > propertized-buffer-identification, so if you leave that intact and
> > only change "%12b" to "%20b", all the rest should be as it was before.
>
> You really need to assist me with the code. Have been working on modifying
> the width as seen in vodil-width.
>
> (defun vodil-width (new-width)
> "Update the width of the buffer name in the mode line to NEW-WIDTH."
>
> (let* ( (current-format
> (format-mode-line mode-line-buffer-identification))
> (new-format
> (replace-regexp-in-string "%[0-9]+b"
> (format "%%%db" new-width) current-format)))
>
> (setq mode-line-buffer-identification new-format)))
You are making it much more difficult for yourself. Just put the
following into your init file:
(setq mode-line-buffer-identification
(propertized-buffer-identification "%20b"))
If you insist on having a function that accepts the new width as a number:
(defun my-set-mode-line-buffer-identification-width (new-width)
(setq mode-line-buffer-identification
(propertized-buffer-identification
(format "%%%db" new-width))))
…but you really should not need this unless you are frequently
switching between very large and very small monitors.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 12:50 ` Yuri Khan
@ 2024-07-25 13:20 ` Heime
2024-07-25 15:26 ` Yuri Khan
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-25 13:20 UTC (permalink / raw)
To: Yuri Khan; +Cc: Eli Zaretskii, help-gnu-emacs
Sent with Proton Mail secure email.
On Friday, July 26th, 2024 at 12:50 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Thu, 25 Jul 2024 at 19:39, Heime heimeborgia@protonmail.com wrote:
>
> > > The text properties are all generated by
> > > propertized-buffer-identification, so if you leave that intact and
> > > only change "%12b" to "%20b", all the rest should be as it was before.
> >
> > You really need to assist me with the code. Have been working on modifying
> > the width as seen in vodil-width.
> >
> > (defun vodil-width (new-width)
> > "Update the width of the buffer name in the mode line to NEW-WIDTH."
> >
> > (let* ( (current-format
> > (format-mode-line mode-line-buffer-identification))
> > (new-format
> > (replace-regexp-in-string "%[0-9]+b"
> > (format "%%%db" new-width) current-format)))
> >
> > (setq mode-line-buffer-identification new-format)))
>
>
> You are making it much more difficult for yourself. Just put the
> following into your init file:
>
> (setq mode-line-buffer-identification
> (propertized-buffer-identification "%20b"))
>
> If you insist on having a function that accepts the new width as a number:
>
> (defun my-set-mode-line-buffer-identification-width (new-width)
> (setq mode-line-buffer-identification
> (propertized-buffer-identification
> (format "%%%db" new-width))))
>
> …but you really should not need this unless you are frequently
> switching between very large and very small monitors.
I understand. propertized-buffer-identification has hardwired keymap etc
and calling it only sets the format used for the buffer identification
name.
Correct, at work I have very large screen, but very small laptops otherwise.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 13:20 ` Heime
@ 2024-07-25 15:26 ` Yuri Khan
2024-07-25 16:01 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Yuri Khan @ 2024-07-25 15:26 UTC (permalink / raw)
To: Heime; +Cc: Eli Zaretskii, help-gnu-emacs
On Thu, 25 Jul 2024 at 20:20, Heime <heimeborgia@protonmail.com> wrote:
> I understand. propertized-buffer-identification has hardwired keymap etc
It hardwires the keymap to the value of the variable
‘mode-line-buffer-identification-keymap’, but you are allowed to
modify that variable.
> and calling it only sets the format used for the buffer identification
> name.
I’m pretty sure it will set the format for whatever modeline
constructs you pass in.
That said, the function ‘propertized-buffer-identification’ is not
very complex; you can copy it and adapt for your custom modeline
parts.
(For myself, I’m not bothering with mouse bindings. Switching buffers
one step at a time only really works when you have three or so, and
that just does not happen. Switching between a few hundred buffers is
better done via IBuffer anyway.)
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 15:26 ` Yuri Khan
@ 2024-07-25 16:01 ` Heime
2024-07-25 17:27 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-25 16:01 UTC (permalink / raw)
To: Yuri Khan; +Cc: Eli Zaretskii, help-gnu-emacs
Sent with Proton Mail secure email.
On Friday, July 26th, 2024 at 3:26 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Thu, 25 Jul 2024 at 20:20, Heime heimeborgia@protonmail.com wrote:
>
> > I understand. propertized-buffer-identification has hardwired keymap etc
>
>
> It hardwires the keymap to the value of the variable
> ‘mode-line-buffer-identification-keymap’, but you are allowed to
> modify that variable.
>
> > and calling it only sets the format used for the buffer identification
> > name.
>
>
> I’m pretty sure it will set the format for whatever modeline
> constructs you pass in.
>
> That said, the function ‘propertized-buffer-identification’ is not
> very complex; you can copy it and adapt for your custom modeline
> parts.
>
> (For myself, I’m not bothering with mouse bindings. Switching buffers
> one step at a time only really works when you have three or so, and
> that just does not happen. Switching between a few hundred buffers is
> better done via IBuffer anyway.)
Agreed, but since it is how buffer-identificoation works in the modeline, I did
not want to mess with it.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 16:01 ` Heime
@ 2024-07-25 17:27 ` Heime
2024-07-25 18:18 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-25 17:27 UTC (permalink / raw)
To: Heime; +Cc: Yuri Khan, Eli Zaretskii, help-gnu-emacs
Sent with Proton Mail secure email.
On Friday, July 26th, 2024 at 4:01 AM, Heime <heimeborgia@protonmail.com> wrote:
>
>
>
>
>
> Sent with Proton Mail secure email.
>
>
> On Friday, July 26th, 2024 at 3:26 AM, Yuri Khan yuri.v.khan@gmail.com wrote:
>
> > On Thu, 25 Jul 2024 at 20:20, Heime heimeborgia@protonmail.com wrote:
> >
> > > I understand. propertized-buffer-identification has hardwired keymap etc
> >
> > It hardwires the keymap to the value of the variable
> > ‘mode-line-buffer-identification-keymap’, but you are allowed to
> > modify that variable.
> >
> > > and calling it only sets the format used for the buffer identification
> > > name.
> >
> > I’m pretty sure it will set the format for whatever modeline
> > constructs you pass in.
> >
> > That said, the function ‘propertized-buffer-identification’ is not
> > very complex; you can copy it and adapt for your custom modeline
> > parts.
> >
> > (For myself, I’m not bothering with mouse bindings. Switching buffers
> > one step at a time only really works when you have three or so, and
> > that just does not happen. Switching between a few hundred buffers is
> > better done via IBuffer anyway.)
>
>
> Agreed, but since it is how buffer-identificoation works in the modeline, I did
> not want to mess with it.
Have done as instructed
(defun vodil-bfnwidth (width)
(setq mode-line-buffer-identification
(propertized-buffer-identification (format "%%%db" width))))
(defvar vodil-deploy-bfname nil "")
(unless vodil-deploy-bfname
(vodil-bfnwidth 5))
(setq-default mode-line-format
'( "%e"
(:eval (if vodil-deploy-bfname
vodil-panelit-bfname
mode-line-buffer-identification)))) )
Still, I cannot see any difference in the buffer name width.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 17:27 ` Heime
@ 2024-07-25 18:18 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-25 19:23 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-25 18:18 UTC (permalink / raw)
To: help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
> (defun vodil-bfnwidth (width)
> (setq mode-line-buffer-identification
> (propertized-buffer-identification (format "%%%db" width))))
>
> (defvar vodil-deploy-bfname nil "")
>
> (unless vodil-deploy-bfname
> (vodil-bfnwidth 5))
>
> (setq-default mode-line-format
> '( "%e"
> (:eval (if vodil-deploy-bfname
> vodil-panelit-bfname
> mode-line-buffer-identification)))) )
You only have a visible effect if you add something after the buffer
identification.
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 18:18 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-25 19:23 ` Heime
2024-07-26 11:38 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-25 19:23 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
Sent with Proton Mail secure email.
On Friday, July 26th, 2024 at 6:18 AM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > (defun vodil-bfnwidth (width)
> > (setq mode-line-buffer-identification
> > (propertized-buffer-identification (format "%%%db" width))))
> >
> > (defvar vodil-deploy-bfname nil "")
> >
> > (unless vodil-deploy-bfname
> > (vodil-bfnwidth 5))
> >
> > (setq-default mode-line-format
> > '( "%e"
> > (:eval (if vodil-deploy-bfname
> > vodil-panelit-bfname
> > mode-line-buffer-identification)))) )
>
>
> You only have a visible effect if you add something after the buffer
> identification.
>
>
> Michael.
What you mean add something after the buffer identification.
Why all this complication.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-25 19:23 ` Heime
@ 2024-07-26 11:38 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-26 12:47 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-26 11:38 UTC (permalink / raw)
To: help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
> What you mean add something after the buffer identification.
In the mode-line of course, to be able to see an effect of setting the
width?
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 11:38 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-26 12:47 ` Heime
2024-07-26 13:26 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-26 12:47 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
On Friday, July 26th, 2024 at 11:38 PM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > What you mean add something after the buffer identification.
>
>
> In the mode-line of course, to be able to see an effect of setting the
> width? - Michael.
Why should that be a requirement. For instance, one could only want the buffer name
in the mode line. And anyway, adding other things after mode-line-buffer-identificiation
makes no difference. The buffer name gets printed and the width always gets neglected.
Meaning that if a buffer name length exceeds the width, the full buffer name is still
printed. Something must be wrong because it should not be this hard to change this minor
buffer name appearance.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 12:47 ` Heime
@ 2024-07-26 13:26 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-26 14:18 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-26 13:26 UTC (permalink / raw)
To: help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
> Meaning that if a buffer name length exceeds the width, the full
> buffer name is still printed. Something must be wrong because it
> should not be this hard to change this minor buffer name appearance.
I think I see now one reason of your confusion:
| In any construct except ‘%%’, you can add a decimal integer after the
| ‘%’ to specify a minimum field width.
See (info "(elisp) %-Constructs"). Not the maximum width. Ok?
To truncate a string, use `truncate-string-to-width'. Or, if you want
to rely on mode-line special constructs,
| ‘(WIDTH REST...)’
| 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 −WIDTH columns if its width
| exceeds −WIDTH.
See (info "(elisp) Mode Line Data").
I guess it could be less confusing and annoying for you to have a look
at those parts of the manual.
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 13:26 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-26 14:18 ` Heime
2024-07-26 14:40 ` Yuri Khan
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-26 14:18 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
On Saturday, July 27th, 2024 at 1:26 AM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > Meaning that if a buffer name length exceeds the width, the full
> > buffer name is still printed. Something must be wrong because it
> > should not be this hard to change this minor buffer name appearance.
>
>
> I think I see now one reason of your confusion:
>
> | In any construct except ‘%%’, you can add a decimal integer after the
> | ‘%’ to specify a minimum field width.
>
> See (info "(elisp) %-Constructs"). Not the maximum width. Ok?
>
> To truncate a string, use `truncate-string-to-width'. Or, if you want
> to rely on mode-line special constructs,
>
> | ‘(WIDTH REST...)’
> | 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 −WIDTH columns if its width
> | exceeds −WIDTH.
>
> See (info "(elisp) Mode Line Data").
>
> I guess it could be less confusing and annoying for you to have a look
> at those parts of the manual. - Michael.
For case of (WIDTH REST...), what do I have to do exactly ?
Certainly not this way
(setq-default mode-line-buffer-identification
(list 8
(propertized-buffer-identification (format "%%%db" width))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 14:18 ` Heime
@ 2024-07-26 14:40 ` Yuri Khan
2024-07-26 15:03 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Yuri Khan @ 2024-07-26 14:40 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen, help-gnu-emacs
On Fri, 26 Jul 2024 at 21:19, Heime <heimeborgia@protonmail.com> wrote:
> > | ‘(WIDTH REST...)’
> > | 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 −WIDTH columns if its width
> > | exceeds −WIDTH.
>
> For case of (WIDTH REST...), what do I have to do exactly ?
Have you read the explanation about positive and negative WIDTHs above?
> Certainly not this way
>
> (setq-default mode-line-buffer-identification
> (list 8
> (propertized-buffer-identification (format "%%%db" width))))
This seems to work for me:
(setq-default mode-line-buffer-identification
(list -8 (propertized-buffer-identification "%b")))
-8 specifies truncation to 8 characters. And we don’t need to pad if
we’re going to truncate anyway.
(8 is way too small for a buffer name though.)
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 14:40 ` Yuri Khan
@ 2024-07-26 15:03 ` Heime
2024-07-26 17:32 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-26 15:03 UTC (permalink / raw)
To: Yuri Khan; +Cc: Michael Heerdegen, help-gnu-emacs
Sent with Proton Mail secure email.
On Saturday, July 27th, 2024 at 2:40 AM, Yuri Khan <yuri.v.khan@gmail.com> wrote:
> On Fri, 26 Jul 2024 at 21:19, Heime heimeborgia@protonmail.com wrote:
>
>
>
> > > | ‘(WIDTH REST...)’
> > > | 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 −WIDTH columns if its width
> > > | exceeds −WIDTH.
> >
> > For case of (WIDTH REST...), what do I have to do exactly ?
>
>
> Have you read the explanation about positive and negative WIDTHs above?
>
> > Certainly not this way
> >
> > (setq-default mode-line-buffer-identification
> > (list 8
> > (propertized-buffer-identification (format "%%%db" width))))
>
>
> This seems to work for me:
>
> (setq-default mode-line-buffer-identification
> (list -8 (propertized-buffer-identification "%b")))
>
> -8 specifies truncation to 8 characters. And we don’t need to pad if
> we’re going to truncate anyway.
>
> (8 is way too small for a buffer name though.)
Have noticed that doing like this crashes emacs
(setq-default mode-line-buffer-identification
(list wmin (propertized-buffer-identification
(format "%%%db" wmax))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 15:03 ` Heime
@ 2024-07-26 17:32 ` Heime
2024-07-26 20:30 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-26 17:32 UTC (permalink / raw)
To: Heime; +Cc: Yuri Khan, Michael Heerdegen, help-gnu-emacs
Sent with Proton Mail secure email.
On Saturday, July 27th, 2024 at 3:03 AM, Heime <heimeborgia@protonmail.com> wrote:
>
>
>
>
>
> Sent with Proton Mail secure email.
>
>
> On Saturday, July 27th, 2024 at 2:40 AM, Yuri Khan yuri.v.khan@gmail.com wrote:
>
> > On Fri, 26 Jul 2024 at 21:19, Heime heimeborgia@protonmail.com wrote:
> >
> > > > | ‘(WIDTH REST...)’
> > > > | 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 −WIDTH columns if its width
> > > > | exceeds −WIDTH.
> > >
> > > For case of (WIDTH REST...), what do I have to do exactly ?
> >
> > Have you read the explanation about positive and negative WIDTHs above?
> >
> > > Certainly not this way
> > >
> > > (setq-default mode-line-buffer-identification
> > > (list 8
> > > (propertized-buffer-identification (format "%%%db" width))))
> >
> > This seems to work for me:
> >
> > (setq-default mode-line-buffer-identification
> > (list -8 (propertized-buffer-identification "%b")))
> >
> > -8 specifies truncation to 8 characters. And we don’t need to pad if
> > we’re going to truncate anyway.
> >
> > (8 is way too small for a buffer name though.)
>
I wanted to add ... for long names but the buffer name is not correct.
(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))))) )
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 17:32 ` Heime
@ 2024-07-26 20:30 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-27 6:01 ` Eli Zaretskii
0 siblings, 1 reply; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-26 20:30 UTC (permalink / raw)
To: help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
> I wanted to add ... for long names but the buffer name is not correct.
>
> (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))))) )
This is expected: the display engine doesn't switch buffers when drawing
mode-lines all the time. With other words: In the above context the
return value of `buffer-name' does not always correspond to the buffer
of the window whose mode-line gets computed.
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-26 20:30 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-27 6:01 ` Eli Zaretskii
2024-07-27 11:08 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Eli Zaretskii @ 2024-07-27 6:01 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Fri, 26 Jul 2024 22:30:21 +0200
> From: Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>
> > (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))))) )
>
> This is expected: the display engine doesn't switch buffers when drawing
> mode-lines all the time. With other words: In the above context the
> return value of `buffer-name' does not always correspond to the buffer
> of the window whose mode-line gets computed.
IOW, instead of (buffer-name), one should probably use something like
(buffer-name (window-buffer))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-27 6:01 ` Eli Zaretskii
@ 2024-07-27 11:08 ` Heime
2024-07-27 12:06 ` Michael Heerdegen via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-27 11:08 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: help-gnu-emacs
On Saturday, July 27th, 2024 at 6:01 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Fri, 26 Jul 2024 22:30:21 +0200
> > From: Michael Heerdegen via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org
> >
> > > (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))))) )
> >
> > This is expected: the display engine doesn't switch buffers when drawing
> > mode-lines all the time. With other words: In the above context the
> > return value of `buffer-name' does not always correspond to the buffer
> > of the window whose mode-line gets computed.
>
>
> IOW, instead of (buffer-name), one should probably use something like
>
> (buffer-name (window-buffer))
With your replacement, the buffer name is still not getting updated, even though
the window gets updated with the correct buffer.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-27 11:08 ` Heime
@ 2024-07-27 12:06 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-28 11:00 ` Heime
2024-07-29 10:26 ` Michael Heerdegen
0 siblings, 2 replies; 55+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-27 12:06 UTC (permalink / raw)
To: help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
> > (buffer-name (window-buffer))
>
> With your replacement, the buffer name is still not getting updated,
> even though the window gets updated with the correct buffer.
I vaguely remember that this won't work. I suggest you use "%b".
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-27 12:06 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-28 11:00 ` Heime
2024-07-28 15:30 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-29 10:26 ` Michael Heerdegen
1 sibling, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-28 11:00 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
On Sunday, July 28th, 2024 at 12:05 AM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
> > > (buffer-name (window-buffer))
> >
> > With your replacement, the buffer name is still not getting updated,
> > even though the window gets updated with the correct buffer.
>
>
> I vaguely remember that this won't work. I suggest you use "%b".
>
>
> Michael.
Nothing suggested actually solves the problem. So there must get some
fixes to allow the possibilities people think should happen.
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 11:00 ` Heime
@ 2024-07-28 15:30 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 16:14 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2024-07-28 15:30 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen, help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
[...]
> Nothing suggested actually solves the problem. So there must get some
> fixes to allow the possibilities people think should happen.
Hi,
I'm replying here because a debbugs is not the place.
You were almost there with this piece of code:
--8<---------------cut here---------------start------------->8---
(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))))
--8<---------------cut here---------------end--------------->8---
... but you have an error in your last line. What do you get when you
do 'M-: mode-line-buffer-identification'?
--
Manuel Giraud
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 15:30 ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2024-07-28 16:14 ` Heime
2024-07-28 16:53 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-28 16:14 UTC (permalink / raw)
To: Manuel Giraud; +Cc: Michael Heerdegen, help-gnu-emacs
Sent with Proton Mail secure email.
On Monday, July 29th, 2024 at 3:30 AM, Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
>
> [...]
>
> > Nothing suggested actually solves the problem. So there must get some
> > fixes to allow the possibilities people think should happen.
>
>
> Hi,
>
> I'm replying here because a debbugs is not the place.
>
> You were almost there with this piece of code:
> --8<---------------cut here---------------start------------->8---
>
> (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))))
> --8<---------------cut here---------------end--------------->8---
>
>
> ... but you have an error in your last line. What do you get when you
> do 'M-: mode-line-buffer-identification'?
> --
> Manuel Giraud
I do not get any buffer name printed
I do (vodil-tkbfn 13) after the function declaration
(defun vodil-tkbfn (wmax)
(setq-default mode-line-buffer-identification
'(:eval (prevodilac-tkbfn-ellipses wmax))))
(vodil-tkbfn 8)
(setq-default mode-line-format
'( "%e"
(:eval (if vodil-deploy-bfname
vodil-panelit-bfname
mode-line-buffer-identification))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 16:14 ` Heime
@ 2024-07-28 16:53 ` Heime
2024-07-28 17:29 ` Heime
0 siblings, 1 reply; 55+ messages in thread
From: Heime @ 2024-07-28 16:53 UTC (permalink / raw)
To: Heime; +Cc: Manuel Giraud, Michael Heerdegen, help-gnu-emacs
Sent with Proton Mail secure email.
On Monday, July 29th, 2024 at 4:14 AM, Heime <heimeborgia@protonmail.com> wrote:
>
>
>
>
>
> Sent with Proton Mail secure email.
>
>
> On Monday, July 29th, 2024 at 3:30 AM, Manuel Giraud via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
>
> > Heime heimeborgia@protonmail.com writes:
> >
> > [...]
> >
> > > Nothing suggested actually solves the problem. So there must get some
> > > fixes to allow the possibilities people think should happen.
> >
> > Hi,
> >
> > I'm replying here because a debbugs is not the place.
> >
> > You were almost there with this piece of code:
> > --8<---------------cut here---------------start------------->8---
> >
> > (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))))
> > --8<---------------cut here---------------end--------------->8---
> >
> > ... but you have an error in your last line. What do you get when you
> > do 'M-: mode-line-buffer-identification'?
> > --
> > Manuel Giraud
I got this
Error during redisplay:
(eval (prevodilac-tkbfn-ellipses wmax)) signaled (void-variable wmax) [77 times]
I do (vodil-tkbfn 8) after the function declaration
(defun vodil-tkbfn (wmax)
(setq-default mode-line-buffer-identification
'(:eval (vodil-tkbfn-ellipses wmax))))
(vodil-tkbfn 8)
(setq-default mode-line-format
'( "%e"
(:eval (if vodil-deploy-bfname
vodil-panelit-bfname
mode-line-buffer-identification))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 16:53 ` Heime
@ 2024-07-28 17:29 ` Heime
2024-07-28 17:46 ` Christopher Dimech
2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 55+ messages in thread
From: Heime @ 2024-07-28 17:29 UTC (permalink / raw)
To: Heime; +Cc: Manuel Giraud, Michael Heerdegen, help-gnu-emacs
Sent with Proton Mail secure email.
On Monday, July 29th, 2024 at 4:53 AM, Heime <heimeborgia@protonmail.com> wrote:
>
>
>
>
>
> Sent with Proton Mail secure email.
>
>
> On Monday, July 29th, 2024 at 4:14 AM, Heime heimeborgia@protonmail.com wrote:
>
> > Sent with Proton Mail secure email.
> >
> > On Monday, July 29th, 2024 at 3:30 AM, Manuel Giraud via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
> >
> > > Heime heimeborgia@protonmail.com writes:
> > >
> > > [...]
> > >
> > > > Nothing suggested actually solves the problem. So there must get some
> > > > fixes to allow the possibilities people think should happen.
> > >
> > > Hi,
> > >
> > > I'm replying here because a debbugs is not the place.
> > >
> > > You were almost there with this piece of code:
> > > --8<---------------cut here---------------start------------->8---
> > >
> > > (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))))
> > > --8<---------------cut here---------------end--------------->8---
> > >
> > > ... but you have an error in your last line. What do you get when you
> > > do 'M-: mode-line-buffer-identification'?
> > > --
> > > Manuel Giraud
If I hardwire the value with '(:eval (vodil-tkbfn-ellipses 13)) things do work,
but not when I try to apply a user defined value using a variable via a function.
This fails
(defun vodil-tkbfn (wmax)
(setq-default mode-line-buffer-identification
'(:eval (vodil-tkbfn-ellipses wmax))))
(vodil-tkbfn 13)
This works
(defun vodil-tkbfn (wmax)
(setq-default mode-line-buffer-identification
'(:eval (vodil-tkbfn-ellipses 13))))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Operation of format-mode-line
2024-07-28 17:29 ` Heime
@ 2024-07-28 17:46 ` Christopher Dimech
2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 55+ messages in thread
From: Christopher Dimech @ 2024-07-28 17:46 UTC (permalink / raw)
To: Heime; +Cc: Heime, Manuel Giraud, Michael Heerdegen, help-gnu-emacs
----- Kristof Đymek
Administrator General - Chilkat Design Build - Naiad Informatics - Gnu Project
Society has become too quick to pass judgement and declare someone
Persona Non-Grata, the most extreme form of censure a country can
bestow.
In a new era of destructive authoritarianism, I support Richard
Stallman. Times of great crisis are also times of great
opportunity. I call upon you to make this struggle yours as well !
https://www.gnu.org https://www.fsf.org/
> Sent: Monday, July 29, 2024 at 5:29 AM
> From: "Heime" <heimeborgia@protonmail.com>
> To: "Heime" <heimeborgia@protonmail.com>
> Cc: "Manuel Giraud" <manuel@ledu-giraud.fr>, "Michael Heerdegen" <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
> Subject: Re: Operation of format-mode-line
>
>
>
>
>
>
> Sent with Proton Mail secure email.
>
> On Monday, July 29th, 2024 at 4:53 AM, Heime <heimeborgia@protonmail.com> wrote:
>
> >
> >
> >
> >
> >
> > Sent with Proton Mail secure email.
> >
> >
> > On Monday, July 29th, 2024 at 4:14 AM, Heime heimeborgia@protonmail.com wrote:
> >
> > > Sent with Proton Mail secure email.
> > >
> > > On Monday, July 29th, 2024 at 3:30 AM, Manuel Giraud via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org wrote:
> > >
> > > > Heime heimeborgia@protonmail.com writes:
> > > >
> > > > [...]
> > > >
> > > > > Nothing suggested actually solves the problem. So there must get some
> > > > > fixes to allow the possibilities people think should happen.
> > > >
> > > > Hi,
> > > >
> > > > I'm replying here because a debbugs is not the place.
> > > >
> > > > You were almost there with this piece of code:
> > > > --8<---------------cut here---------------start------------->8---
> > > >
> > > > (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))))
> > > > --8<---------------cut here---------------end--------------->8---
> > > >
> > > > ... but you have an error in your last line. What do you get when you
> > > > do 'M-: mode-line-buffer-identification'?
> > > > --
> > > > Manuel Giraud
>
> If I hardwire the value with '(:eval (vodil-tkbfn-ellipses 13)) things do work,
> but not when I try to apply a user defined value using a variable via a function.
>
> This fails
>
> (defun vodil-tkbfn (wmax)
> (setq-default mode-line-buffer-identification
> '(:eval (vodil-tkbfn-ellipses wmax))))
>
> (vodil-tkbfn 13)
>
> This works
>
> (defun vodil-tkbfn (wmax)
> (setq-default mode-line-buffer-identification
> '(:eval (vodil-tkbfn-ellipses 13))))
>
It needs dynamic capture of the variable wmax
`(:eval (vodil-tkbfn-ellipses ,wmax))
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 17:29 ` Heime
2024-07-28 17:46 ` Christopher Dimech
@ 2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 18:39 ` Heime
2024-07-28 20:48 ` [External] : " Drew Adams
1 sibling, 2 replies; 55+ messages in thread
From: Manuel Giraud via Users list for the GNU Emacs text editor @ 2024-07-28 17:59 UTC (permalink / raw)
To: Heime; +Cc: Michael Heerdegen, help-gnu-emacs
Heime <heimeborgia@protonmail.com> writes:
[...]
> If I hardwire the value with '(:eval (vodil-tkbfn-ellipses 13)) things do work,
> but not when I try to apply a user defined value using a variable via a function.
>
> This fails
>
> (defun vodil-tkbfn (wmax)
> (setq-default mode-line-buffer-identification
> '(:eval (vodil-tkbfn-ellipses wmax))))
>
> (vodil-tkbfn 13)
It seems that you're onto something. Now go read "(elisp) Backquote"
(or cheat with Chistopher Dimech answer). The former will be more
valuable.
--
Manuel Giraud
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
@ 2024-07-28 18:39 ` Heime
2024-07-28 20:48 ` [External] : " Drew Adams
1 sibling, 0 replies; 55+ messages in thread
From: Heime @ 2024-07-28 18:39 UTC (permalink / raw)
To: Manuel Giraud; +Cc: Michael Heerdegen, help-gnu-emacs
On Monday, July 29th, 2024 at 5:59 AM, Manuel Giraud via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> Heime heimeborgia@protonmail.com writes:
>
>
> [...]
>
> > If I hardwire the value with '(:eval (vodil-tkbfn-ellipses 13)) things do work,
> > but not when I try to apply a user defined value using a variable via a function.
> >
> > This fails
> >
> > (defun vodil-tkbfn (wmax)
> > (setq-default mode-line-buffer-identification
> > '(:eval (vodil-tkbfn-ellipses wmax))))
> >
> > (vodil-tkbfn 13)
>
>
> It seems that you're onto something. Now go read "(elisp) Backquote"
> (or cheat with Chistopher Dimech answer). The former will be more
> valuable.
> --
> Manuel Giraud
Indeed, the Backquote approach was required. This buffer-identification
was quite difficult to work with.
^ permalink raw reply [flat|nested] 55+ messages in thread
* RE: [External] : Re: Operation of format-mode-line
2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 18:39 ` Heime
@ 2024-07-28 20:48 ` Drew Adams
1 sibling, 0 replies; 55+ messages in thread
From: Drew Adams @ 2024-07-28 20:48 UTC (permalink / raw)
To: Manuel Giraud, Heime
Cc: Michael Heerdegen,
'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)'
[-- Attachment #1: Type: text/plain, Size: 859 bytes --]
Seems help-gnu-emacs@gnu.org was missing
with "Reply All", so sending this again.
> > > If I hardwire the value with '(:eval (vodil-tkbfn-ellipses 13))
> things
> > do work,
> > > but not when I try to apply a user defined value using a variable
> via
> > a function.
> > >
> > > This fails
> > >
> > > (defun vodil-tkbfn (wmax)
> > > (setq-default mode-line-buffer-identification
> > > '(:eval (vodil-tkbfn-ellipses wmax))))
> > >
> > > (vodil-tkbfn 13)
> >
> > It seems that you're onto something. Now go read "(elisp) Backquote"
> > (or cheat with Chistopher Dimech answer). The former will be more
> > valuable.
>
> Right.
> This is one of the most common questions.
> It's posed here, with the answer:
>
> https://emacs.stackexchange.com/questions/7481/how-to-evaluate-the-
> variables-before-adding-them-to-a-list
[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 15747 bytes --]
^ permalink raw reply [flat|nested] 55+ messages in thread
* Re: Operation of format-mode-line
2024-07-27 12:06 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-28 11:00 ` Heime
@ 2024-07-29 10:26 ` Michael Heerdegen
1 sibling, 0 replies; 55+ messages in thread
From: Michael Heerdegen @ 2024-07-29 10:26 UTC (permalink / raw)
To: Michael Heerdegen via Users list for the GNU Emacs text editor
Michael Heerdegen via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> > > (buffer-name (window-buffer))
Actually, there is nothing wrong with this suggestion. Works as
expected for me.
Michael.
^ permalink raw reply [flat|nested] 55+ messages in thread
end of thread, other threads:[~2024-07-29 10:26 UTC | newest]
Thread overview: 55+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-22 21:58 Operation of format-mode-line Heime
2024-07-22 23:35 ` Heime
2024-07-23 11:11 ` Eli Zaretskii
2024-07-23 11:08 ` Eli Zaretskii
2024-07-23 16:37 ` Heime
2024-07-23 17:48 ` Eli Zaretskii
2024-07-23 18:56 ` Heime
2024-07-23 19:07 ` Eli Zaretskii
2024-07-23 19:13 ` Heime
2024-07-24 2:25 ` Eli Zaretskii
2024-07-24 2:26 ` Eli Zaretskii
2024-07-24 10:18 ` Heime
2024-07-24 11:47 ` Eli Zaretskii
2024-07-24 12:21 ` Heime
2024-07-24 12:33 ` Eli Zaretskii
2024-07-24 12:45 ` Heime
2024-07-24 12:49 ` Eli Zaretskii
2024-07-24 13:08 ` Heime
2024-07-24 13:23 ` Eli Zaretskii
2024-07-24 14:01 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-24 15:40 ` Heime
2024-07-24 16:07 ` Yuri Khan
2024-07-24 16:30 ` Heime
2024-07-25 7:18 ` Eli Zaretskii
[not found] ` <xcc1gVM6XKE-ico4XNriwG861wQPgutbXkfzbmOm-zJodpgHcHGR1huyU9K6BxLKj74YmoIgW1gJ=5FKLijHm5xBpeE8=5FZOS0Gt004N88wyoI=3D@protonmail.com>
[not found] ` <CAP=5Fd=5F8W6kgSQeeG2j2M3=5Fb1tt+x1wFWRvbYGhhO+SiUKy8DBoQ@mail.gmail.com>
[not found] ` <ct3r-DS=5FknVmOlOCFGzqE7-EZyNzHpRPYvr7TTkpm83DWs6ggCvRkenWdLCAxZTlCmyBFFYmMGRtA mHeL1VWRtrVZQH17UOLirJbvYF7zAk=3D@protonmail.com>
[not found] ` <CAP=5Fd=5F8XV3qskKJogzZY4X=5F+h1wzfR5Q9KYnJKdA504CcG0TvmA@mail.gmail.com>
2024-07-25 12:39 ` Heime
2024-07-25 12:50 ` Yuri Khan
2024-07-25 13:20 ` Heime
2024-07-25 15:26 ` Yuri Khan
2024-07-25 16:01 ` Heime
2024-07-25 17:27 ` Heime
2024-07-25 18:18 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-25 19:23 ` Heime
2024-07-26 11:38 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-26 12:47 ` Heime
2024-07-26 13:26 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-26 14:18 ` Heime
2024-07-26 14:40 ` Yuri Khan
2024-07-26 15:03 ` Heime
2024-07-26 17:32 ` Heime
2024-07-26 20:30 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-27 6:01 ` Eli Zaretskii
2024-07-27 11:08 ` Heime
2024-07-27 12:06 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-28 11:00 ` Heime
2024-07-28 15:30 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 16:14 ` Heime
2024-07-28 16:53 ` Heime
2024-07-28 17:29 ` Heime
2024-07-28 17:46 ` Christopher Dimech
2024-07-28 17:59 ` Manuel Giraud via Users list for the GNU Emacs text editor
2024-07-28 18:39 ` Heime
2024-07-28 20:48 ` [External] : " Drew Adams
2024-07-29 10:26 ` Michael Heerdegen
2024-07-24 16:35 ` Eli Zaretskii
2024-07-24 16:45 ` Heime
[not found] <RHkfCJX8r5At5BX=5Ff30hL2EoYH6qQXzEbjBXr0Lw1DL94KYNXjJsdaLrB-r8fd6-DTqkNbsw1fFi-QzBBtR-lcJGJ5cz22QjLYYhCqqgfvg=3D@protonmail.com>
[not found] ` <f-AU6lFTwKIVxp95wzU6pdhSaxX45u25TLr7ozfvGH=5FDr7B2IhDHVhKR92YDxgzwiaR99n6190RVjtknhebwf8vMT60so-OqhThZdeIzLhs=3D@protonmail.com>
[not found] ` <CAP=5Fd=5F8V7KJr3kji6rhVAA-+6cYjxeQBkYJkSjz4cPt-QDwWWig@mail.gmail.com>
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.