9

Is there a way to change the font associated with the variable-pitch-mode? On my emacs installation enabling variable-pitch-mode changes the font to a sans-serif font; I would like to use a serif font instead.

Drew
  • 75,699
  • 9
  • 109
  • 225

1 Answers1

7

It seems that function variable-pitch-mode hard-codes the use of face variable-pitch. I think your two choices (other than perhaps advising that function) are these:

  1. Use face variable-pitch. Just customize it to be have any appearance you want: M-x customize-face variable-pitch.

  2. Write your own command, similar to variable-pitch-mode. That definition is very short. You need only substitute your own face for face variable-pitch in that definition. (You could also define your command using buffer-face-mode-invoke, which is what variable-pitch-mode uses.)

    For example:

    (defun my-variable-pitch-mode (&optional arg face)
      "MY Variable-pitch default-face mode.
    An interface to `buffer-face-mode' which uses FACE
    \(`variable-pitch', by default).
    Besides the choice of FACE, it is the same as `buffer-face-mode'."
      (interactive (list (or current-prefix-arg 'toggle)))
      (buffer-face-mode-invoke face arg (called-interactively-p 'interactive)))

In fact, I'll (or you can) suggest that as the definition of variable-pitch-mode, using M-x report-emacs-bug. (I've done that now - bug #24594.)

Drew
  • 75,699
  • 9
  • 109
  • 225
  • Wonderful. I didn't know how `variable-pitch-mode` worked; thank you for explaining it to me. I personally am fine with customizing the `variable-pitch` face, but I agree that it makes sense to have the option to change the face associated with `variable-pitch-mode`, so I hope that functionality gets added eventually. –  Oct 03 '16 at 15:14
  • Doesn't look like it will. But if customizing the face is all you need here, then that's good. – Drew Oct 03 '16 at 15:16