I'd like to have emacs not to have a background color when I open a frame in the terminal. I'm using a terminal with a translucent background, and characters with a background color are not "see-through". TERM is set to "xterm-256color".
How do I get emacs to use the default background color (no color at all), when the frame is not graphical?
Edit:
I've got it, sort of:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'my-awesome-theme t)
(defun on-frame-open (frame)
(if (not (display-graphic-p frame))
(set-face-background 'default "unspecified-bg" frame)))
(on-frame-open (selected-frame))
(add-hook 'after-make-frame-functions 'on-frame-open)
I put the above code in my init file, but only suppresses the background when opening an emacsclient in a terminal, and not emacs itself (i.e. only when invoked with emacsclient -t
and not when invoked with emacs
). Adding an extra (unless window-system (set-face-background 'default "unspecified-bg" (selected-frame)))
doesn't work and only confuses graphical frames.
Any ideas on why this might happen?
Best Answer
Combined with the code in your edit, it worked nicely for me for both emacsterms and newly started emacsen. As for why
window-setup-hook
: http://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html(neither of the earlier hooks seemed to work except for this one.)