[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mode-specific font setting?

From: Kevin Rodgers
Subject: Re: Mode-specific font setting?
Date: Tue, 26 Apr 2005 13:43:20 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

David Reitter wrote:
> How do I set a mode-specific font?

You can't.  Fonts are frame-specific, not window- or mode-specific.

> I've tried this hack:
>  (add-hook 'after-change-major-mode-hook
>        (lambda ()
>        (case major-mode
>       ('text-mode
>          (set-frame-font "fontset-lucida14")
> )))
> )
> Unfortunately it doesn't work, obviously because the selected frame is a
> different one when the hook is called (find-file-other-frame was used to
> open a file), so the font gets set in the wrong frame.

It also won't change the font when you select a buffer in a different
mode with `C-x b'.

> Maybe there is a more elegant way (customization?) than using a hook,
> anyways.

Use after-make-frame-functions, and make each frame's initial window
dedicated to that buffer for good measure.

Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]