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



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to