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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.