2010-09-21 49 views

回答

18

看看这个工程,

(set-face-attribute 'org-table nil :inherit 'fixed-pitch)

您可以使用C-ùC-X =,看看哪些脸实际上是在一个特定的点。

+0

它使用Emacs 24 :) – julien 2010-09-21 15:58:55

+0

真棒工作!就像我想要的那样工作:) – monotux 2010-09-23 07:03:58

+2

你是怎么知道表是'org-table? 我想在SQL缓冲区的输出上使用这个解决方案 – EoghanM 2011-05-27 15:16:42

8

此代码将使表和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))) 

如果您想了解如何工作的,以及如何将其应用到其他情况(如信息模式),阅读my post on the subject

+0

出于某种原因,尽管运行'describe-face'告诉我字体应该从'fixed-pitch(或者仅仅是'我的例子中的默认值')继承,显示的字体仍然是'可变间距... – 2015-05-24 09:18:13

+0

不要紧,是导致错误的'buffer-local-theme'包。 – 2015-05-28 08:29:30