unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* properties in recursive mode-lines - what am I doing wrong?
@ 2008-12-06 16:32 Joost Diepenmaat
  2008-12-06 17:56 ` Andy Stewart
       [not found] ` <mailman.2073.1228586432.26697.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Joost Diepenmaat @ 2008-12-06 16:32 UTC (permalink / raw)
  To: help-gnu-emacs


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.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/



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

* Re: properties in recursive mode-lines - what am I doing wrong?
  2008-12-06 16:32 properties in recursive mode-lines - what am I doing wrong? Joost Diepenmaat
@ 2008-12-06 17:56 ` Andy Stewart
       [not found] ` <mailman.2073.1228586432.26697.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Stewart @ 2008-12-06 17:56 UTC (permalink / raw)
  To: help-gnu-emacs

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





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

* Re: properties in recursive mode-lines - what am I doing wrong?
       [not found] ` <mailman.2073.1228586432.26697.help-gnu-emacs@gnu.org>
@ 2008-12-06 18:06   ` Joost Diepenmaat
  0 siblings, 0 replies; 3+ messages in thread
From: Joost Diepenmaat @ 2008-12-06 18:06 UTC (permalink / raw)
  To: help-gnu-emacs

Andy Stewart <lazycat.manatee@gmail.com> writes:


> | (put 'my-test 'risky-local-variable t)

I can't believe I didn't notice that in the docs.

Thanks!

Joost.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

end of thread, other threads:[~2008-12-06 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-06 16:32 properties in recursive mode-lines - what am I doing wrong? Joost Diepenmaat
2008-12-06 17:56 ` Andy Stewart
     [not found] ` <mailman.2073.1228586432.26697.help-gnu-emacs@gnu.org>
2008-12-06 18:06   ` Joost Diepenmaat

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