4
votes

I have just started using Emacs for the specific purpose of editing latex documents. I was attracted to Emacs because I want to be able to customize syntax highlighting even to the point of defining the colors of specific words. I am new to Emacs and not a programmer, so I having an extreme difficulty in doing what I want to do because most help I find assume too much knowledge for my level (it took me days just to be able to install emacs + auctex and change the first face color).

I found something that I think will help me but I don't know how to do it. The post below is what I want to do, but what I am supposed to do with this code? Where should I insert it or where should I type it? I am using GNU Emacs in Windows. Thank you so much for you help :)

M-x what-face

will print the face found at the current point. And the code for that is:

(defun what-face (pos)   
  (interactive "d") 
  (let ((face (or (get-char-property (point) 'read-face-name)  
                  (get-char-property (point) 'face))))  
    (if face (message "Face: %s" face) (message "No face at %d" pos))))

By the way, I found this in another post that can be found here: Get font face under cursor in Emacs

1
You could use M-x describe-face it prompt you for a face, but the default response is the face at point.Rémi
oh, it works!!! Why then did I use all that coding if M-x describe-face works? Thanks so much for that, hey? Sorry I didn't reply before, I thought I would get an email if something came up here.Vivi

1 Answers

6
votes

The simplest option is to put it in ~/.emacs, which is run when emacs starts.