GNU bug report logs - #53629
27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive

Previous Next

Package: emacs;

Reported by: José Júnior <jjnilton <at> gmail.com>

Date: Sat, 29 Jan 2022 23:07:02 UTC

Severity: normal

Tags: moreinfo

Found in version 27.1

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: José Júnior <jjnilton <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Drew Adams <drew.adams <at> oracle.com>
Cc: 53629 <at> debbugs.gnu.org, Juri Linkov <juri <at> linkov.net>
Subject: bug#53629: 27.1: add option to change face `mode-line-buffer-id` when mode-line is inactive
Date: Fri, 4 Feb 2022 00:15:00 -0300
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> gnus.org> wrote:

> Juri Linkov <juri <at> 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
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 108 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.