`variable-pitch` for org-mode, fixed-pitch for tables?

后端 未结 2 483
南方客
南方客 2020-12-14 08:55

I found out about variable-pitch-mode through a thread here on StackOverflow, and it\'s very handy when writing in org-mode, easier on the eyes and

相关标签:
2条回答
  • 2020-12-14 09:17

    This code will make tables and ascii art and source code blocks to be displayed in monospace font, while preserving other font attributes for tables (such as color blue) and so on. Code is based on the other answer, the only difference is preservation.

    (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)))
    

    If you'd like to learn how this works and how to apply this to other situations (such as Info mode), read my post on the subject

    0 讨论(0)
  • 2020-12-14 09:21

    See if this works,

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

    You may use C-u C-x = to see which face is in effect at a particular point.

    0 讨论(0)
提交回复
热议问题