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.
1 Answer
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:
Use face
variable-pitch. Just customize it to be have any appearance you want:M-x customize-face variable-pitch.Write your own command, similar to
variable-pitch-mode. That definition is very short. You need only substitute your own face for facevariable-pitchin that definition. (You could also define your command usingbuffer-face-mode-invoke, which is whatvariable-pitch-modeuses.)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.)
-
Wonderful. I didn't know how
variable-pitch-modeworked; thank you for explaining it to me. I personally am fine with customizing thevariable-pitchface, but I agree that it makes sense to have the option to change the face associated withvariable-pitch-mode, so I hope that functionality gets added eventually.user13413– user134132016-10-03 15:14:22 +00:00Commented Oct 3, 2016 at 15:14 -
Doesn't look like it will. But if customizing the face is all you need here, then that's good.Drew– Drew2016-10-03 15:16:14 +00:00Commented Oct 3, 2016 at 15:16