问题
I've recently switched to emacsclient for most text editing. I am trying to migrate some of my settings to the new (and slightly different) environment.
In particular, in my .emacs file I have a function that sets the window size, and prepares some themes. However code in the .emacs file is not executed on each invocation of emacsclient, so the settings do not apply to these windows. Based on the question here, I added a hook to 'server-visit-hook
that called a function which executed my settings. However, the settings are not being applied when I restart the server and invoke emacsclient.
How can set the styling and positioning of new emacsclient windows? Relevant portions of my .emacs are included below:
(defun gui-mode()
(set-face-attribute 'default nil :font "Monospace-8")
(require 'theme-wombat)
(set-frame-size-according-to-resolution))
(add-hook 'server-visit-hook 'gui-mode)
(when window-system
(gui-mode))
回答1:
Start emacsclient with the -e option, and use that to tell it to load your configs:
emacsclient -c -e '(load "~/.emacsclient")'
where ~/.emacsclient contains your configuration code. You probably want to define an alias or menu option so that you don't actually type that in every time you call emacsclient.
回答2:
(add-to-list 'default-frame-alist '(fullscreen . fullboth))
in .emacs does the job.
来源:https://stackoverflow.com/questions/4315739/how-can-i-set-styling-and-positioning-of-a-newly-created-emacsclient