help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: properties in recursive mode-lines - what am I doing wrong?


From: Andy Stewart
Subject: Re: properties in recursive mode-lines - what am I doing wrong?
Date: Sun, 07 Dec 2008 01:56:12 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi Joost,

Joost Diepenmaat <joost@zeekat.nl> writes:

> I just can't get properties to work on "indirect" modelines. I want to
> add a modeline string to global-mode-string, using a symbol (like
> display-time-mode does), but it seems I'm doing it wrong.
>
> Example code:
>
> ;; a simple modeline string with properties
>
> (setq my-test (propertize "a bold modeline string" 'help-echo 
>                           "a helptext" 'face 'bold))
>
> ;; this shows the help text property and bold text
>
> (setq global-mode-string
>       my-test)
>
> ;; but neither of the following constructs seem to do the same
>
> (setq global-mode-string
>       'my-test)
>
> (setq global-mode-string
>       '("" my-test))
>
>
> I'm running today's emacs CVS (tested both with today's version and one
> from early august)
>
> Any help would be appreciated,
> Joost.

Look this:

Below is define:

,----
| (defvar my-test nil "for test string")
|                           
| (unless (member 'my-test global-mode-string)
|   (setq global-mode-string (append global-mode-string
|                                    (list 'my-test))))                         
 
`----

Below is code for update `my-test' in `global-mode-string':

,----
| ...
| 
| (force-mode-line-update t)
| (put 'my-test 'risky-local-variable t)
| (setq my-test (propertize "a bold modeline string" 'help-echo 
|                           "a helptext" 'face 'bold))
| 
| ...
`----

Enjoy!

  -- Andy





reply via email to

[Prev in Thread] Current Thread [Next in Thread]