all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jim McCloskey <mcclosk@ucsc.edu>
To: help-gnu-emacs@gnu.org
Subject: mode-specific font specifications?
Date: Mon, 24 Aug 2009 02:12:38 -0700	[thread overview]
Message-ID: <20090824091238.GB6563@ohlone> (raw)


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	other threads:[~2009-08-24  9:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-24  9:12 Jim McCloskey [this message]
     [not found] <mailman.5251.1251123404.2239.help-gnu-emacs@gnu.org>
2009-08-24 16:14 ` mode-specific font specifications? A.Politz
2009-09-01 17:50 ` Xah Lee
2009-09-01 21:28 ` Oliver Scholz
2009-09-01 21:38   ` Oliver Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090824091238.GB6563@ohlone \
    --to=mcclosk@ucsc.edu \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.