如何设置新创建的emacsclient的样式和位置? [英] How can I set styling and positioning of a newly created emacsclient?

查看:115
本文介绍了如何设置新创建的emacsclient的样式和位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近切换到emacsclient进行大多数文本编辑.我正在尝试将一些设置迁移到新的(略有不同)的环境.

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.

尤其是在我的.emacs文件中,我有一个设置窗口大小并准备一些主题的函数.但是,.emacs文件中的代码不会在每次emacsclient调用时执行,因此设置不适用于这些窗口.根据问题此处,我在'server-visit-hook上添加了一个钩子,该钩子调用了执行我的设置的函数.但是,当我重新启动服务器并调用emacsclient时,未应用设置.

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.

如何设置新的emacsclient窗口的样式和位置?我的.emacs的相关部分如下:

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

推荐答案

使用-e选项启动emacsclient,并使用它告诉它加载您的配置:

Start emacsclient with the -e option, and use that to tell it to load your configs:

emacsclient -c -e '(load "~/.emacsclient")'

其中〜/.emacsclient包含您的配置代码.您可能想定义一个别名或菜单选项,这样您就不必在每次调用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.

这篇关于如何设置新创建的emacsclient的样式和位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆