all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to highlight the current buffer's mode line ?
@ 2009-08-05 21:13 Francis Moreau
  2009-08-05 23:44 ` Johan Bockgård
       [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Francis Moreau @ 2009-08-05 21:13 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

I'd like to modify the mode line in order to easily see which buffer
is the current one when multiple buffers are visible at the same time.

For example change the color of the buffer name's font to red.

Could anybody tell me how to do that ?

Thanks


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

* Re: How to highlight the current buffer's mode line ?
  2009-08-05 21:13 How to highlight the current buffer's mode line ? Francis Moreau
@ 2009-08-05 23:44 ` Johan Bockgård
       [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 18+ messages in thread
From: Johan Bockgård @ 2009-08-05 23:44 UTC (permalink / raw)
  To: help-gnu-emacs

Francis Moreau <francis.moro@gmail.com> writes:

> I'd like to modify the mode line in order to easily see which buffer
> is the current one when multiple buffers are visible at the same time.

The selected window's mode line uses a different color by default (face
`mode-line' vs `mode-line-inactive').





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

* Re: How to highlight the current buffer's mode line ?
       [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
@ 2009-08-06  2:55   ` Xah Lee
  2009-08-06  6:33   ` Francis Moreau
  2009-08-06  7:44   ` Francis Moreau
  2 siblings, 0 replies; 18+ messages in thread
From: Xah Lee @ 2009-08-06  2:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 5, 4:44 pm, bojohan+n...@dd.chalmers.se (Johan Bockgård) wrote:
> Francis Moreau <francis.m...@gmail.com> writes:
> > I'd like to modify the mode line in order to easily see which buffer
> > is the current one when multiple buffers are visible at the same time.
>
> The selected window's mode line uses a different color by default (face
> `mode-line' vs `mode-line-inactive').

you might also try:

; highlight current line
(add-hook 'text-mode-hook
 (lambda ()
  (hl-line-mode 1)))

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: How to highlight the current buffer's mode line ?
       [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
  2009-08-06  2:55   ` Xah Lee
@ 2009-08-06  6:33   ` Francis Moreau
  2009-08-06  7:44   ` Francis Moreau
  2 siblings, 0 replies; 18+ messages in thread
From: Francis Moreau @ 2009-08-06  6:33 UTC (permalink / raw)
  To: help-gnu-emacs

On 6 août, 01:44, bojohan+n...@dd.chalmers.se (Johan Bockgård) wrote:
> Francis Moreau <francis.m...@gmail.com> writes:
> > I'd like to modify the mode line in order to easily see which buffer
> > is the current one when multiple buffers are visible at the same time.
>
> The selected window's mode line uses a different color by default (face
> `mode-line' vs `mode-line-inactive').

Sorry but I forgot to tell that I'm using emacs in text mode where
these 2 faces are identical by default.

But now I know which part of emacs I need to customize.

Thanks


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

* Re: How to highlight the current buffer's mode line ?
       [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
  2009-08-06  2:55   ` Xah Lee
  2009-08-06  6:33   ` Francis Moreau
@ 2009-08-06  7:44   ` Francis Moreau
  2009-08-06 14:48     ` Drew Adams
                       ` (3 more replies)
  2 siblings, 4 replies; 18+ messages in thread
From: Francis Moreau @ 2009-08-06  7:44 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 6, 1:44 am, bojohan+n...@dd.chalmers.se (Johan Bockgård) wrote:
> Francis Moreau <francis.m...@gmail.com> writes:
> > I'd like to modify the mode line in order to easily see which buffer
> > is the current one when multiple buffers are visible at the same time.
>
> The selected window's mode line uses a different color by default (face
> `mode-line' vs `mode-line-inactive').

BTW, it looks like I can only change the face used by the entire mode
line.

Is it possible to change only the buffer name face only ?

thanks


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

* RE: How to highlight the current buffer's mode line ?
  2009-08-06  7:44   ` Francis Moreau
@ 2009-08-06 14:48     ` Drew Adams
       [not found]     ` <mailman.4026.1249570109.2239.help-gnu-emacs@gnu.org>
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-08-06 14:48 UTC (permalink / raw)
  To: 'Francis Moreau', help-gnu-emacs

> > > I'd like to modify the mode line in order to easily see 
> > > which buffer is the current one when multiple buffers
> > > are visible at the same time.
> >
> > The selected window's mode line uses a different color by 
> > default (face `mode-line' vs `mode-line-inactive').
> 
> BTW, it looks like I can only change the face used by the entire mode
> line. Is it possible to change only the buffer name face only ?

Propertize the value of variable `mode-line-buffer-identification'. See the
Elisp manual, node Mode Line Variables.





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

* Re: How to highlight the current buffer's mode line ?
       [not found]     ` <mailman.4026.1249570109.2239.help-gnu-emacs@gnu.org>
@ 2009-08-06 15:07       ` Francis Moreau
  2009-08-06 16:07         ` Drew Adams
  0 siblings, 1 reply; 18+ messages in thread
From: Francis Moreau @ 2009-08-06 15:07 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 6, 4:48 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > > > I'd like to modify the mode line in order to easily see
> > > > which buffer is the current one when multiple buffers
> > > > are visible at the same time.
>
> > > The selected window's mode line uses a different color by
> > > default (face `mode-line' vs `mode-line-inactive').
>
> > BTW, it looks like I can only change the face used by the entire mode
> > line. Is it possible to change only the buffer name face only ?
>
> Propertize the value of variable `mode-line-buffer-identification'.

sorry but what do you mean by "propertize" ?

thanks


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

* RE: How to highlight the current buffer's mode line ?
  2009-08-06 15:07       ` Francis Moreau
@ 2009-08-06 16:07         ` Drew Adams
  0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-08-06 16:07 UTC (permalink / raw)
  To: 'Francis Moreau', help-gnu-emacs

> > Propertize the value of variable `mode-line-buffer-identification'.
> 
> sorry but what do you mean by "propertize" ?

See `propertized-buffer-identification' in file bindings.el.

And `C-h f propertize'.





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

* Re: How to highlight the current buffer's mode line ?
  2009-08-06  7:44   ` Francis Moreau
  2009-08-06 14:48     ` Drew Adams
       [not found]     ` <mailman.4026.1249570109.2239.help-gnu-emacs@gnu.org>
@ 2009-08-06 21:11     ` Johan Bockgård
  2009-08-06 21:18       ` Drew Adams
       [not found]     ` <mailman.4071.1249593136.2239.help-gnu-emacs@gnu.org>
  3 siblings, 1 reply; 18+ messages in thread
From: Johan Bockgård @ 2009-08-06 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

Francis Moreau <francis.moro@gmail.com> writes:

> BTW, it looks like I can only change the face used by the entire mode
> line.
>
> Is it possible to change only the buffer name face only ?

Not easily.





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

* RE: How to highlight the current buffer's mode line ?
  2009-08-06 21:11     ` Johan Bockgård
@ 2009-08-06 21:18       ` Drew Adams
  2009-08-06 21:24         ` Johan Bockgård
  0 siblings, 1 reply; 18+ messages in thread
From: Drew Adams @ 2009-08-06 21:18 UTC (permalink / raw)
  To: 'Johan "Bockgård"', help-gnu-emacs

> > Is it possible to change only the buffer name face only ?
> 
> Not easily.

M-x customize-face RET mode-line-buffer-id






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

* Re: How to highlight the current buffer's mode line ?
  2009-08-06 21:18       ` Drew Adams
@ 2009-08-06 21:24         ` Johan Bockgård
  2009-08-06 21:36           ` Drew Adams
       [not found]           ` <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 18+ messages in thread
From: Johan Bockgård @ 2009-08-06 21:24 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

>> > Is it possible to change only the buffer name face only ?
>> 
>> Not easily.
>
> M-x customize-face RET mode-line-buffer-id

Except for the detail that it should have different colors in active and
inactive windows.





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

* RE: How to highlight the current buffer's mode line ?
  2009-08-06 21:24         ` Johan Bockgård
@ 2009-08-06 21:36           ` Drew Adams
  2009-08-06 22:17             ` Johan Bockgård
       [not found]           ` <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 18+ messages in thread
From: Drew Adams @ 2009-08-06 21:36 UTC (permalink / raw)
  To: 'Johan "Bockgård"', help-gnu-emacs

> >> > Is it possible to change only the buffer name face only ?
> >> 
> >> Not easily.
> >
> > M-x customize-face RET mode-line-buffer-id
> 
> Except for the detail that it should have different colors in 
> active and inactive windows.

Why? Are you making up that condition?
The OP said nothing about that AFAIK.

The `mode-line' face already indicates which window is active. Why would the
face used for the buffer name also need to indicate active and inactive in its
own way?

FWIW, this is what I use for face `mode-line-buffer-id':

   [X] Underline: Value Menu Colored: red
   [X] Overline:  Value Menu Colored: red

That (a) separates the buffer name well from the other mode-line fields, without
(b) making it stand out so much that it becomes distracting.

[Note: I turned off the `bold' weight, which is the default for this face. On
Windows at least, bold looks very ugly, at least with the font I use:
"-outline-Lucida Console-normal-r-normal-normal-14-105-96-96-c-*-iso8859-1".]





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

* Re: How to highlight the current buffer's mode line ?
  2009-08-06 21:36           ` Drew Adams
@ 2009-08-06 22:17             ` Johan Bockgård
  0 siblings, 0 replies; 18+ messages in thread
From: Johan Bockgård @ 2009-08-06 22:17 UTC (permalink / raw)
  To: help-gnu-emacs

"Drew Adams" <drew.adams@oracle.com> writes:

>> Except for the detail that it should have different colors in
>> active and inactive windows.
>
> Why? Are you making up that condition?
> The OP said nothing about that AFAIK.

Please read the thread, including the post that started it.





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

* Re: How to highlight the current buffer's mode line ?
       [not found]           ` <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>
@ 2009-08-07  3:56             ` Barry Margolin
  2009-08-07  6:03               ` Drew Adams
  2009-08-07  5:15             ` Francis Moreau
  1 sibling, 1 reply; 18+ messages in thread
From: Barry Margolin @ 2009-08-07  3:56 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>,
 "Drew Adams" <drew.adams@oracle.com> wrote:

> > >> > Is it possible to change only the buffer name face only ?
> > >> 
> > >> Not easily.
> > >
> > > M-x customize-face RET mode-line-buffer-id
> > 
> > Except for the detail that it should have different colors in 
> > active and inactive windows.
> 
> Why? Are you making up that condition?
> The OP said nothing about that AFAIK.

Yes, he did.

> 
> The `mode-line' face already indicates which window is active. Why would the
> face used for the buffer name also need to indicate active and inactive in 
> its
> own way?

When other responders mentioned that the mode-line face does this, he 
came back and said "that applies to the entire mode line, how can I do 
it just for the buffer name?"

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


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

* Re: How to highlight the current buffer's mode line ?
       [not found]           ` <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>
  2009-08-07  3:56             ` Barry Margolin
@ 2009-08-07  5:15             ` Francis Moreau
  1 sibling, 0 replies; 18+ messages in thread
From: Francis Moreau @ 2009-08-07  5:15 UTC (permalink / raw)
  To: help-gnu-emacs

On 6 août, 23:36, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > >> > Is it possible to change only the buffer name face only ?
>
> > >> Not easily.
>
> > > M-x customize-face RET mode-line-buffer-id
>
> > Except for the detail that it should have different colors in
> > active and inactive windows.
>
> Why? Are you making up that condition?
> The OP said nothing about that AFAIK.

Yes I did, except I used "current buffer" instead of "active window",
my bad.


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

* Re: How to highlight the current buffer's mode line ?
       [not found]     ` <mailman.4071.1249593136.2239.help-gnu-emacs@gnu.org>
@ 2009-08-07  5:18       ` Francis Moreau
  2009-08-07 18:25         ` Johan Bockgård
  0 siblings, 1 reply; 18+ messages in thread
From: Francis Moreau @ 2009-08-07  5:18 UTC (permalink / raw)
  To: help-gnu-emacs

On 6 août, 23:11, bojohan+n...@dd.chalmers.se (Johan Bockgård) wrote:
> Francis Moreau <francis.m...@gmail.com> writes:
> > BTW, it looks like I can only change the face used by the entire mode
> > line.
>
> > Is it possible to change only the buffer name face only ?
>
> Not easily.

yes I came to that conclusion too.

And I think it does not worth the headache,  customizing 'mode-line
face' is fine enough.

Thanks


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

* RE: How to highlight the current buffer's mode line ?
  2009-08-07  3:56             ` Barry Margolin
@ 2009-08-07  6:03               ` Drew Adams
  0 siblings, 0 replies; 18+ messages in thread
From: Drew Adams @ 2009-08-07  6:03 UTC (permalink / raw)
  To: 'Barry Margolin', help-gnu-emacs

> > > >> > Is it possible to change only the buffer name face only ?
> > > >> 
> > > >> Not easily.
> > > >
> > > > M-x customize-face RET mode-line-buffer-id
> > > 
> > > Except for the detail that it should have different colors in 
> > > active and inactive windows.
> > 
> > Why? Are you making up that condition?
> > The OP said nothing about that AFAIK.
> 
> Yes, he did.

Apologies to all; I misunderstood. I had deleted the original post, and then
came into the thread late. I didn't understand that what was requested was to
distinguish the current buffer (or perhaps the selected window?). No, there is
no immediate way to do that.

As pointed out, on a graphic terminal the selected _window_ has its (entire)
mode line highlighted. But there is no trivial way (a) to highlight the mode
line of all windows that show the current buffer or (b) to highlight only the
buffer name portion of those mode lines. And with a text terminal, the mode line
is pretty rudimentary.





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

* Re: How to highlight the current buffer's mode line ?
  2009-08-07  5:18       ` Francis Moreau
@ 2009-08-07 18:25         ` Johan Bockgård
  0 siblings, 0 replies; 18+ messages in thread
From: Johan Bockgård @ 2009-08-07 18:25 UTC (permalink / raw)
  To: help-gnu-emacs

Francis Moreau <francis.moro@gmail.com> writes:

> On 6 août, 23:11, bojohan+n...@dd.chalmers.se (Johan Bockgård) wrote:
>> Francis Moreau <francis.m...@gmail.com> writes:
>> > BTW, it looks like I can only change the face used by the entire mode
>> > line.
>>
>> > Is it possible to change only the buffer name face only ?
>>
>> Not easily.
>
> yes I came to that conclusion too.
>
> And I think it does not worth the headache,  customizing 'mode-line
> face' is fine enough.

FWIW,

mode-line/mode-line-inactive can do its business by being implemented in
C. The necessary info isn't readily available to Lisp (simply checking
`selected-window' doesn't work since a window is always selected when
its mode line is formatted; also, no hook is run when the selected
window changes). For the record, here's what I came up with (this does
not function perfectly):


(defvar my-selected-windows nil)

(add-hook 'post-command-hook
          (lambda ()
            (setq my-selected-windows (cons (selected-window)
                                            (minibuffer-selected-window)))
            (force-mode-line-update)))

(defun my-mode-line-buffer-identification ()
  `(:propertize
    mode-line-buffer-identification
    face ,(if ;; This is what CURRENT_MODE_LINE_FACE_ID_3 does, more or less
              (or (eq (car my-selected-windows) (selected-window))
                  (and (> (minibuffer-depth) 0)
                       (eq (selected-window) (cdr my-selected-windows))
                       (eq (car my-selected-windows) (minibuffer-window))))
              'highlight
            'mode-line-inactive)))

(setcar
 (member 'mode-line-buffer-identification mode-line-format)
 '(:eval (my-mode-line-buffer-identification)))






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

end of thread, other threads:[~2009-08-07 18:25 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-05 21:13 How to highlight the current buffer's mode line ? Francis Moreau
2009-08-05 23:44 ` Johan Bockgård
     [not found] ` <mailman.3981.1249515906.2239.help-gnu-emacs@gnu.org>
2009-08-06  2:55   ` Xah Lee
2009-08-06  6:33   ` Francis Moreau
2009-08-06  7:44   ` Francis Moreau
2009-08-06 14:48     ` Drew Adams
     [not found]     ` <mailman.4026.1249570109.2239.help-gnu-emacs@gnu.org>
2009-08-06 15:07       ` Francis Moreau
2009-08-06 16:07         ` Drew Adams
2009-08-06 21:11     ` Johan Bockgård
2009-08-06 21:18       ` Drew Adams
2009-08-06 21:24         ` Johan Bockgård
2009-08-06 21:36           ` Drew Adams
2009-08-06 22:17             ` Johan Bockgård
     [not found]           ` <mailman.4077.1249594606.2239.help-gnu-emacs@gnu.org>
2009-08-07  3:56             ` Barry Margolin
2009-08-07  6:03               ` Drew Adams
2009-08-07  5:15             ` Francis Moreau
     [not found]     ` <mailman.4071.1249593136.2239.help-gnu-emacs@gnu.org>
2009-08-07  5:18       ` Francis Moreau
2009-08-07 18:25         ` Johan Bockgård

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.