[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mode-specific font setting?
From: |
David Reitter |
Subject: |
Re: Mode-specific font setting? |
Date: |
Tue, 26 Apr 2005 07:42:41 +0100 |
How do I set a mode-specific font?
To elaborate on this, I want a generic solution that allows me to
assign special fonts to all major modes.
Another thing I have tried is to find the frame for the current buffer
(see code below). This doesn't work either, because although the
current buffer exists, it seems like it doesn't have a window yet (or
walk-windows ignores it.)
What to do?
---
(defun find-all-frames-internal (buffer)
(let ((frames nil))
(walk-windows '(lambda (wind)
(if (eq (window-buffer wind) buffer)
(let ((frm (window-frame wind)))
(unless (memq frm frames)
(push frm frames)))))
nil t)
frames))
(add-hook 'after-change-major-mode-hook
(lambda ()
;; this doesn't work yet
;; somehow, the window doesn't exist at this point :(
;; the current-buffer is correct
(setq fr (car (find-all-frames-internal (current-buffer))))
(if fr
(case major-mode
('text-mode
(select-frame fr)
(set-frame-font "fontset-lucida14")
)))))