如何设置新创建的 emacsclient 的样式和位置?
我最近改用 emacsclient 进行大部分文本编辑。我正在尝试将一些设置迁移到新的(略有不同的)环境。
特别是,在我的 .emacs 文件中,我有一个设置窗口大小并准备一些主题的函数。但是,.emacs 文件中的代码不会在每次调用 emacsclient 时执行,因此这些设置不适用于这些窗口。根据此处的问题,我向 'server-visit-hook
添加了一个钩子,该钩子调用了执行我的设置的函数。但是,当我重新启动服务器并调用 emacsclient 时,这些设置并未应用。
如何设置新 emacsclient 窗口的样式和位置?我的 .emacs 的相关部分如下:
(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))
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))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 -e 选项启动 emacsclient,并使用它来告诉它加载您的配置:
其中 ~/.emacsclient 包含您的配置代码。您可能想要定义一个别名或菜单选项,这样您就不必在每次调用 emacsclient 时都实际键入这些内容。
Start emacsclient with the -e option, and use that to tell it to load your configs:
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.
在 .emacs 中可以完成这项工作。
in .emacs does the job.