From: tfheen Date: Sat, 28 Jun 2008 19:14:18 +0000 (+0000) Subject: Add zoom function for emacs >= 23 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=257b13d3da2065e2488a6717ce681519826765a3;p=dotfiles Add zoom function for emacs >= 23 git-svn-id: file:///svn/tfheen/trunk/dotfiles@1273 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf --- diff --git a/emacs b/emacs index 7e2a03a..ddccdec 100644 --- a/emacs +++ b/emacs @@ -356,30 +356,33 @@ message-directory (concat gnus-home-directory "/Mail"))) -(cw/for-host "luxevop" - ;; Firefox-like zooming of fonts. - (setq tfheen-base-font "Bitstream Vera Sans Mono" - tfheen-base-size 12 - tfheen-current-size tfheen-base-size) - - (defun font-zoom-increase-font-size () - (interactive) - (setq tfheen-current-size (+ tfheen-current-size 2)) - (let ((font-name (format "%s-%d" tfheen-base-font tfheen-current-size))) - (set-frame-font font-name))) - - (defun font-zoom-decrease-font-size () - (interactive) - (setq tfheen-current-size (- tfheen-current-size 2)) - (let ((font-name (format "%s-%d" tfheen-base-font tfheen-current-size))) - (set-frame-font font-name))) - - (defun font-zoom-reset-font-size () - (interactive) - (let ((font-name (format "%s-%d" tfheen-base-font tfheen-base-size))) - (set-frame-font font-name))) - - (define-key global-map (read-kbd-macro "C--") 'font-zoom-decrease-font-size) - (define-key global-map (read-kbd-macro "C-+") 'font-zoom-increase-font-size) - (define-key global-map (read-kbd-macro "C-=") 'font-zoom-reset-font-size) - (font-zoom-reset-font-size)) +(cw/for-emacs-23-and-later + (setq tfheen-base-size 8) + (cw/for-host "luxevop" + (setq tfheen-base-size 12)) + + (setq tfheen-base-font "Bitstream Vera Sans Mono" + tfheen-current-size tfheen-base-size) + ;; Firefox-like zooming of fonts. + + (defun font-zoom-increase-font-size () + (interactive) + (setq tfheen-current-size (+ tfheen-current-size 2)) + (let ((font-name (format "%s-%d" tfheen-base-font tfheen-current-size))) + (set-frame-font font-name))) + + (defun font-zoom-decrease-font-size () + (interactive) + (setq tfheen-current-size (- tfheen-current-size 2)) + (let ((font-name (format "%s-%d" tfheen-base-font tfheen-current-size))) + (set-frame-font font-name))) + + (defun font-zoom-reset-font-size () + (interactive) + (let ((font-name (format "%s-%d" tfheen-base-font tfheen-base-size))) + (set-frame-font font-name))) + + (define-key global-map (read-kbd-macro "C--") 'font-zoom-decrease-font-size) + (define-key global-map (read-kbd-macro "C-+") 'font-zoom-increase-font-size) + (define-key global-map (read-kbd-macro "C-=") 'font-zoom-reset-font-size) + (font-zoom-reset-font-size)) diff --git a/emacs-standard b/emacs-standard index cccb704..012cccb 100644 --- a/emacs-standard +++ b/emacs-standard @@ -27,6 +27,16 @@ (not (string-match "Lucid" emacs-version))) ,@body)) +(defmacro cw/for-emacs-23 (&rest body) + `(when (and (= emacs-major-version 23) + (not (string-match "Lucid" emacs-version))) + ,@body)) + +(defmacro cw/for-emacs-23-and-later (&rest body) + `(when (and (>= emacs-major-version 23) + (not (string-match "Lucid" emacs-version))) + ,@body)) + (defmacro cw/for-emacs (&rest body) `(when (not (string-match "Lucid" emacs-version)) ,@body))