Discussion:
How to change font only in gnus-article buffer ?
Sander Boer
2011-07-22 17:43:58 UTC
Permalink
Hi,

When reading mails/news (and eventually, also when composing a new
message) I want to be using a variable-width font as opposed to a fixed
width font.
Funny thing about the article body displayed by gnus, there is no face
associated with it. This means I can only change the default font (or
toggle variable-pitch-mode, which is lame).
Is it at all possible to change the default font in only one buffer ?

thx
--
Sander Boer
Juanma Barranquero
2011-07-23 12:00:17 UTC
Permalink
Post by Sander Boer
Is it at all possible to change the default font in only one buffer ?
Yes. Remap the face locally with `face-remapping-alist'.

(set (make-local-variable) 'face-remapping-alist '((default variable-pitch)))

    Juanma
Sander Boer
2011-07-24 18:28:09 UTC
Permalink
Post by Juanma Barranquero
Post by Sander Boer
Is it at all possible to change the default font in only one buffer ?
Yes. Remap the face locally with `face-remapping-alist'.
(set (make-local-variable) 'face-remapping-alist '((default variable-pitch)))
    Juanma
Ok, I did just that and it looks ab-so-lute-ly lovely !
(I'm using the misterioso-theme on emacs 24)

One thing kind of bugs me, but I'm pretty sure it is unavoidable, the
rest of the (unpopulated) buffer window still shows the themed
background color. I'm pretty sure it is a result of the face-paradigm,
but I would love to be corrected on this !


+++++++ Begin src
(defun sndr-clear-buffer ()
"changes the buffer into a clear formatted one"
(interactive)
(set (make-local-variable 'face-remapping-alist)
'((default :stipple nil :background "#e1e1e0" :foreground "#000000" :family "Droid Serif" :height 110)
(font-lock-builtin-face :foreground "grey10")
(font-lock-comment-face :foreground "grey10")
(font-lock-constant-face :foreground "grey10")
(font-lock-function-name-face :foreground "grey10" :weight bold)
(font-lock-keyword-face :foreground "grey10" :weight bold)
(font-lock-string-face :foreground "grey10")
(font-lock-type-face :foreground "grey10")
(font-lock-variable-name-face :foreground "grey10")
(font-lock-warning-face :foreground "red3" :weight bold)

(w3m-anchor :background "#e1e1e0" :foreground "grey20")
(w3m-image :background "#e1e1e0" :foreground "grey20")

;; Buttons and links
(button :underline t)
(link :foreground "black" :underline t)
(link-visited :foreground "grey20" :underline t)
;; Gnus faces
(gnus-header-content :family "Droid Sans" :weight normal :foreground "grey20")
(gnus-header-from :family "Droid Sans" :foreground "grey20" :weight bold)
(gnus-header-subject :family "Droid Sans" :foreground "red3" :weight bold)
(gnus-header-name :family "Droid Sans" :foreground "#136")
(gnus-header-newsgroups :family "Droid Sans" :foreground "grey20")
(gnus-cite-1 :foreground "#136")
(gnus-cite-2 :foreground "#361")
(gnus-cite-3 :foreground "#613")
(gnus-cite-4 :foreground "#26b")
(gnus-cite-5 :foreground "#6b2")
(gnus-signature :foreground "#136")
;; Message faces
(message-header-name :foreground "grey20" :weight bold)
(message-header-newsgroups :foreground "grey20")
(message-header-cc :foreground "grey20")
(message-header-other :foreground "grey20")
(message-header-subject :foreground "red3" :weight bold)
(message-header-to :foreground "grey20")
(message-cited-text :foreground "grey10")
(message-separator :foreground "grey30")
(diff-context :foreground "grey30")
(mm-uu-extract :background "#e1e1e0")
)))

(add-hook 'gnus-article-prepare-hook 'sndr-clear-buffer)
(add-hook 'message-mode-hook 'sndr-clear-buffer)

+++++++ End src
--
Sander Boer
Juanma Barranquero
2011-07-24 20:13:20 UTC
Permalink
Post by Sander Boer
One thing kind of bugs me, but I'm pretty sure it is unavoidable, the
rest of the (unpopulated) buffer window still shows the themed
background color. I'm pretty sure it is a result of the face-paradigm,
but I would love to be corrected on this !
Yes, it is unavoidable. So remapping the default face works better if
you don't change the background color.

    Juanma

Loading...