2010-09-21 47 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