How to Set Emacsclient Background as Emacs Background

How to set emacsclient background as Emacs background?

set-background-color and set-foreground-color only affect the current frame, and your .emacs file is not executed when running emacsclient.

Try setting the variable default-frame-alist ("Alist of default values for frame creation") instead:


(setq default-frame-alist
'((background-color . "#101416")
(foreground-color . "#f6f3e8")))

create emacs alias that starts in background?

Instead of calling /usr/bin/emacs-snapshot directly, write a script that calls /usr/bin/emacs-snapshot in the background and then returns:

#!/bin/sh
case $# in
0) /usr/bin/emacs-snapshot &
*) /usr/bin/emacs-snapshot "$@" &
esac

Then you call the script in the ordinary way; it will launch a background emacs process and return immediately.

If you want to get fancy you can use /bin/bash and disown the process after the esac (get the pid with $!).

How to set default emacs background and foreground colors?

Add the following to your .emacs:

(add-to-list 'default-frame-alist '(foreground-color . "#E0DFDB"))
(add-to-list 'default-frame-alist '(background-color . "#102372"))

You might want to look at http://www.emacswiki.org/emacs/FrameParameters and the links therein.

how to check if emacs in frame or in terminal?

(defun my-frame-config (frame)
"Custom behaviours for new frames."
(with-selected-frame frame
(when (display-graphic-p)
(set-background-color "#101416")
(set-foreground-color "#f6f3e8"))))
;; run now
(my-frame-config (selected-frame))
;; and later
(add-hook 'after-make-frame-functions 'my-frame-config)

Emacs: disable theme background color in terminal

(defun on-after-init ()
(unless (display-graphic-p (selected-frame))
(set-face-background 'default "unspecified-bg" (selected-frame))))

(add-hook 'window-setup-hook 'on-after-init)

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.)

Change Emacs' background color

It seems that it's better to use

(custom-set-faces
'(default ... )
'(region ... )
....
)

style to set faces, this way it will not have that problem.

How to get background type of Emacs? e.g. 'light or 'dark

You can use the function frame-parameter to get the attributes of a frame. For your particular case you can do

(frame-parameter nil 'background-mode)

To get background-mode of the current frame. The first parameter is the frame for which you want to the get specified parameter, if nil the currently selected frame is used. You can do C-hfframe-parameterRET



Related Topics



Leave a reply



Submit