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

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

Re: font for dired mode?


From: Kevin Rodgers
Subject: Re: font for dired mode?
Date: Fri, 22 Apr 2005 10:04:07 -0600
User-agent: Mozilla Thunderbird 0.9 (X11/20041105)

David Reitter wrote:
> I'm trying to set a different font for the dired mode. I would like to
> make everything appear in "fontset-monaco12". I've tried setting the
> faces (like dired-header), but that didn't work at all.
>
> Then I've tried this:
>
> (add-hook 'dired-mode-hook
>           (lambda () (set-frame-font "fontset-monaco12")))
>
> but the result was only that the buffer from which i called dired was
> displayed in monaco, but not the newly opened frame for dired. It's like
> the hook is called from the wrong context, with a different frame being
> the selected frame.

Why is the Dired buffer opened in a new frame?  Is it because you're
using `C-x 5 d', or is some other customization coming into play
(e.g. special-display-buffer-names)?

Your problem is probably that the Dired buffer is created and the mode
hook is run, before the buffer is displayed -- in particular, before the
new frame is created.  I wonder whether this approach will work:

(defvar dired-other-frame-alist nil)

(defadvice dired-other-frame (around frame-alist activate)
  (let ((default-frame-alist (append dired-other-frame-alist
                                     default-frame-alist)))
    ad-do-it))

(setq dired-other-frame-alist
      '((font . "fontset-monaco12")))

Or maybe just:

(add-hook 'after-make-frame-functions
          (lambda (frame)
            ;; do we need to first select the FRAME?
            (when (eq major-mode 'dired)
              (set-frame-font "fontset-monaco12"))))

--
Kevin Rodgers





reply via email to

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