初始启动时 Emacs 框架的大小 - 希望设置为屏幕的全高和一半宽度

发布于 2024-12-13 16:05:54 字数 338 浏览 3 评论 0原文

我试图弄清楚这一点,并找到了有关如何设置帧启动像素的函数。我发现了这个,但似乎适用于 Windows,无法正常工作: http://www.gnu.org/software/emacs/windows/old/faq4.html。可能只是我对编写 lisp 代码的无知。我想使用 x-display-pixel-height 和 x-display-pixel-width 的一半来设置帧大小。有谁有执行类似操作的代码或知道如何正确实现此操作。这是因为在不同的系统上它总是将其设置为具有大小。

I was trying to figure this out and I found the functions on how to set the pixels for a frame to start. I found this but appears to be for windows and couldn't get it working right: http://www.gnu.org/software/emacs/windows/old/faq4.html. May just have been my ignorance for writing lisp code. I wanted to use x-display-pixel-height and then half of x-display-pixel-width to set the frame sizes. Does anyone have code that does something similar or know how to correctly implement this. This is so on different systems it always sets it to have the size.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

情绪失控 2024-12-20 16:05:54

这应该将帧大小设置为大约正确的大小:

(set-frame-height
 (selected-frame)
 (/ (display-pixel-height) (frame-char-height)))
(set-frame-width
 (selected-frame)
 (/ (/ (display-pixel-width) 2) (frame-char-width)))


不幸的是,正如frame-height的文档所述,帧像素高度和行高之间的关系只是近似的:

结果大致与帧像素高度相关,通过
像素高度 = 行高度 * ‘frame-char-height’。
然而,这只是近似值,并且很复杂,例如
事实上,单独的窗口线和菜单栏线可以有
不同的字体高度。

This should set the frame size to approximately the right size:

(set-frame-height
 (selected-frame)
 (/ (display-pixel-height) (frame-char-height)))
(set-frame-width
 (selected-frame)
 (/ (/ (display-pixel-width) 2) (frame-char-width)))


Unfortunately, as the documentation for frame-height states, the relationship between frame pixel height and line height is only approximate:

The result is roughly related to the frame pixel height via
height in pixels = height in lines * `frame-char-height'.
However, this is only approximate, and is complicated e.g. by the
fact that individual window lines and menu bar lines can have
differing font heights.

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