0

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

Had a go with ruler-mode-current-column but emacs is complaining that ruler-mode-current-column is not a face.

(defun lex-ruler ()

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

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

1 Answer 1

0

The customize system is the best way to go here. It groups all of the settings for the mode together, and that includes the various faces the mode defines. Use M-x customize-group ruler-mode to go directly to the mode’s settings. Each face is concisely described, and includes a sample, so you should have no trouble finding the one(s) you wish to modify.

Edit:

It’s certainly a face here:

(face-attribute 'ruler-mode-current-column :foreground)
"yellow"

(set-face-attribute 'ruler-mode-current-column nil :foreground "blue")
nil

(face-attribute 'ruler-mode-current-column :foreground)
"blue"

What does it do when you try it?

12
  • Have encountered ruler-mode-current-column, but still need to do this in elisp.
    – konmi
    Sep 10, 2022 at 22:18
  • Why do you need to do it in elisp?
    – db48x
    Sep 10, 2022 at 23:30
  • Because I take care of various versions of emacs and want to just send the .el file.
    – konmi
    Sep 10, 2022 at 23:32
  • The customize interface saves your settings as elisp in your init file; is that not good enough?
    – db48x
    Sep 10, 2022 at 23:35
  • Could I pick up the code from there?
    – konmi
    Sep 10, 2022 at 23:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.