Closed alphatan closed 10 months ago
这是一个自问自答的问题,为在中文环境中遇到同样问题的人提供搜索得到的解决方案。 (This is a self-questioning issue, for the user who met the same problem in chinese environment.)
这可能是一个很小众的问题,因此我也不会提交一个 Pull Request。 (This may be a very niche problem. So, I will not initiate a Pull Request.)
一个更好的解决方案: (A better solution:)
~/.emacs
中为 default
和 fixed-pitch
设置相同的等宽字体 (set the same fixed-width font for default
and fixed-pitch
in ~/.emacs
)
;; default font
(set-face-attribute 'default nil :font (font-spec :family "SimSun" :size 16))
;; fixed-width font
;; Don't set it by (set-face-attribute 'fixed-pitch nil :inherit 'default)
;; or it will break the font inheritance tree
(set-face-attribute 'fixed-pitch nil :font (font-spec :family "SimSun" :size 16))
markdown-mode.el
(Leave the markdown-mode.el
unchanged.)
问题描述 (Description)
“代码”、“缩进”、“预设”部分的字体会引起对齐问题。 (the font in the sections of
code
,quote
,pre
would perform as non-fixed-width)原因 (Cause)
emacs 声明的等宽(fixed-pitch)字体并不是等宽的。 (The font symbol
fixed-pitch
declared as fixed-width is not in practice)而 markdown-mode.el 中的
mardown-code-face
就引用了这个字体。 (And it's referenced bymarkdown-code-face
in markdown-mode.el)解决 (Solution)
注:更换
markdown-code-face
font-lock-constant-face
的位置是为了让default
外的值起作用,否则其为第一个元素时,后面的元素将不起作用。 (Note: exchanging the position ofmarkdown-code-face
andfont-lock-constant-face
is to make the values besidedefault
in effect. Or, asdefault
is the first element, the rest will be discarded)修改后的结果 (Result)