我在StackOverflow的一个帖子中发现了variable-pitch-mode
,在使用org-mode
时非常方便,更加舒适和易读。但是当使用比例字体时,在org-mode
中使用表格几乎没有意义。而使用表格是org-mode
的优势之一:-(
有没有办法在org-mode
中对文本、标题等使用比例字体,而对表格使用等宽字体?
我在StackOverflow的一个帖子中发现了variable-pitch-mode
,在使用org-mode
时非常方便,更加舒适和易读。但是当使用比例字体时,在org-mode
中使用表格几乎没有意义。而使用表格是org-mode
的优势之一:-(
有没有办法在org-mode
中对文本、标题等使用比例字体,而对表格使用等宽字体?
请尝试使用以下代码:
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
您可以使用C-u C-x =查看在特定位置生效的样式。
这段代码将使表格、ASCII艺术和源代码块以等宽字体显示,同时保留表格的其他字体属性(如蓝色)等。代码基于另一个答案,唯一的区别是保留。
(defun my-adjoin-to-list-or-symbol (element list-or-symbol)
(let ((list (if (not (listp list-or-symbol))
(list list-or-symbol)
list-or-symbol)))
(require 'cl-lib)
(cl-adjoin element list)))
(eval-after-load "org"
'(mapc
(lambda (face)
(set-face-attribute
face nil
:inherit
(my-adjoin-to-list-or-symbol
'fixed-pitch
(face-attribute face :inherit))))
(list 'org-code 'org-block 'org-table 'org-block-background)))
如果你想学习这个是如何工作的,并且如何应用到其他情况(例如信息模式),请阅读我的这篇文章
buffer-local-theme
包引起了这个 bug。 - xji
describe-face
告诉我字体应该从“fixed-pitch”(或在我的情况下仅为“default”)继承,但显示的字体仍然是“variable-pitch”... - xjibuffer-local-theme
包引起了这个 bug。 - xji