unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Changing colour face for mode-line-buffer-identification
@ 2024-07-26 20:11 Heime
  2024-07-26 20:32 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Heime @ 2024-07-26 20:11 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

How can I change the colour face with which the buffer name is displayed ?

  (setq-default mode-line-buffer-identification
    (list wmax (propertized-buffer-identification
                 (format " %%%db " wmin))))




Sent with Proton Mail secure email.



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

* Re: Changing colour face for mode-line-buffer-identification
  2024-07-26 20:11 Changing colour face for mode-line-buffer-identification Heime
@ 2024-07-26 20:32 ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-07-27  9:43   ` Heime
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-26 20:32 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> How can I change the colour face with which the buffer name is displayed ?
>
>   (setq-default mode-line-buffer-identification
>     (list wmax (propertized-buffer-identification
>                  (format " %%%db " wmin))))

Use faces.  `propertized-buffer-identification' already uses one.  Just
use a different face.

Michael.




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

* Re: Changing colour face for mode-line-buffer-identification
  2024-07-26 20:32 ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-27  9:43   ` Heime
  2024-07-27 12:12     ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Heime @ 2024-07-27  9:43 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

On Saturday, July 27th, 2024 at 8:32 AM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > How can I change the colour face with which the buffer name is displayed ?
> > 
> > (setq-default mode-line-buffer-identification
> > (list wmax (propertized-buffer-identification
> > (format " %%%db " wmin))))
> 
> 
> Use faces. `propertized-buffer-identification' already uses one. Just
> use a different face.
> 
> Michael.

I know about faces, but how do I include a different face to 
propertized-buffer-identification.  Or is the face to be applied  
from another function ?



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

* Re: Changing colour face for mode-line-buffer-identification
  2024-07-27  9:43   ` Heime
@ 2024-07-27 12:12     ` Michael Heerdegen via Users list for the GNU Emacs text editor
  2024-07-27 13:04       ` Heime
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-27 12:12 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> I know about faces, but how do I include a different face to 
> propertized-buffer-identification.  Or is the face to be applied  
> from another function ?

Calling `propertized-buffer-identification' returns a one-element list
containing the propertized string.  `propertize' that string again to
change the face.

Unless the face should depend on the buffer or mode.  This would be a
different situation.


Michael.




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

* Re: Changing colour face for mode-line-buffer-identification
  2024-07-27 12:12     ` Michael Heerdegen via Users list for the GNU Emacs text editor
@ 2024-07-27 13:04       ` Heime
  2024-07-27 14:13         ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Heime @ 2024-07-27 13:04 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs






Sent with Proton Mail secure email.

On Sunday, July 28th, 2024 at 12:12 AM, Michael Heerdegen via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:

> Heime heimeborgia@protonmail.com writes:
> 
> > I know about faces, but how do I include a different face to
> > propertized-buffer-identification. Or is the face to be applied
> > from another function ?
> 
> 
> Calling `propertized-buffer-identification' returns a one-element list containing the propertized string.` propertize' that string again to
> change the face.
> 
> Unless the face should depend on the buffer or mode. This would be a
> different situation.
> 
> 
> Michael.

Have done this before but got an error

Debugger entered--Lisp error: (wrong-type-argument stringp (#(" %8b " 0 5 (face mode-line-buffer-id help-echo "Buffer name\nmouse-1: Previous buffer\nmouse-3: Next..." mouse-face mode-line-highlight local-map (keymap (header-line keymap (mouse-3 . mode-line-next-buffer) (down-mouse-3 . ignore) (mouse-1 . mode-line-previous-buffer) (down-mouse-1 . ignore)) (mode-line keymap (mouse-3 . mode-line-next-buffer) (mouse-1 . mode-line-previous-buffer)))))))
  propertize((#(" %8b " 0 5 (face mode-line-buffer-id help-echo

(defface vodil-bfname-facespk
  '((t :background "#ff4500"  ; Orange Red
       :foreground "#ffffff"  ; White
       :inherit bold))
  "Face for displaying the Buffer Name in the Modeline of the
Active Window.")

(defface vodil-inaktv-facespk
  `((t :background ,vodil-dark-gray     ; "#222222"
       :foreground ,vodil-light-gray))  ; "#888888"
  "Face for displaying the Modeline in the Inactive Window.")

(defun vodil-bfname-face ()
  "Return the appropriate face for the mode line based on window
selection."

  (if (mode-line-window-selected-p)
        'vodil-bfname-facespk
    'vodil-inaktv-facespk))

    (setq-default mode-line-buffer-identification
      (list wmax
            (propertize
              (propertized-buffer-identification
                (format " %%%db " wmin))
              'face (vodil-bfname-face)))) ))




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

* Re: Changing colour face for mode-line-buffer-identification
  2024-07-27 13:04       ` Heime
@ 2024-07-27 14:13         ` Michael Heerdegen via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Heerdegen via Users list for the GNU Emacs text editor @ 2024-07-27 14:13 UTC (permalink / raw)
  To: help-gnu-emacs

Heime <heimeborgia@protonmail.com> writes:

> > Calling `propertized-buffer-identification' returns a one-element
> > list containing the propertized string.` propertize' that string
> > again to
> > change the face.
> > 
> > Unless the face should depend on the buffer or mode. This would be a
> > different situation.
> > 
> > 
> > Michael.
>
> Have done this before but got an error
>
> Debugger entered--Lisp error: (wrong-type-argument stringp (#(" %8b " 0 5 (face mode-line-buffer-id help-echo "Buffer name\nmouse-1: Previous buffer\nmouse-3: Next..." mouse-face mode-line-highlight local-map (keymap (header-line keymap (mouse-3 . mode-line-next-buffer) (down-mouse-3 . ignore) (mouse-1 . mode-line-previous-buffer) (down-mouse-1 . ignore)) (mode-line keymap (mouse-3 . mode-line-next-buffer) (mouse-1 . mode-line-previous-buffer)))))))
>   propertize((#(" %8b " 0 5 (face mode-line-buffer-id help-echo

I had said that you `propertize' the string.  Not the list of course.
You can't add text properties to a list.


Michael.




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

end of thread, other threads:[~2024-07-27 14:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-26 20:11 Changing colour face for mode-line-buffer-identification Heime
2024-07-26 20:32 ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-27  9:43   ` Heime
2024-07-27 12:12     ` Michael Heerdegen via Users list for the GNU Emacs text editor
2024-07-27 13:04       ` Heime
2024-07-27 14:13         ` Michael Heerdegen via Users list for the GNU Emacs text editor

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