Is there a way to prevent fonts from being blocked from changing the font family (and just changing the color)?

Admittedly, this is something like the first world problem, but I'm a little picky about the appearance of the display, and I find it very annoying when in some mode a new font size, family, bold / italics, etc. are set. What I would like to do is put (set-frame-font "Menlo-10") next to my .emacs, and then make emacs never change any aspect of this default font, except for color.

I can get the effect I want by doing something like this:

 (mapc (lambda (face) (set-face-attribute face nil :family "Menlo" ;; something like (cdr (assoc 'font (frame-parameters)) would be better ;; for the :family, but it didn't immediately work :width 'normal :height 1.0 :weight 'normal :underline nil :slant 'normal)) (remove 'default (face-list))) 

but this only works after I have downloaded a new buffer that created a font-lock for the faces to be changed, and this is a terrible hack. I suspect that there really is no way to block fonts to ignore some parts of what the mode is asking for, but I thought I'd ask.

In addition, AUCTeX is by far the worst intruder here, so if instead there is an AUCTeX parameter instead to prevent it from asking for changes in the family, size, etc., this will at least make the problem less annoying .

I am currently using the recent Emacs 24 filmed from HEAD.

+6
source share
1 answer

Running customize-face with the cursor on the face you are interested in will allow you to see how this face is defined (and change it). Doing this in the section header gives me font-latex-sectioning-1-face . This inherits from font-latex-sectioning-2-face , etc. To font-latex-sectioning-5-face , which, in turn, inherits the variable-pitch form (which changes the font family). The documentation also mentions that it is best to change the base face of font-latex-sectioning-5-face or the font-latex-fontify-sectioning variable. You can set the last value of 'color , which will do what you want (I think). Alternatively, you can configure font-latex-sectioning-5-face to not inherit from variable-pitch , or change variable-pitch to not be variable.

+4
source

Source: https://habr.com/ru/post/899871/


All Articles