8

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.

6

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

| improve this answer | |
  • 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. – user13413 Oct 3 '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 3 '16 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy