all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
@ 2022-01-29 20:19 José Júnior
  2022-01-30  0:24 ` bug#53629: [External] : " Drew Adams
  2022-01-30 16:18 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 26+ messages in thread
From: José Júnior @ 2022-01-29 20:19 UTC (permalink / raw)
  To: 53629

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

Mode-line has face options for when it's active and inactive but
`mode-line-buffer-id` just allows customization on the active form, please
consider adding the option to allow customizing the face of the
`mode-line-buffer-id` when the mode-line is inactive too.

Thanks.

[-- Attachment #2: Type: text/html, Size: 336 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-29 20:19 bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive José Júnior
@ 2022-01-30  0:24 ` Drew Adams
  2022-01-30 16:46   ` José Júnior
  2022-01-30 16:18 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 26+ messages in thread
From: Drew Adams @ 2022-01-30  0:24 UTC (permalink / raw)
  To: José Júnior, 53629@debbugs.gnu.org

> Mode-line has face options for when it's
> active and inactive but `mode-line-buffer-id`
> just allows customization on the active form,
> please consider adding the option to allow
> customizing the face of the `mode-line-buffer-id`
> when the mode-line is inactive too.

See library `modeline-win.el'.
Does it do what you're looking for?

It highlights the buffer name in the
mode-line for the selected window.

That is, whichever window is currently
selected, its buffer name in the mode
line is highlighted (using face
`mlw-mode-line-buffer-id-selected-window').

The code is here:

https://www.emacswiki.org/emacs/download/modeline-win.el

It's just a few lines of code.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-29 20:19 bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive José Júnior
  2022-01-30  0:24 ` bug#53629: [External] : " Drew Adams
@ 2022-01-30 16:18 ` Lars Ingebrigtsen
  2022-01-30 16:48   ` José Júnior
  1 sibling, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-30 16:18 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629

José Júnior <jjnilton@gmail.com> writes:

> Mode-line has face options for when it's active and inactive but
> `mode-line-buffer-id` just allows customization on the active form,
> please consider adding the option to allow customizing the face of the
> `mode-line-buffer-id` when the mode-line is inactive too.

I'm not quite sure I understand the request.  Do you want to add a new
face for the buffer identification part of the mode line when it's
inactive?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-30  0:24 ` bug#53629: [External] : " Drew Adams
@ 2022-01-30 16:46   ` José Júnior
  2022-01-31 20:09     ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-01-30 16:46 UTC (permalink / raw)
  To: Drew Adams; +Cc: 53629@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1217 bytes --]

Thanks, I think it helps as the default `mode-line-buffer-id` face of the
active buffer is overridden, and it becomes the "inactive face". I think it
solves this problem, but maybe a custom face in the mode-line faces group
itself would be more accessible.

Another workaround I found was to use the `inverse-video` face option in
the `mode-line-inactive` face. It doesn't give me too much freedom to
customize the face.

On Sat, Jan 29, 2022 at 9:25 PM Drew Adams <drew.adams@oracle.com> wrote:

> > Mode-line has face options for when it's
> > active and inactive but `mode-line-buffer-id`
> > just allows customization on the active form,
> > please consider adding the option to allow
> > customizing the face of the `mode-line-buffer-id`
> > when the mode-line is inactive too.
>
> See library `modeline-win.el'.
> Does it do what you're looking for?
>
> It highlights the buffer name in the
> mode-line for the selected window.
>
> That is, whichever window is currently
> selected, its buffer name in the mode
> line is highlighted (using face
> `mlw-mode-line-buffer-id-selected-window').
>
> The code is here:
>
> https://www.emacswiki.org/emacs/download/modeline-win.el
>
> It's just a few lines of code.
>

[-- Attachment #2: Type: text/html, Size: 1770 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-30 16:18 ` Lars Ingebrigtsen
@ 2022-01-30 16:48   ` José Júnior
  2022-01-30 20:33     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-01-30 16:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629

[-- Attachment #1: Type: text/plain, Size: 882 bytes --]

Yes, it's exactly that. If I want to set a different background color for
the `mode-line-buffer-id` when the buffer is inactive, I can't do it with
the faces options of the `mode-line` group.

On Sun, Jan 30, 2022 at 1:18 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> José Júnior <jjnilton@gmail.com> writes:
>
> > Mode-line has face options for when it's active and inactive but
> > `mode-line-buffer-id` just allows customization on the active form,
> > please consider adding the option to allow customizing the face of the
> > `mode-line-buffer-id` when the mode-line is inactive too.
>
> I'm not quite sure I understand the request.  Do you want to add a new
> face for the buffer identification part of the mode line when it's
> inactive?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 1355 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-30 16:48   ` José Júnior
@ 2022-01-30 20:33     ` Lars Ingebrigtsen
  2022-01-31 20:07       ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-30 20:33 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629

José Júnior <jjnilton@gmail.com> writes:

> Yes, it's exactly that. If I want to set a different background color
> for the `mode-line-buffer-id` when the buffer is inactive, I can't do
> it with the faces options of the `mode-line` group.

Can't you achieve that by redefining `mode-line-buffer-id' to inherit
from mode-line-inactive with the proper shadowings?

If that's not sufficient, you can alter
`mode-line-buffer-identification' to return whatever you wish, so I
don't think another face here is necessary.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-30 20:33     ` Lars Ingebrigtsen
@ 2022-01-31 20:07       ` José Júnior
  2022-02-02 17:16         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-01-31 20:07 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

I don't think I can. I've tried changing the face options, but I didn't
find a way to customize it the way I want, with different backgrounds or
font-weight. For example, I can't set the `mode-line-buffer-id` of
`mode-line` face to have bold font and the `mode-line-inactive` to have a
font without bold.

I'm not sure how I can customize the way I want with
`mode-line-buffer-identification` yet, so maybe that's why having another
face to customize the inactive state still makes sense. I also found this
discussion:
https://emacs.stackexchange.com/questions/10033/change-mode-line-buffer-id-face-for-inactive-windows
- but I don't think there's a solution there.

On Sun, Jan 30, 2022 at 5:33 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> José Júnior <jjnilton@gmail.com> writes:
>
> > Yes, it's exactly that. If I want to set a different background color
> > for the `mode-line-buffer-id` when the buffer is inactive, I can't do
> > it with the faces options of the `mode-line` group.
>
> Can't you achieve that by redefining `mode-line-buffer-id' to inherit
> from mode-line-inactive with the proper shadowings?
>
> If that's not sufficient, you can alter
> `mode-line-buffer-identification' to return whatever you wish, so I
> don't think another face here is necessary.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 2081 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-30 16:46   ` José Júnior
@ 2022-01-31 20:09     ` José Júnior
  2022-01-31 20:38       ` Drew Adams
                         ` (2 more replies)
  0 siblings, 3 replies; 26+ messages in thread
From: José Júnior @ 2022-01-31 20:09 UTC (permalink / raw)
  To: Drew Adams; +Cc: 53629@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]

I just noticed that the library doesn't seem to work on the dired buffer,
on other buffers it does seem to work well. Do you know what could be the
cause?

On Sun, Jan 30, 2022 at 1:46 PM José Júnior <jjnilton@gmail.com> wrote:

> Thanks, I think it helps as the default `mode-line-buffer-id` face of the
> active buffer is overridden, and it becomes the "inactive face". I think it
> solves this problem, but maybe a custom face in the mode-line faces group
> itself would be more accessible.
>
> Another workaround I found was to use the `inverse-video` face option in
> the `mode-line-inactive` face. It doesn't give me too much freedom to
> customize the face.
>
> On Sat, Jan 29, 2022 at 9:25 PM Drew Adams <drew.adams@oracle.com> wrote:
>
>> > Mode-line has face options for when it's
>> > active and inactive but `mode-line-buffer-id`
>> > just allows customization on the active form,
>> > please consider adding the option to allow
>> > customizing the face of the `mode-line-buffer-id`
>> > when the mode-line is inactive too.
>>
>> See library `modeline-win.el'.
>> Does it do what you're looking for?
>>
>> It highlights the buffer name in the
>> mode-line for the selected window.
>>
>> That is, whichever window is currently
>> selected, its buffer name in the mode
>> line is highlighted (using face
>> `mlw-mode-line-buffer-id-selected-window').
>>
>> The code is here:
>>
>> https://www.emacswiki.org/emacs/download/modeline-win.el
>>
>> It's just a few lines of code.
>>
>

[-- Attachment #2: Type: text/html, Size: 2303 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-31 20:09     ` José Júnior
@ 2022-01-31 20:38       ` Drew Adams
  2022-01-31 20:49       ` Drew Adams
  2022-01-31 20:55       ` Drew Adams
  2 siblings, 0 replies; 26+ messages in thread
From: Drew Adams @ 2022-01-31 20:38 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

Hi José. No, I don't know why. I'll take a look (later). I confirm that I see the same thing. Dunno why Dired windows would be an exception.

I just noticed that the library doesn't seem to work on the dired buffer, on other buffers it does seem to work well. Do you know what could be the cause?

See library `modeline-win.el'.
Does it do what you're looking for?

It highlights the buffer name in the
mode-line for the selected window.

That is, whichever window is currently
selected, its buffer name in the mode
line is highlighted (using face
`mlw-mode-line-buffer-id-selected-window').

The code is here:
https://www.emacswiki.org/emacs/download/modeline-win.el<https://urldefense.com/v3/__https:/www.emacswiki.org/emacs/download/modeline-win.el__;!!ACWV5N9M2RV99hQ!fhaUnMpb2nBbq8z6sp8VIKwMVw95_ydxBOJpl_m_pSJiap2TsvVjfpOn0qMCjA_0$>
It's just a few lines of code.

[-- Attachment #2: Type: text/html, Size: 3694 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-31 20:09     ` José Júnior
  2022-01-31 20:38       ` Drew Adams
@ 2022-01-31 20:49       ` Drew Adams
  2022-01-31 20:55       ` Drew Adams
  2 siblings, 0 replies; 26+ messages in thread
From: Drew Adams @ 2022-01-31 20:49 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

Same thing with *info* windows.
I think it has to do with this (from `C-h v mode-line-buffer-identification'):

Mode line construct for identifying the buffer being displayed.
Its default value is ("%12b") with some text properties added.
Major modes that edit things other than ordinary files may change this
(e.g. Info, Dired,...)

I'll take a look later, when I get some time. Thanks for the report.

Hi José. No, I don't know why. I'll take a look (later). I confirm that I see the same thing. Dunno why Dired windows would be an exception.

I just noticed that the library doesn't seem to work on the dired buffer, on other buffers it does seem to work well. Do you know what could be the cause?

See library `modeline-win.el'.
Does it do what you're looking for?

It highlights the buffer name in the
mode-line for the selected window.

That is, whichever window is currently
selected, its buffer name in the mode
line is highlighted (using face
`mlw-mode-line-buffer-id-selected-window').

The code is here:
https://www.emacswiki.org/emacs/download/modeline-win.el<https://urldefense.com/v3/__https:/www.emacswiki.org/emacs/download/modeline-win.el__;!!ACWV5N9M2RV99hQ!fhaUnMpb2nBbq8z6sp8VIKwMVw95_ydxBOJpl_m_pSJiap2TsvVjfpOn0qMCjA_0$>
It's just a few lines of code.

[-- Attachment #2: Type: text/html, Size: 5830 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: [External] : bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-31 20:09     ` José Júnior
  2022-01-31 20:38       ` Drew Adams
  2022-01-31 20:49       ` Drew Adams
@ 2022-01-31 20:55       ` Drew Adams
  2 siblings, 0 replies; 26+ messages in thread
From: Drew Adams @ 2022-01-31 20:55 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1504 bytes --]

Yeah, that's the problem. If I change the setq-default to setq, and if you turn on the mode when a Dired window is selected, then the highlighting works there. I'll have to find a general fix. Thx.

Same thing with *info* windows.
I think it has to do with this (from `C-h v mode-line-buffer-identification'):

Mode line construct for identifying the buffer being displayed.
Its default value is ("%12b") with some text properties added.
Major modes that edit things other than ordinary files may change this
(e.g. Info, Dired,...)

I'll take a look later, when I get some time. Thanks for the report.

Hi José. No, I don't know why. I'll take a look (later). I confirm that I see the same thing. Dunno why Dired windows would be an exception.

I just noticed that the library doesn't seem to work on the dired buffer, on other buffers it does seem to work well. Do you know what could be the cause?

See library `modeline-win.el'.
Does it do what you're looking for?

It highlights the buffer name in the
mode-line for the selected window.

That is, whichever window is currently
selected, its buffer name in the mode
line is highlighted (using face
`mlw-mode-line-buffer-id-selected-window').

The code is here:
https://www.emacswiki.org/emacs/download/modeline-win.el<https://urldefense.com/v3/__https:/www.emacswiki.org/emacs/download/modeline-win.el__;!!ACWV5N9M2RV99hQ!fhaUnMpb2nBbq8z6sp8VIKwMVw95_ydxBOJpl_m_pSJiap2TsvVjfpOn0qMCjA_0$>
It's just a few lines of code.

[-- Attachment #2: Type: text/html, Size: 6357 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-01-31 20:07       ` José Júnior
@ 2022-02-02 17:16         ` Lars Ingebrigtsen
  2022-02-02 20:00           ` Juri Linkov
  0 siblings, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-02 17:16 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629

José Júnior <jjnilton@gmail.com> writes:

> I'm not sure how I can customize the way I want with
> `mode-line-buffer-identification` yet, so maybe that's why having another face to
> customize the inactive state still makes sense. I also found this discussion:
> https://emacs.stackexchange.com/questions/10033/change-mode-line-buffer-id-face-for-inactive-windows
> - but I don't think there's a solution there.

No, there doesn't seem to be.  I really thought there was a way to get
at whether the window we're making the buffer line for is selected or
not, but there doesn't seem to be?  Anybody know?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-02 17:16         ` Lars Ingebrigtsen
@ 2022-02-02 20:00           ` Juri Linkov
  2022-02-03 19:00             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2022-02-02 20:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629, José Júnior

>> I'm not sure how I can customize the way I want with
>> `mode-line-buffer-identification` yet, so maybe that's why having another face to
>> customize the inactive state still makes sense. I also found this discussion:
>> https://emacs.stackexchange.com/questions/10033/change-mode-line-buffer-id-face-for-inactive-windows
>> - but I don't think there's a solution there.
>
> No, there doesn't seem to be.  I really thought there was a way to get
> at whether the window we're making the buffer line for is selected or
> not, but there doesn't seem to be?  Anybody know?

tab-line.el uses such trick:

         (face (if (eq buffer (window-buffer))
                   (if (eq (selected-window) (old-selected-window))
                       'tab-line-tab-current
                     'tab-line-tab)
                 'tab-line-tab-inactive))





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-02 20:00           ` Juri Linkov
@ 2022-02-03 19:00             ` Lars Ingebrigtsen
  2022-02-04  3:15               ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-03 19:00 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 53629, José Júnior

Juri Linkov <juri@linkov.net> writes:

> tab-line.el uses such trick:
>
>          (face (if (eq buffer (window-buffer))
>                    (if (eq (selected-window) (old-selected-window))
>                        'tab-line-tab-current
>                      'tab-line-tab)
>                  'tab-line-tab-inactive))

Oh, that's smart.

Then we can get the action requested by something like the following:

(progn
  (defun my-buffer-identification (fmt)
    (list (propertize fmt
		      'face (if (eq (selected-window)
				    (old-selected-window))
				'mode-line-buffer-id
			      'error)
		      'mouse-face 'mode-line-highlight
		      'local-map mode-line-buffer-identification-keymap)))
  (setq-default mode-line-buffer-identification
		'(:eval (my-buffer-identification "%12b"))))

(Adjust for the face you want to use.)  Seems to work well for me.

José, does this fix the issue for you, too?

We should probably document this better -- perhaps add some cross
referencing between the selected-window and old-selected-window doc
strings to allow discovery.  And perhaps mention this in the mode line
section, too.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-03 19:00             ` Lars Ingebrigtsen
@ 2022-02-04  3:15               ` José Júnior
  2022-02-04  9:58                 ` martin rudalics
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-02-04  3:15 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Drew Adams; +Cc: 53629, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 2745 bytes --]

Thanks, Lars. I tried this approach and it's almost perfect. The only thing
I noticed is that when I use M-x or C-s, and the focus is on the echo area,
the last active buffer (the one I was before pressing M-x or C-s) doesn't
use the `mode-line-buffer-id-active` face.

Example: https://0x0.st/oH5O.png - see that the `mode-line-buffer-id` face
on the right is raised, and I'm not sure where that's coming from, since I
didn't set either to be like that.

```
 '(mode-line ((t (:background "#000000" :foreground "#ffffff"))))
 '(mode-line-buffer-id ((t (:background "white" :foreground "black" :weight
normal))))
 '(mode-line-highlight ((t (:background "yellow" :box nil))))
 '(mode-line-id-inactive ((t (:background "gray10" :foreground "dim
gray"))))
 '(mode-line-inactive ((t (:inherit nil :background "black" :foreground
"dim gray" :inverse-video nil))))
```

Seems the default behavior of emacs is not to change the `mode-line` or
`mode-line-buffer-id` on the buffer that M-x or C-s used, so I think that's
what's missing from this solution.

@Drew Adams <drew.adams@oracle.com> might want to check this too. (not sure
if this is the right way to mention people)

On Thu, Feb 3, 2022 at 4:00 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Juri Linkov <juri@linkov.net> writes:
>
> > tab-line.el uses such trick:
> >
> >          (face (if (eq buffer (window-buffer))
> >                    (if (eq (selected-window) (old-selected-window))
> >                        'tab-line-tab-current
> >                      'tab-line-tab)
> >                  'tab-line-tab-inactive))
>
> Oh, that's smart.
>
> Then we can get the action requested by something like the following:
>
> (progn
>   (defun my-buffer-identification (fmt)
>     (list (propertize fmt
>                       'face (if (eq (selected-window)
>                                     (old-selected-window))
>                                 'mode-line-buffer-id
>                               'error)
>                       'mouse-face 'mode-line-highlight
>                       'local-map mode-line-buffer-identification-keymap)))
>   (setq-default mode-line-buffer-identification
>                 '(:eval (my-buffer-identification "%12b"))))
>
> (Adjust for the face you want to use.)  Seems to work well for me.
>
> José, does this fix the issue for you, too?
>
> We should probably document this better -- perhaps add some cross
> referencing between the selected-window and old-selected-window doc
> strings to allow discovery.  And perhaps mention this in the mode line
> section, too.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 3832 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-04  3:15               ` José Júnior
@ 2022-02-04  9:58                 ` martin rudalics
  2022-02-05  2:03                   ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: martin rudalics @ 2022-02-04  9:58 UTC (permalink / raw)
  To: José Júnior, Lars Ingebrigtsen, Drew Adams; +Cc: 53629, Juri Linkov

 > Thanks, Lars. I tried this approach and it's almost perfect. The only thing
 > I noticed is that when I use M-x or C-s, and the focus is on the echo area,
 > the last active buffer (the one I was before pressing M-x or C-s) doesn't
 > use the `mode-line-buffer-id-active` face.

Instead of

 >>                        (if (eq (selected-window)
 >>                                      (old-selected-window))

try

(if (memq (selected-window) `(,(old-selected-window) ,(minibuffer-selected-window)))

martin





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-04  9:58                 ` martin rudalics
@ 2022-02-05  2:03                   ` José Júnior
  2022-02-05  7:47                     ` martin rudalics
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-02-05  2:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: Lars Ingebrigtsen, 53629, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 692 bytes --]

Thanks martin, but it seems that the behavior did not change. Any ideas?

On Fri, Feb 4, 2022 at 6:58 AM martin rudalics <rudalics@gmx.at> wrote:

>  > Thanks, Lars. I tried this approach and it's almost perfect. The only
> thing
>  > I noticed is that when I use M-x or C-s, and the focus is on the echo
> area,
>  > the last active buffer (the one I was before pressing M-x or C-s)
> doesn't
>  > use the `mode-line-buffer-id-active` face.
>
> Instead of
>
>  >>                        (if (eq (selected-window)
>  >>                                      (old-selected-window))
>
> try
>
> (if (memq (selected-window) `(,(old-selected-window)
> ,(minibuffer-selected-window)))
>
> martin
>

[-- Attachment #2: Type: text/html, Size: 1091 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05  2:03                   ` José Júnior
@ 2022-02-05  7:47                     ` martin rudalics
  2022-02-05  7:52                       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 26+ messages in thread
From: martin rudalics @ 2022-02-05  7:47 UTC (permalink / raw)
  To: José Júnior; +Cc: Lars Ingebrigtsen, 53629, Juri Linkov

 > Thanks martin, but it seems that the behavior did not change. Any ideas?

I disregarded the useless complication that 'minibuffer-selected-window'
returns nil when the selected window is not a minibuffer window.  Please
try the below.

martin


(defun my-buffer-identification (fmt)
   (list (propertize
	 fmt
	 'face (if (let ((window (selected-window)))
		     (or (eq window (old-selected-window))
			 (and (minibuffer-window-active-p (minibuffer-window))
			      (with-selected-window (minibuffer-window)
				(eq window (minibuffer-selected-window))))))
		   'error
		 'mode-line-buffer-id)
	 'mouse-face 'mode-line-highlight
	 'local-map mode-line-buffer-identification-keymap)))

(setq-default mode-line-buffer-identification
	      '(:eval (my-buffer-identification "%12b")))






^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05  7:47                     ` martin rudalics
@ 2022-02-05  7:52                       ` Lars Ingebrigtsen
  2022-02-05 12:10                         ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05  7:52 UTC (permalink / raw)
  To: martin rudalics; +Cc: 53629, José Júnior, Juri Linkov

martin rudalics <rudalics@gmx.at> writes:

> I disregarded the useless complication that 'minibuffer-selected-window'
> returns nil when the selected window is not a minibuffer window.  Please
> try the below.
>
> martin
>
> (defun my-buffer-identification (fmt)
>   (list (propertize
> 	 fmt
> 	 'face (if (let ((window (selected-window)))
> 		     (or (eq window (old-selected-window))
> 			 (and (minibuffer-window-active-p (minibuffer-window))
> 			      (with-selected-window (minibuffer-window)
> 				(eq window (minibuffer-selected-window))))))

Thanks; seems to work fine.  Perhaps we should make this into a utility
function and then document this technique in the manual in the mode line
section?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05  7:52                       ` Lars Ingebrigtsen
@ 2022-02-05 12:10                         ` José Júnior
  2022-02-05 21:46                           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-02-05 12:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 1104 bytes --]

Thanks, I think it's perfect now. It would be good to have it documented,
indeed.

On Sat, Feb 5, 2022 at 4:52 AM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> martin rudalics <rudalics@gmx.at> writes:
>
> > I disregarded the useless complication that 'minibuffer-selected-window'
> > returns nil when the selected window is not a minibuffer window.  Please
> > try the below.
> >
> > martin
> >
> > (defun my-buffer-identification (fmt)
> >   (list (propertize
> >        fmt
> >        'face (if (let ((window (selected-window)))
> >                    (or (eq window (old-selected-window))
> >                        (and (minibuffer-window-active-p
> (minibuffer-window))
> >                             (with-selected-window (minibuffer-window)
> >                               (eq window
> (minibuffer-selected-window))))))
>
> Thanks; seems to work fine.  Perhaps we should make this into a utility
> function and then document this technique in the manual in the mode line
> section?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 1711 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05 12:10                         ` José Júnior
@ 2022-02-05 21:46                           ` Lars Ingebrigtsen
  2022-02-05 22:11                             ` José Júnior
  2022-02-06 17:59                             ` Juri Linkov
  0 siblings, 2 replies; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-05 21:46 UTC (permalink / raw)
  To: José Júnior; +Cc: 53629, Juri Linkov

José Júnior <jjnilton@gmail.com> writes:

> Thanks, I think it's perfect now. It would be good to have it
> documented, indeed.

I've now added this as mode-line-window-selected-p to Emacs 29 and
documented it in the mode line section of the manual.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05 21:46                           ` Lars Ingebrigtsen
@ 2022-02-05 22:11                             ` José Júnior
  2022-02-06 17:59                             ` Juri Linkov
  1 sibling, 0 replies; 26+ messages in thread
From: José Júnior @ 2022-02-05 22:11 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 475 bytes --]

Thanks!

On Sat, Feb 5, 2022 at 6:47 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> José Júnior <jjnilton@gmail.com> writes:
>
> > Thanks, I think it's perfect now. It would be good to have it
> > documented, indeed.
>
> I've now added this as mode-line-window-selected-p to Emacs 29 and
> documented it in the mode line section of the manual.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 925 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-05 21:46                           ` Lars Ingebrigtsen
  2022-02-05 22:11                             ` José Júnior
@ 2022-02-06 17:59                             ` Juri Linkov
  2022-02-06 22:48                               ` Lars Ingebrigtsen
  1 sibling, 1 reply; 26+ messages in thread
From: Juri Linkov @ 2022-02-06 17:59 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629, José Júnior

>> Thanks, I think it's perfect now. It would be good to have it
>> documented, indeed.
>
> I've now added this as mode-line-window-selected-p to Emacs 29 and
> documented it in the mode line section of the manual.

Nice!  Now it's used in tab-line.el.  (I'm not sure if it can continue
using the name prefix mode-line- ?)





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-06 17:59                             ` Juri Linkov
@ 2022-02-06 22:48                               ` Lars Ingebrigtsen
  2022-02-08 11:48                                 ` José Júnior
  0 siblings, 1 reply; 26+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-06 22:48 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 53629, José Júnior

Juri Linkov <juri@linkov.net> writes:

> Nice!  Now it's used in tab-line.el.  (I'm not sure if it can continue
> using the name prefix mode-line- ?)

Feel free to rename it to something more general (but not so general
that people start using it instead of `selected-window' 🙃).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-06 22:48                               ` Lars Ingebrigtsen
@ 2022-02-08 11:48                                 ` José Júnior
  2022-02-08 18:22                                   ` martin rudalics
  0 siblings, 1 reply; 26+ messages in thread
From: José Júnior @ 2022-02-08 11:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 53629, Juri Linkov

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

I just noticed that it doesn't seem to work in the `dired` and `info`
windows. Any ideas?

On Sun, Feb 6, 2022 at 7:48 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:

> Juri Linkov <juri@linkov.net> writes:
>
> > Nice!  Now it's used in tab-line.el.  (I'm not sure if it can continue
> > using the name prefix mode-line- ?)
>
> Feel free to rename it to something more general (but not so general
> that people start using it instead of `selected-window' 🙃).
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no
>

[-- Attachment #2: Type: text/html, Size: 1061 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread

* bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
  2022-02-08 11:48                                 ` José Júnior
@ 2022-02-08 18:22                                   ` martin rudalics
  0 siblings, 0 replies; 26+ messages in thread
From: martin rudalics @ 2022-02-08 18:22 UTC (permalink / raw)
  To: José Júnior, Lars Ingebrigtsen; +Cc: 53629, Juri Linkov

 > I just noticed that it doesn't seem to work in the `dired` and `info`
 > windows. Any ideas?

'dired' has

   (setq ...
	mode-line-buffer-identification
	(propertized-buffer-identification "%17b"))

and 'info' uses 'Info-set-mode-line'.  You would have to override
these somehow.

martin





^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2022-02-08 18:22 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-29 20:19 bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive José Júnior
2022-01-30  0:24 ` bug#53629: [External] : " Drew Adams
2022-01-30 16:46   ` José Júnior
2022-01-31 20:09     ` José Júnior
2022-01-31 20:38       ` Drew Adams
2022-01-31 20:49       ` Drew Adams
2022-01-31 20:55       ` Drew Adams
2022-01-30 16:18 ` Lars Ingebrigtsen
2022-01-30 16:48   ` José Júnior
2022-01-30 20:33     ` Lars Ingebrigtsen
2022-01-31 20:07       ` José Júnior
2022-02-02 17:16         ` Lars Ingebrigtsen
2022-02-02 20:00           ` Juri Linkov
2022-02-03 19:00             ` Lars Ingebrigtsen
2022-02-04  3:15               ` José Júnior
2022-02-04  9:58                 ` martin rudalics
2022-02-05  2:03                   ` José Júnior
2022-02-05  7:47                     ` martin rudalics
2022-02-05  7:52                       ` Lars Ingebrigtsen
2022-02-05 12:10                         ` José Júnior
2022-02-05 21:46                           ` Lars Ingebrigtsen
2022-02-05 22:11                             ` José Júnior
2022-02-06 17:59                             ` Juri Linkov
2022-02-06 22:48                               ` Lars Ingebrigtsen
2022-02-08 11:48                                 ` José Júnior
2022-02-08 18:22                                   ` martin rudalics

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.