1

I was trying to fix the annoying red output in slime. It's OK on light backgrounds but on the dark backgrounds it gets on my nerves.

Some themes fix it. Quick experiment with aurora-theme reveals that slime-repl-inputed-output-face is responsible for the colour.

To fix it I wrote a little function

(defun repl-theme-fix ()
  "Fix REPL theme issues concerning the red annoying text."
  (interactive)
  (print "going to change repl buffer")
  (print (current-buffer))
  (load-theme-buffer-local 'hamburg (current-buffer)))

The problem is I have to run M-x repl-theme-fix each time I start the REPL.

I've tired to experiment with

(add-hook 'lisp-interaction-mode-hook (lambda () (some code here)))

But couldn't make it work not knowing the current-buffer argument needed by the theme.

Another option would be fixing the theme instead of replacing it with hamburg-theme.

What is the best way to fix a theme in emacs startup file?

Searching

In slime repl, when I move cursor on colourized output and press C-u C-x = I get more detailed information, which contains hyperlink to a file where the font for slime-repl-inputed-output-face is defined.

~/quicklisp/dists/quicklisp/software/slime-2.14/contrib/slime-presentations.el

In that file I have found the right code fragment and replaced foreground color with Yellow.

(defface slime-repl-inputed-output-face
  '((((class color) (background light)) (:foreground "Red"))
    (((class color) (background dark)) (:foreground "Yellow"))
    (t (:slant italic)))
  "Face for the result of an evaluation in the SLIME REPL."
  :group 'slime-repl)

It does what I want to do. When theme does not change the colour I still get nice default for dark backgrounds.

But still do not know how to do it in the init file. What is the best way of fixing it?

1

You should be able to permanently change the face via the customization facility. Try:

M-x customize-face slime-repl-inputed-output-face

Then you can change the foreground color directly, and if you save the changes (Apply and Save), the changes will be stored for future use.

Note that this requires that slime is already started before you can make the change. After that, it should stick.

You can specify different faces for different types of display, such as dark and light backgrounds, terminals or GUI windows. To do this:

  • select the [ State ] option, and set it to For All Kinds of Displays by pressing 9
  • Then [INS] a rule for each kind of display you want.
  • For each rule, set the Display option to a specific delay.

For the example in the question, the result will look like this:

Slime Repl Inputed Output Face:[sample]
   [ State ]: EDITED, shown value does not take effect until you set or save it.
   Face for the result of an evaluation in the SLIME REPL.
[INS] [DEL] Display: [ ] Type: [ ] X [ ] PM [ ] W32 [ ] NS [ ] DOS [ ] TTY
                     [X] Class: [X] Color [ ] Grayscale [ ] Monochrome
                     [ ] Minimum number of colors: 0
                     [X] Background brightness: [X] Light [ ] Dark
                     [ ] Supports attributes:
                           -- Empty face --
                        Show All Attributes
               [X] Foreground: red        [ Choose ]  (sample)
               Show All Attributes
[INS] [DEL] Display: [ ] Type: [ ] X [ ] PM [ ] W32 [ ] NS [ ] DOS [ ] TTY
                     [X] Class: [X] Color [ ] Grayscale [ ] Monochrome
                     [ ] Minimum number of colors: 0
                     [X] Background brightness: [ ] Light [X] Dark
                     [ ] Supports attributes:
                           -- Empty face --
                        Show All Attributes
               [X] Foreground: yellow     [ Choose ]  (sample)
               Show All Attributes
[INS]
  • will it be selective depending if the background is dark or not? – ruby_object Mar 29 '16 at 16:26
  • It can be. I'll update the answer. – Tyler Mar 29 '16 at 17:01
  • I needed to revisit your approach. Before I used some kind of hack and your answer seems to fit better into the overall Emacs ecosystem. – ruby_object Jul 28 '17 at 23:10

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.