unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Creating a custom face for a variable shown in global-mode-string?
@ 2024-11-24 11:57 Marc Coquand
  2024-11-25 22:56 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Coquand @ 2024-11-24 11:57 UTC (permalink / raw)
  To: help-gnu-emacs


I have a indicator I've created which shows if my custom ctrl-lock
should be shown, the state is stored in a variable ctrl-lock-state, I'd
like to turn it red.

I've added the variable to my global-mode-string the following way:

(push '(ctrl-lock-state " [CTRL] " "") global-mode-string)

And it shows up without any issues.

Is there a way to change the color of it, so it is shown in a red and
bold color?

Thanks in advance. 

-- 
Marc



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

* Re: Creating a custom face for a variable shown in global-mode-string?
  2024-11-24 11:57 Creating a custom face for a variable shown in global-mode-string? Marc Coquand
@ 2024-11-25 22:56 ` Michael Heerdegen
  2024-11-26  7:09   ` Marc Coquand
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2024-11-25 22:56 UTC (permalink / raw)
  To: Marc Coquand; +Cc: help-gnu-emacs

Marc Coquand <marc@mccd.space> writes:

> (push '(ctrl-lock-state " [CTRL] " "") global-mode-string)
> [...]
> Is there a way to change the color of it, so it is shown in a red and
> bold color?

Is the question about how to create a face, or how to attach it?

I assume you ask about the latter: please look at

   (info "(elisp) Properties in Mode")

in the GNU Emacs Lisp Reference Manual then.  You will probably want to
use a :propertize construct specifying a 'face' text property.


Michael.



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

* Re: Creating a custom face for a variable shown in global-mode-string?
  2024-11-25 22:56 ` Michael Heerdegen
@ 2024-11-26  7:09   ` Marc Coquand
  0 siblings, 0 replies; 3+ messages in thread
From: Marc Coquand @ 2024-11-26  7:09 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs


I was trying to figure out how to do both but couldn't find it in the
emacs manual.

Thanks for the pointers, I'll have a look! 

-- 
Marc

On Mon, Nov 25 2024, Michael Heerdegen wrote:

> Marc Coquand <marc@mccd.space> writes:
>
>> (push '(ctrl-lock-state " [CTRL] " "") global-mode-string)
>> [...]
>> Is there a way to change the color of it, so it is shown in a red and
>> bold color?
>
> Is the question about how to create a face, or how to attach it?
>
> I assume you ask about the latter: please look at
>
>    (info "(elisp) Properties in Mode")
>
> in the GNU Emacs Lisp Reference Manual then.  You will probably want to
> use a :propertize construct specifying a 'face' text property.
>
>
> Michael.



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

end of thread, other threads:[~2024-11-26  7:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-24 11:57 Creating a custom face for a variable shown in global-mode-string? Marc Coquand
2024-11-25 22:56 ` Michael Heerdegen
2024-11-26  7:09   ` Marc Coquand

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).