Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs buffer-local font

Tags:

emacs

fonts

For all my tasks I use URW Chancery L font in Emacs. But for some tasks, like org-mode tables, shell or sunrise-commander, I would like to set mono-width font. So, my question, how can I do it? All I found about it is set-default-font, which is not what I want.

like image 461
KAction Avatar asked Sep 05 '12 14:09

KAction


People also ask

How do I change the font in buffer?

Select Appearance on the left sidebar. Under Change font size, use the dropdown menu next to Font size to select the font size you want.

How do I change the default font in Emacs?

Click on ' Set Default Font ' in the ' Options ' menu. This makes the selected font the default on all existing graphical frames. To save this for future sessions, click on ' Save Options ' in the ' Options ' menu.

How do I change a buffer from read only in Emacs?

The user who wants to change the buffer text despite this can do so after clearing the read-only flag with C-x C-q .

What is Emacs font lock?

Font Lock mode is a buffer-local minor mode that automatically attaches face properties to certain parts of the buffer based on their syntactic role. How it parses the buffer depends on the major mode; most major modes define syntactic criteria for which faces to use in which contexts.


1 Answers

Faces (i.e. the objects used to specify appearence of text such as font, color, ...) are mostly global in Emacs, although they can also be set on a frame basis, so you can do the above by creating a separate frame and change the `default' face to use in that frame. This said, Emacs can also now also change face's appearence for specific buffers via face-remapping. E.g.

(face-remap-add-relative 'default '(:family "Monospace"))

should make the current buffer use Monospace. So adding the above to org-mode-hook might just solve your problem.

like image 185
Stefan Avatar answered Sep 20 '22 07:09

Stefan