开发者

Change font for the file

开发者 https://www.devze.com 2022-12-28 19:31 出处:网络
I have a line in my .emacs which set a default font: (set-default-font \"Monaco-10\") It works fine for me, but I need two exceptions:

I have a line in my .emacs which set a default font:

(set-default-font "Monaco-10")

It works fine for me, but I need two exceptions:

  1. I need to change default font for a one file, for example ~/some. How can I do it?
  2. I need to change default fonr for a gnux (M-x gn开发者_开发知识库us). How can I achieve it?


Take a look at the variable `face-remapping-alist'. For example, you can have something like this:

(add-hook 'find-file-hook
          (lambda ()
            (if (equal "~/some" (abbreviate-file-name (buffer-file-name)))
              (set (make-local-variable 'face-remapping-alist)
                   '((default :family "DejaVu Serif"))))))


In Emacs files are represented in buffers - you don't change the font of the file, but that of the buffer. Shift-LeftClick in a buffer and you'll get a font dialog. In it you should select:

Change Buffer Font...

You might take a look at the code this command is bound to and use it for your needs.

0

精彩评论

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