[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to highlight the current buffer's mode line ?
From: |
Johan Bockgård |
Subject: |
Re: How to highlight the current buffer's mode line ? |
Date: |
Fri, 07 Aug 2009 20:25:52 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) |
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)))
- RE: How to highlight the current buffer's mode line ?, (continued)
- RE: How to highlight the current buffer's mode line ?, Drew Adams, 2009/08/06
- Re: How to highlight the current buffer's mode line ?, Johan Bockgård, 2009/08/06
- RE: How to highlight the current buffer's mode line ?, Drew Adams, 2009/08/06
- Re: How to highlight the current buffer's mode line ?, Johan Bockgård, 2009/08/06
- RE: How to highlight the current buffer's mode line ?, Drew Adams, 2009/08/06
- Re: How to highlight the current buffer's mode line ?, Johan Bockgård, 2009/08/06
- Message not available
- Re: How to highlight the current buffer's mode line ?, Barry Margolin, 2009/08/07
- RE: How to highlight the current buffer's mode line ?, Drew Adams, 2009/08/07
- Message not available
- Re: How to highlight the current buffer's mode line ?, Francis Moreau, 2009/08/07
- Message not available
- Re: How to highlight the current buffer's mode line ?, Francis Moreau, 2009/08/07
- Re: How to highlight the current buffer's mode line ?,
Johan Bockgård <=
Message not available