11

I am using org-mode on Macintosh GNU Emacs version 24.5.1 in GUI mode and the headers are enlarged. I would like to disable this feature so they rendered in the default font size.

I have tried this...

(with-eval-after-load "monokai-theme"
  (custom-theme-set-faces
    'monokai
    '(org-level-1 ((t (:weight semi-bold :height 1.0))))
    '(org-level-2 ((t (:weight semi-bold :height 1.0))))
    '(org-level-3 ((t (:weight semi-bold :height 1.0))))
    '(org-level-4 ((t (:weight semi-bold :height 1.0))))))

Though this clobbers the theme and the colors are no loner rendered.

Should I accomplish it a different way?

3
  • Try experimenting with different themes. Commented May 27, 2016 at 17:14
  • Very closely related: emacs.stackexchange.com/q/19286/115 Just find the face you need to tweak and tweak it. Commented May 27, 2016 at 17:15
  • @KaushalModi I dug a little deeper and found you are right. The theme I am using, monokai-emacs, sets the face attribute :height of the org-levels to a larger size. Manually reseting them is the only way I have found.
    – lookyhooky
    Commented Jun 1, 2016 at 0:05

4 Answers 4

8

Org headings are controlled by the faces org-level-1, org-level-2 etc. You can get to them via M-x customize-face. Unselecting the height attribute should set them to the default font size.

3
  • Placing the point over the text for which you want to know the applied face(s) and then doing C-u C-x = would help. Commented May 27, 2016 at 17:17
  • 1
    @KaushalModi yes, or more directly, M-x describe-face, which provides a link to the customize page.
    – Tyler
    Commented May 27, 2016 at 17:29
  • Tyler and @KaushalModi both of those commands helped me see the attributes applied to the font. This was my first attempt to modify Emacs faces, and those commands will be vital if I do any more work with it.
    – lookyhooky
    Commented May 27, 2016 at 18:29
15

Okay I found a solution that worked for me.

(defun my/org-mode-hook ()
  "Stop the org-level headers from increasing in height relative to the other text."
  (dolist (face '(org-level-1
                  org-level-2
                  org-level-3
                  org-level-4
                  org-level-5))
  (set-face-attribute face nil :weight 'semi-bold :height 1.0)))

(add-hook 'org-mode-hook #'my/org-mode-hook)

This preserved the other face-attributes and did not clobber the theme like my original attempt. Also as a bonus it is not dependent on a single theme.

4

If you happen to be using spacemacs, the theming layer supports overriding themes.

  1. Add theming to dotspacemacs-configuration-layers
  2. Add this to dotspacemacs/user-init substituing zenburn for the theme in question:
(setq theming-modifications
      '((zenburn
        (org-level-1 :height 1.0)
        (org-level-2 :height 1.0)
        (org-level-3 :height 1.0)
        (org-level-4 :height 1.0)
        (org-level-5 :height 1.0))))
1
  • clean and working solution
    – Nisba
    Commented Nov 8, 2018 at 23:58
2

Add this to the end of your config file.

(custom-set-faces
  '(hl-line ((t (:background "#476047604760" :height 1.0))))
  '(org-level-1 ((t (:inherit header-line :height 1.0))))
  '(org-level-2 ((t (:inherit header-line :height 1.0))))
  '(org-level-3 ((t (:inherit header-line :height 1.0)))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.