Changing a custom set face to display with those settings in certian emacs mode (text-mode, LaTeX-mode, etc..)

StackOverflow https://stackoverflow.com/questions/8024075

Question

I had a custom-set-faces that I had used in an emacs startup file that was especially for when I launched latex files but I'm in the process of merging and updating my .emacs file so I don't launch a seperate start-up process for the latex file. I want to set it so this custom face is set only when latex mode is on. Since it is a custom face I don't think it is wise to set a LaTeX-mode-hook but I know there should be a way to do this. I only change the font and the text size basically for when I'm typing. I would also like this enabled for text-mode if possible. Attache the custom face below.

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 98 :width normal :foundry "unknown" :family "DejaVu Sans")))))
Était-ce utile?

La solution

Instead of custom-set-faces you can set it with set-face-attribute, but it will still change the face "in all buffers".

(set-face-attribute 'default nil
 :inherit nil
 :stipple nil
 :background "white"
 :foreground "black"
 :inverse-video nil
 :box nil
 :strike-through nil
 :overline nil
 :underline nil
 :slant 'normal
 :weight 'normal
 :height 98
 :width 'normal
 :foundry "unknown"
 :family "DejaVu Sans")

You should identify the right faces and only set them, don't set default. To identify which face is at point use this

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top