如何设置新创建的 emacsclient 的样式和位置?

发布于 2024-10-04 19:44:06 字数 706 浏览 0 评论 0原文

我最近改用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

审判长 2024-10-11 19:44:06

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

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

其中 ~/.emacsclient 包含您的配置代码。您可能想要定义一个别名或菜单选项,这样您就不必在每次调用 emacsclient 时都实际键入这些内容。

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.

够钟 2024-10-11 19:44:06
(add-to-list 'default-frame-alist '(fullscreen . fullboth)) 

在 .emacs 中可以完成这项工作。

(add-to-list 'default-frame-alist '(fullscreen . fullboth)) 

in .emacs does the job.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文