开发者

Where do I input a piece of code in Emacs?

I have just started using Emacs for the specific purpo开发者_如何学编程se 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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜