1

I'm using gnu emacs as emacs -nw in a terminal window. Colored text is usually almost completely illegible for me. As recommended in this answer, I have done the following in an attempt to get rid of all coloring:

(dolist (face (face-list))
  (set-face-attribute face nil :foreground nil :background nil))

However, I still get colored text when I do operations like searching. For example, if I do control-S, I get a dark blue prompt that says "I-search," and if the search is failing, then the trailing part of the search string is highlighted in pink.

Also, if I start up emacs without giving a filename, there is a help screen with hyperlinks, which are colored.

Is there some way to get rid of these other types of coloring as well?

4
  • try to start your emacs with emacs -q -nw and eval your (dolist (face ...)-expression there is no color for anything left, neither C-s nor the greeting screen. The problem is probably somewhere in your init.
    – jue
    Feb 23 '20 at 1:25
  • @jue: When I evaluate that lisp code using M-x eval-region, you're right, all colors immediately go away. However, it doesn't seem to be working properly when it's run initially from my .emacs file. My .emacs file is being evaluated -- I have other code in it that does have the expected effect, e.g., (menu-bar-mode 0), which does what it's supposed to do. I tried deleting everything from the .emacs file except for the code I quoted in the question, and it still doesn't work. I also tried moving other code after that code, and it still gets evaluated. Feb 23 '20 at 1:34
  • some packages define colored faces, if those packages are loaded after your dolist, then they introduce colors. You need to ensure that your dolist is evaled after loading of packages.
    – jue
    Feb 23 '20 at 1:38
  • @jue: I see, thanks. How do I do that? Feb 23 '20 at 1:41
1

You need to run your uncolor loop after loading of any package, because packages can introduce new colored faces when they (lazy or auto) load.

To ensure all colors are removed after any loading of a package, you could use the hook after-load-function. Following code will do this:

(defun uncolor-after-load (&rest foo)
  (dolist (face (face-list))
    (set-face-attribute face nil :foreground nil :background nil)))

(add-to-list 'after-load-functions #'uncolor-after-load)

Edit: after-load-functions is a list of functions, so I changed the setq above to an add-to-list, which keeps former entries.

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.