I'm using face-remap-add-relative in a tiny minor mode which, when activated, increases the size of the org-level-1 face. This function is perfect for that because when evaluated it returns a cookie that can be kept for later restoring the original size of the modified face. Here's the code:

(defvar bigger-org-headlines-cookie nil)

(make-variable-buffer-local 'bigger-org-headlines-cookie)

(define-minor-mode bigger-org-headlines
  "Increases the size of level 1 Org headlines."
  :lighter " Big-Org-Headlines"
  (if bigger-org-headlines
      (setq bigger-org-headlines-cookie
            (face-remap-add-relative 'org-level-1
                                     (expt text-scale-mode-step 1)))
    (face-remap-remove-relative bigger-org-headlines-cookie))
  (force-window-update (current-buffer)))

Now I changed my mind and want to increase the size of every headline in an Org file. In total there are 8 levels that need to be changed.

Is there an easier way besides changing face-remapping-alist manually (which BTW is not recommended)?

Suggestions are very welcome.

1 Answer 1


This seems like a straightforward application for map. Try this:

(defvar bigger-org-headlines-cookies nil) 

(make-variable-buffer-local 'bigger-org-headlines-cookies)

(define-minor-mode bigger-org-headlines
  "Make Org headlines bigger."
  :lighter " Big-Org-Headlines"
  (if bigger-org-headlines 
      (mapc (lambda (face)
              (push (face-remap-add-relative face :height text-scale-mode-step)
            (cons 'org-link org-level-faces))
    (mapc #'face-remap-remove-relative bigger-org-headlines-cookies)
    (setq bigger-org-headlines-cookies nil))
  (force-window-update (current-buffer)))

Note that your code errored for me until I added the docstring.

I also removed your expt call since it wasn't doing anything. Feel free to reinstate it if it was just standing in for a calculation as-yet unimplemented.

In testing, I found that links weren't being affected, so I went ahead and added the org-link face, too.

  • Yes, that's it; making the cookie variable a list of cookies did the trick. Didn't knew about org-level-faces, thanks! However there are some misplaced parens in your code. Also, mapcar could be replaced with mapc since only the side-effects are important here. The call to apply-partially also seems unnecessary. Do you mind to edit it before accepting your answer?
    – undostres
    Nov 22, 2015 at 15:49
  • Not at all. Done. Thanks in particular for pointing out mapc; I hadn't previously been aware of it. Also, I did some testing and noticed that links weren't being affected, so I tacked on the org-link face. Nov 22, 2015 at 17:22

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.