unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Different text/properties in active vs inactive mode line
@ 2011-04-29 21:01 sdn.gnuem
  2011-04-30 13:46 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: sdn.gnuem @ 2011-04-29 21:01 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,



    I've been searching, but haven't found an answer yet.  Is it possible to add something to the mode line format that changes its appearance depending on whether the window is active or not?



    I have some colorized (propertized) status elements on my mode line.  They look fine when shown on the active mode line, against the 'mode-line' face.  But they look garish when shown on the inactive mode line, against the 'mode-line-inactive' face.



    I've been delving into the emacs lisp code to figure out how the mode line decides to display in mode-line or mode-line-inactive face, but so far I've come up empty.  Any help?



Thanks in advance,

-- Sue D. Nymme



----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

* Different text/properties in active vs inactive mode line
@ 2011-04-30 13:17 sdn.gnuem
  0 siblings, 0 replies; 8+ messages in thread
From: sdn.gnuem @ 2011-04-30 13:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hello all,



   I've been searching, but haven't found an answer yet.  Is it

possible to add something to the mode line format that changes its

appearance depending on whether the window is active or not?



   I have some colorized (propertized) status elements on my mode

line.  They look fine when shown on the active mode line, against the

'mode-line' face.  But they look garish when shown on the inactive

mode line, against the 'mode-line-inactive' face.



   I've been delving into the emacs lisp code to figure out how the

mode line decides to display in mode-line or mode-line-inactive face,

but so far I've come up empty.  Any help?



Thanks in advance,

-- Sue D. Nymme

----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

* Re: Different text/properties in active vs inactive mode line
  2011-04-29 21:01 sdn.gnuem
@ 2011-04-30 13:46 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-04-30 13:46 UTC (permalink / raw)
  To: help-gnu-emacs

> From: sdn.gnuem@mailnull.com
> Date: Fri, 29 Apr 2011 17:01:16 -0400 (EDT)
> 
>     I've been searching, but haven't found an answer yet.  Is it possible to add something to the mode line format that changes its appearance depending on whether the window is active or not?

If the mode-line face is `mode-line' and not `mode-line-inactive',
then the window is active.



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

* Re: Different text/properties in active vs inactive mode line
@ 2011-04-30 15:25 sdn.gnuem
  2011-04-30 16:14 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: sdn.gnuem @ 2011-04-30 15:25 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, Apr 30, 2011 at 9:46 AM -0400 (EDT), Eli Zaretskii wrote:

> > From: sdn.gnuem@mailnull.com

> > Date: Fri, 29 Apr 2011 17:01:16 -0400 (EDT)

> >

> >     I've been searching, but haven't found an answer yet.  Is it

> > possible to add something to the mode line format that changes its

> > appearance depending on whether the window is active or not?

> 

> If the mode-line face is `mode-line' and not `mode-line-inactive',

> then the window is active.



Is there a variable or function that will tell me the current face of

the mode line?



-- Sue D. Nymme



----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

* Re: Different text/properties in active vs inactive mode line
  2011-04-30 15:25 sdn.gnuem
@ 2011-04-30 16:14 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-04-30 16:14 UTC (permalink / raw)
  To: help-gnu-emacs

> From: sdn.gnuem@mailnull.com
> Date: Sat, 30 Apr 2011 11:25:40 -0400 (EDT)
> 
> > If the mode-line face is `mode-line' and not `mode-line-inactive',
> > then the window is active.
> 
> Is there a variable or function that will tell me the current face of
> the mode line?

Actually, there's a simpler method: Emacs uses the `mode-line' face
for the selected window, and `mode-line-inactive' for all the other
windows.  So you can use the `selected-window' function and compare
its value to the window for which you want to change the mode-line
appearance.



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

* Re: Different text/properties in active vs inactive mode line
@ 2011-05-01  0:46 sdn.gnuem
  2011-05-01  7:49 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: sdn.gnuem @ 2011-05-01  0:46 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, Apr 30, 2011 at 12:14 PM -0400 (EDT), Eli Zaretskii wrote:

> > From: sdn.gnuem@mailnull.com

> > Date: Sat, 30 Apr 2011 11:25:40 -0400 (EDT)

[...]

> > Is there a variable or function that will tell me the current face of

> > the mode line?

> 

> Actually, there's a simpler method: Emacs uses the `mode-line' face

> for the selected window, and `mode-line-inactive' for all the other

> windows.  So you can use the `selected-window' function and compare

> its value to the window for which you want to change the mode-line

> appearance.





    I appreciate your help so far, Eli, but I confess I am still not

seeing all the way to the end yet.



    I don't want to change the face of my mode-line status strings for

one or two specific windows; I want to use one face for particular

status labels when they are displayed in the mode line for the active

window, and a different face for those status labels when they are

displayed in the mode line for all inactive windows.



    As an experiment, just now, I added this element:

        (:eval (prin1-to-string (selected-window)))



to mode-line-format.  I am composing this message in a frame with two

windows.  The active window has the label "#<window 7 on *mail*>" in

the mode line; the other window has the label "#<window 17 on *Help*>".

The window numbers do not change, of course, when I switch between the

two windows.  So I do not understand what you are suggesting I compare

to selected-window in order to determine which face to use.



Thanks in advance,

-- Sue D. Nymme



----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

* Re: Different text/properties in active vs inactive mode line
  2011-05-01  0:46 sdn.gnuem
@ 2011-05-01  7:49 ` Eli Zaretskii
  0 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2011-05-01  7:49 UTC (permalink / raw)
  To: help-gnu-emacs

> From: sdn.gnuem@mailnull.com
> Date: Sat, 30 Apr 2011 20:46:51 -0400 (EDT)
> 
>     I appreciate your help so far, Eli, but I confess I am still not
> seeing all the way to the end yet.

That's okay, since I have no clear idea about what exactly you are
after, either.

> So I do not understand what you are suggesting I compare
> to selected-window in order to determine which face to use.

In the code that adds whatever you want to the mode line, compare the
window with the value returned by `selected-window'.



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

* Re: Different text/properties in active vs inactive mode line
@ 2011-05-02 18:03 sdn.gnuem
  0 siblings, 0 replies; 8+ messages in thread
From: sdn.gnuem @ 2011-05-02 18:03 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 01 May 2011 03:49:38 -0400 (EDT), Eli Zaretskii wrote:



> That's okay, since I have no clear idea about what exactly you are

> after, either.





Hmm.  Okay, let me start over, with visual aids this time.  All links

below are to PNG images.



    I am trying to find a way to change mode-line text and/or

properties dynamically, based on whether the mode-line is currently

active or not.



    I have some propertized elements to my mode-line-format.  You can

see an example here: http://cl.ly/1o0e0x3N1m2F0b3X3x3J   (these aren't

the actual colors I use; this is an example for illustrative purposes).



    This works fine, but it looks awful against the mode-line-inactive

face, when I split the window. See http://cl.ly/3X132L2I2s1C3R3P0K1k



    Now, I could change the faces to look good with

mode-line-inactive, but then they look bad with the regular mode-line.

See http://cl.ly/0J0S361L3w3L1m0L0l2Z .  I suppose if I were some kind

of UI designer god, I could come up with combinations that look good

on both backgrounds.  But I'm not.



    What I want is to be able to define one face to use on the mode

line in the active window, and a different face to use on the mode

line for all of the inactive windows: http://cl.ly/1Y442G1C073O051G4630



    Then, when I move to a different window with C-xo, my custom faces

would change as the mode-line switches from mode-line face to

mode-line-inactive face: http://cl.ly/2Q1d3Z0q2a3W1s1S273m



I hope that helps.



-- Sue D. Nymme



----------
This message was sent from a MailNull anti-spam account.  You can get
your free account and take control over your email by visiting the
following URL.

   http://mailnull.com/



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

end of thread, other threads:[~2011-05-02 18:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30 13:17 Different text/properties in active vs inactive mode line sdn.gnuem
  -- strict thread matches above, loose matches on Subject: below --
2011-05-02 18:03 sdn.gnuem
2011-05-01  0:46 sdn.gnuem
2011-05-01  7:49 ` Eli Zaretskii
2011-04-30 15:25 sdn.gnuem
2011-04-30 16:14 ` Eli Zaretskii
2011-04-29 21:01 sdn.gnuem
2011-04-30 13:46 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).