0

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")))))
Drew
  • 29,895
  • 7
  • 74
  • 104
J Spen
  • 2,614
  • 4
  • 26
  • 41

1 Answers1

9

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

Community
  • 1
  • 1
chrm
  • 1,258
  • 1
  • 11
  • 16
  • chrm - Can this be put in a text-mode-hook to only initiate in text mode buffers or LaTeX-mode-hook even would be fine where it just initiates the face attribute in those buffers. If not I guess I will settle for all buffers. Cheers – J Spen Nov 07 '11 at 14:52
  • I believe faces can't have different values in different buffers. You can set the **default** face in the latex mode hook, but when it gets executed, it will change the appearance of all buffers. – chrm Nov 07 '11 at 15:05
  • chrm - That is the case. I just set a hook. Then wrote two functions so I can change between the default font and a latex/text mode font. – J Spen Nov 07 '11 at 16:16