为初始框架和新框架设置默认 emacs 字体
Setting default emacs font for initial and new frame
这个或类似的问题已经被问过很多次了,有几十个答案,但似乎没有达成共识,所以我冒着惹怒监视器的风险问我自己的版本:
我在 Debian bullseye 上使用 emacs 26.1。我买了一个 4k 显示器,默认的 emacs 字体在显示器上显得太大了。阅读本网站上的许多相关答案,我发现添加行
(set-face-attribute 'default (selected-frame) :height 60)
我的 .emacs
文件导致初始 Emacs 框架中的字体大小为 6 pts,这很棒。当我尝试使用 C-x 5 2
打开一个新框架时出现问题。新框架打开时的字体大小为 11。可以通过 Options
-> 设置默认字体并从 11 减少到 6 来更改。但是,如果新框架以正确的字体大小打开( 6).
有什么建议吗?
在我的 init 中,我将以下内容连接到 after-make-frame-functions
中,我在其中设置字体(肯定是从网上某处获取的),
(defun my-frame-init ()
;; eg.
(set-face-attribute 'mode-line nil
:font "NanumGothicCoding-14"
:weight 'normal))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(my-frame-init)))
(my-frame-init))
面default
可以用set-face-attribute
,但用nil
或t
,不能用(selected-frame)
作为值参数 FRAME
:
(set-face-attribute 'default nil :height 60)
C-h f set-face-attribute
告诉你:
set-face-attribute
is a compiled Lisp function in faces.el
.
(set-face-attribute FACE FRAME &rest ARGS)
Set attributes of FACE
on FRAME
from ARGS
.
This function overrides the face attributes specified by FACE
’s
face spec. It is mostly intended for internal use only.
If FRAME
is nil
, set the attributes for all existing frames, as
well as the default for new frames. If FRAME
is t
, change the
default for new frames only.
...
或者您可以自定义选项default-frame-alist
,以提供您想要的框架参数值。这会影响所有新框架(至少是普通框架)。 M-x customize-option default-frame-alist
.
您可以设置框架参数 font
- 例如:
"-*-Lucida Console-normal-r-*-*-12-*-*-*-c-*-iso8859-1"
这个或类似的问题已经被问过很多次了,有几十个答案,但似乎没有达成共识,所以我冒着惹怒监视器的风险问我自己的版本:
我在 Debian bullseye 上使用 emacs 26.1。我买了一个 4k 显示器,默认的 emacs 字体在显示器上显得太大了。阅读本网站上的许多相关答案,我发现添加行
(set-face-attribute 'default (selected-frame) :height 60)
我的 .emacs
文件导致初始 Emacs 框架中的字体大小为 6 pts,这很棒。当我尝试使用 C-x 5 2
打开一个新框架时出现问题。新框架打开时的字体大小为 11。可以通过 Options
-> 设置默认字体并从 11 减少到 6 来更改。但是,如果新框架以正确的字体大小打开( 6).
有什么建议吗?
在我的 init 中,我将以下内容连接到 after-make-frame-functions
中,我在其中设置字体(肯定是从网上某处获取的),
(defun my-frame-init ()
;; eg.
(set-face-attribute 'mode-line nil
:font "NanumGothicCoding-14"
:weight 'normal))
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(select-frame frame)
(my-frame-init)))
(my-frame-init))
面
default
可以用set-face-attribute
,但用nil
或t
,不能用(selected-frame)
作为值参数FRAME
:(set-face-attribute 'default nil :height 60)
C-h f set-face-attribute
告诉你:
set-face-attribute
is a compiled Lisp function infaces.el
.
(set-face-attribute FACE FRAME &rest ARGS)
Set attributes of
FACE
onFRAME
fromARGS
.This function overrides the face attributes specified by
FACE
’s face spec. It is mostly intended for internal use only.If
FRAME
isnil
, set the attributes for all existing frames, as well as the default for new frames. IfFRAME
ist
, change the default for new frames only....
或者您可以自定义选项
default-frame-alist
,以提供您想要的框架参数值。这会影响所有新框架(至少是普通框架)。M-x customize-option default-frame-alist
.您可以设置框架参数
font
- 例如:"-*-Lucida Console-normal-r-*-*-12-*-*-*-c-*-iso8859-1"