unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Subject: Nice hack if you're using my face-remapping-alist patch
Date: Sun, 23 May 2004 06:59:50 +0900	[thread overview]
Message-ID: <87brkgf7hl.fsf@tc-1-100.kawasaki.gol.ne.jp> (raw)

;; I find displaying mail/gnus in a variable-pitch font is especially nice,
;; if it's easy to toggle on/off, and you have a nice variable-pitch font
;; (I didn't, until I started using this; the variable-pitch font-family
;; I'm using, btw, is "charter" (which I think is a standard X font(?)),
;; with a :height scale of 1.1).

;;; This allows variable-width text to be turned on or off conveniently
;;; in a buffer:

(define-minor-mode variable-pitch-mode
  "Variable-pitch default-face mode."
  :lighter " VarPitch"
  (when (boundp 'face-remapping-alist)
    (let ((default-remapping (assq 'default face-remapping-alist))
	  (remappings face-remapping-alist))
      (cond ((and default-remapping (not variable-pitch-mode))
	     (setq remappings (remq default-remapping remappings)))
	    ((and variable-pitch-mode (null default-remapping))
	     (setq remappings (cons '(default variable-pitch) remappings))))
      (unless (eq remappings face-remapping-alist)
	(set (make-local-variable 'face-remapping-alist) remappings)
	(force-window-update (current-buffer))))))

(defun turn-on-variable-pitch-mode ()
  "Turn on `variable-pitch-mode'."
  (interactive)
  (variable-pitch-mode t))

(global-set-key "\C-cv" 'variable-pitch-mode)

;;; Turn it on by default in some modes:

;; mail sending:
(add-hook 'message-mode-hook 'turn-on-variable-pitch-mode)
(add-hook 'mail-mode-hook 'turn-on-variable-pitch-mode)

;; mail/news reading:
(add-hook 'gnus-article-mode-hook 'turn-on-variable-pitch-mode)

(defun gnus-summary-toggle-variable-pitch-mode ()
  (interactive)
  (with-current-buffer gnus-article-buffer
    (variable-pitch-mode 'toggle)))

;; Bind "F" to toggle variable-pitch-mode in the article buffer
;; (warning, "F" already has a standard binding, so change at will)
(add-hook 'gnus-summary-mode-hook
          (lambda ()
            (local-set-key "F" 'gnus-summary-toggle-variable-pitch-mode)))

;; -Miles
-- 
97% of everything is grunge

                 reply	other threads:[~2004-05-22 21:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87brkgf7hl.fsf@tc-1-100.kawasaki.gol.ne.jp \
    --to=miles@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).