unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Changing colour of ruler-mode-current-column
@ 2022-09-10 22:58 uzibalqa
  2022-09-11  5:13 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: uzibalqa @ 2022-09-10 22:58 UTC (permalink / raw)
  To: uzibalqa via Users list for the GNU Emacs text editor

I am using ruler-mode and would like to change the background and foreground colour of the cursor indicator.

Had a go but ruler-mode-current-column is not a face.

(set-face-attribute 'ruler-mode-current-column nil
  :background "#ff4500" :foreground "#ffffff")





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

* Re: Changing colour of ruler-mode-current-column
  2022-09-10 22:58 Changing colour of ruler-mode-current-column uzibalqa
@ 2022-09-11  5:13 ` Eli Zaretskii
  2022-09-11 11:57   ` Christopher Dimech
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-09-11  5:13 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 10 Sep 2022 22:58:01 +0000
> From: uzibalqa <uzibalqa@proton.me>
> 
> I am using ruler-mode and would like to change the background and foreground colour of the cursor indicator.
> 
> Had a go but ruler-mode-current-column is not a face.
> 
> (set-face-attribute 'ruler-mode-current-column nil
>   :background "#ff4500" :foreground "#ffffff")

Yes, ruler-mode-current-column _is_ a face, and the above works for
me: the colors of the current-column indicator change.



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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11  5:13 ` Eli Zaretskii
@ 2022-09-11 11:57   ` Christopher Dimech
  2022-09-11 12:06     ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Christopher Dimech @ 2022-09-11 11:57 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

> Sent: Sunday, September 11, 2022 at 5:13 PM
> From: "Eli Zaretskii" <eliz@gnu.org>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Changing colour of ruler-mode-current-column
>
> > Date: Sat, 10 Sep 2022 22:58:01 +0000
> > From: uzibalqa <uzibalqa@proton.me>
> >
> > I am using ruler-mode and would like to change the background and foreground colour of the cursor indicator.
> >
> > Had a go but ruler-mode-current-column is not a face.
> >
> > (set-face-attribute 'ruler-mode-current-column nil
> >   :background "#ff4500" :foreground "#ffffff")
>
> Yes, ruler-mode-current-column _is_ a face, and the above works for
> me: the colors of the current-column indicator change.

There exists the possibility of needing this (require 'ruler-mode)



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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11 11:57   ` Christopher Dimech
@ 2022-09-11 12:06     ` Eli Zaretskii
  2022-09-11 12:13       ` uzibalqa
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-09-11 12:06 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Christopher Dimech <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Sun, 11 Sep 2022 13:57:44 +0200
> 
> > Sent: Sunday, September 11, 2022 at 5:13 PM
> > From: "Eli Zaretskii" <eliz@gnu.org>
> > To: help-gnu-emacs@gnu.org
> > Subject: Re: Changing colour of ruler-mode-current-column
> >
> > > Date: Sat, 10 Sep 2022 22:58:01 +0000
> > > From: uzibalqa <uzibalqa@proton.me>
> > >
> > > I am using ruler-mode and would like to change the background and foreground colour of the cursor indicator.
> > >
> > > Had a go but ruler-mode-current-column is not a face.
> > >
> > > (set-face-attribute 'ruler-mode-current-column nil
> > >   :background "#ff4500" :foreground "#ffffff")
> >
> > Yes, ruler-mode-current-column _is_ a face, and the above works for
> > me: the colors of the current-column indicator change.
> 
> There exists the possibility of needing this (require 'ruler-mode)

I evaluated the above set-face-attribute form after turning on
ruler-mode.



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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11 12:06     ` Eli Zaretskii
@ 2022-09-11 12:13       ` uzibalqa
  2022-09-11 12:35         ` Eli Zaretskii
  2022-09-11 14:15         ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 8+ messages in thread
From: uzibalqa @ 2022-09-11 12:13 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

------- Original Message -------
On Sunday, September 11th, 2022 at 12:06 PM, Eli Zaretskii <eliz@gnu.org> wrote:


> > From: Christopher Dimech dimech@gmx.com
> > Cc: help-gnu-emacs@gnu.org
> > Date: Sun, 11 Sep 2022 13:57:44 +0200
> > 
> > > Sent: Sunday, September 11, 2022 at 5:13 PM
> > > From: "Eli Zaretskii" eliz@gnu.org
> > > To: help-gnu-emacs@gnu.org
> > > Subject: Re: Changing colour of ruler-mode-current-column
> > > 
> > > > Date: Sat, 10 Sep 2022 22:58:01 +0000
> > > > From: uzibalqa uzibalqa@proton.me
> > > > 
> > > > I am using ruler-mode and would like to change the background and foreground colour of the cursor indicator.
> > > > 
> > > > Had a go but ruler-mode-current-column is not a face.
> > > > 
> > > > (set-face-attribute 'ruler-mode-current-column nil
> > > > :background "#ff4500" :foreground "#ffffff")
> > > 
> > > Yes, ruler-mode-current-column is a face, and the above works for
> > > me: the colors of the current-column indicator change.
> > 
> > There exists the possibility of needing this (require 'ruler-mode)
> 
> 
> I evaluated the above set-face-attribute form after turning on
> ruler-mode.

I have the following setup

(defun typex-ruler ()

  "Customisation for ruler."

  (interactive)

  (require 'ruler-mode)

  (add-hook 'window-configuration-change-hook (lambda () (ruler-mode 1)))

  (set-face-attribute 'ruler-mode-current-column nil :background "#ff4500" :foreground "#ffffff") )

Is there a recommended better way to do it?







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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11 12:13       ` uzibalqa
@ 2022-09-11 12:35         ` Eli Zaretskii
  2022-09-11 12:41           ` uzibalqa
  2022-09-11 14:15         ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-09-11 12:35 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sun, 11 Sep 2022 12:13:53 +0000
> From: uzibalqa <uzibalqa@proton.me>
> Cc: help-gnu-emacs@gnu.org
> 
> I have the following setup
> 
> (defun typex-ruler ()
>   "Customisation for ruler."
>   (interactive)
>   (require 'ruler-mode)
>   (add-hook 'window-configuration-change-hook (lambda () (ruler-mode 1)))
>   (set-face-attribute 'ruler-mode-current-column nil :background "#ff4500" :foreground "#ffffff") )
> 
> Is there a recommended better way to do it?

Better from what POV?  Does the above fail to work for some reason?



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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11 12:35         ` Eli Zaretskii
@ 2022-09-11 12:41           ` uzibalqa
  0 siblings, 0 replies; 8+ messages in thread
From: uzibalqa @ 2022-09-11 12:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

------- Original Message -------
On Sunday, September 11th, 2022 at 12:35 PM, Eli Zaretskii <eliz@gnu.org> wrote:


> > Date: Sun, 11 Sep 2022 12:13:53 +0000
> > From: uzibalqa uzibalqa@proton.me
> > Cc: help-gnu-emacs@gnu.org
> > 
> > I have the following setup
> > 
> > (defun typex-ruler ()
> > "Customisation for ruler."
> > (interactive)
> > (require 'ruler-mode)
> > (add-hook 'window-configuration-change-hook (lambda () (ruler-mode 1)))
> > (set-face-attribute 'ruler-mode-current-column nil :background "#ff4500" :foreground "#ffffff") )
> > 
> > Is there a recommended better way to do it?
> 
> 
> Better from what POV? Does the above fail to work for some reason?


It works, everything is fine.




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

* Re: Changing colour of ruler-mode-current-column
  2022-09-11 12:13       ` uzibalqa
  2022-09-11 12:35         ` Eli Zaretskii
@ 2022-09-11 14:15         ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-09-11 14:15 UTC (permalink / raw)
  To: help-gnu-emacs

>   (add-hook 'window-configuration-change-hook (lambda () (ruler-mode 1)))

A.k.a (add-hook 'window-configuration-change-hook #'ruler-mode)

But to tell you the truth, I have no idea why you'd want to re-enable
ruler-mode every time the window-config changes.

ruler-mode is a buffer-local minor mode, so you'd normally install it
into a major-mode hook so as to enable it in those buffers where you
need it.

>  (set-face-attribute 'ruler-mode-current-column nil :background "#ff4500" :foreground "#ffffff") )

I'd stay away from a fiddly low-level function like `set-face-attribute`
and change face settings via Custom instead (or if you really want to
avoid Custom, use something like `face-spec-set`).


        Stefan




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

end of thread, other threads:[~2022-09-11 14:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-10 22:58 Changing colour of ruler-mode-current-column uzibalqa
2022-09-11  5:13 ` Eli Zaretskii
2022-09-11 11:57   ` Christopher Dimech
2022-09-11 12:06     ` Eli Zaretskii
2022-09-11 12:13       ` uzibalqa
2022-09-11 12:35         ` Eli Zaretskii
2022-09-11 12:41           ` uzibalqa
2022-09-11 14:15         ` Stefan Monnier 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).