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

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

RE: Changing Color Of Column # In Modeline


From: Drew Adams
Subject: RE: Changing Color Of Column # In Modeline
Date: Wed, 23 Nov 2005 13:08:30 -0800

     > How about putting this in your init file:
     >
     > (setf mode-line-position '(:eval (if (>= (current-column) 80)
     >                                      '(:propertize "(%l,%c)"
     >                                        face bold)
     >                                    "(%l,%c)")))

    Does that really work for you?  mode-line-position is not
    documented in Emacs 21 -- are you running 22.0 (CVS)?

It works fine in Emacs 22. Yes, `mode-line-position' is undefined in Emacs
21. I use this, BTW:

(setq mode-line-position
          '(:eval (let ((help-echo "mouse-1: select (drag to resize), \
mouse-2: delete others, mouse-3: delete this"))
                    `((-3 ,(propertize "%p" 'help-echo help-echo))
                      (size-indication-mode
                       (8 ,(propertize " of %I" 'help-echo help-echo)))
                      (line-number-mode
                       ((column-number-mode
                         (10 ,(propertize
                               " (%l,%c)"
                               'face (and (> (current-column)
                                             1on1-mode-line-column-limit)
                                          'font-lock-function-name-face)
                               'help-echo help-echo))
                         (6 ,(propertize " L%l" 'help-echo help-echo))))
                       ((column-number-mode
                         (5 ,(propertize
                              " C%c"
                              'face (and (> (current-column)
                                            1on1-mode-line-column-limit)
                                         'font-lock-function-name-face)
                              'help-echo help-echo)))))))))

The key thing here is :eval, which makes sure the column-number face gets
updated - it is available in Emacs 21, as is `mode-line-format', which you
can manipulate in a way similar to the above to change the
`column-number-mode' face.

In Emacs 20, you could use `put' to add the text properties (there is no
`propertize'), but you cannot easily update the face, because there is no
:eval.





reply via email to

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