help-gnu-emacs
[Top][All Lists]
Advanced

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

mode-specific font specifications?


From: Jim McCloskey
Subject: mode-specific font specifications?
Date: Mon, 24 Aug 2009 02:12:38 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

Just getting used to Emacs 23.1, and especially enjoying the improved
font-rendering. Thanks to all who made this possible. It's really great.

There's one thing that I haven't figured out yet, though, so I thought
I might ask for help here. I suspect that I am not alone in wanting to
be able to do this.

I'd like to be able to set a default font for text and latex mode (for
prose composition essentially) and to have a nice proportional font
for that context (Linux Libertine or something). But such a font makes
little or no sense for dired-mode, for example, where you really want
a monospace font like Inconsolata (so that the alignment looks right).

I thought I could do what I wanted by setting a default font in the
init file with (set-default-font "FONTNAME") and then:

    (add-hook 'dired-mode-hook
      (function
         (lambda ()
                  (font-lock-mode 1)
                  (require 'dired-x)
                  (set-frame-font "Inconsolata-11")
                                  )))

or:

    (add-hook 'dired-mode-hook
      (function
         (lambda ()
                  (font-lock-mode 1)
                  (require 'dired-x)
                  (set-default-font "Inconsolata-11")
                                  )))

and that sort of works, in the sense that the first buffer visited is
displayed in the proportional font FONTNAME, and then when you switch
to dired-mode, you get 11pt Inconsolata. However, when you then go
from dired-mode back to the first buffer (in latex-mode, say), the
font used is now Inconsolata. I had hoped to limit the scope of that
second font declaration by putting it inside:

   (add-hook 'dired-mode-hook
                    .... )

but, once called, its effects in fact seem to be global rather than
local to that mode.

Is there a way for me to do what I'd like to be able to do?

Thanks very much for any advice or any pointers to relevant documentation.

Jim




reply via email to

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