├── README.creole └── framesize.el /README.creole: -------------------------------------------------------------------------------- 1 | = Framesize - adjusting framesize = 2 | 3 | This let's you change the font size of a frame. Any buffer displayed 4 | in the frame will have the same font size. 5 | 6 | This is useful for presenting where the thing you here the most when 7 | live coding is //"can you make it bigger?"// 8 | 9 | {{{frame-font-keychord-init}}} can be used to initialize this to 10 | automatically bind this to keychords, something like: 11 | 12 | {{{ 13 | (add-hook 'after-init-hook 'frame-font-keychord-init) 14 | }}} 15 | 16 | This binds the following keychords: 17 | 18 | | {{{fv}}} | make the frame bigger | 19 | | {{{fc}}} | make the frame smaller | 20 | 21 | -------------------------------------------------------------------------------- /framesize.el: -------------------------------------------------------------------------------- 1 | ;;; framesize.el --- change the size of frames in Emacs 2 | 3 | ;; Copyright (C) 2013 Nic Ferrier 4 | 5 | ;; Author: Nic Ferrier 6 | ;; Keywords: frames 7 | ;; URL: http://github.com/nicferrier/emacs-framesize 8 | ;; Package-Requires: ((key-chord "0.5.20080915")) 9 | ;; Version: 0.0.5 10 | ;; Created: 18th February 2013 11 | 12 | ;; This program is free software; you can redistribute it and/or modify 13 | ;; it under the terms of the GNU General Public License as published by 14 | ;; the Free Software Foundation, either version 3 of the License, or 15 | ;; (at your option) any later version. 16 | 17 | ;; This program is distributed in the hope that it will be useful, 18 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | ;; GNU General Public License for more details. 21 | 22 | ;; You should have received a copy of the GNU General Public License 23 | ;; along with this program. If not, see . 24 | 25 | ;;; Commentary: 26 | 27 | ;; Simple functions for changing font-size on a whole frame in Emacs. 28 | 29 | ;;; Code: 30 | 31 | (defgroup frame-font nil 32 | "Frame font let's you quickly scale the font of a frame." 33 | :group 'faces) 34 | 35 | (defcustom frame-font-increment 25 36 | "The amount to scale or reduce the font size by." 37 | :type 'integer 38 | :group 'frame-font) 39 | 40 | ;;;; TODO 41 | 42 | ;; add custom to turn on scaling split-width-threshold by font-size 43 | 44 | ;;;###autoload 45 | (defun frame-font-bigger () 46 | (interactive) 47 | (let* ((inc frame-font-increment) 48 | (sz (face-attribute 'default :height (selected-frame))) 49 | (ceil (+ (* inc (ceiling sz inc)) inc))) 50 | (progn 51 | (set-face-attribute 'default (selected-frame) :height ceil) 52 | (setq split-width-threshold sz)))) 53 | 54 | ;;;###autoload 55 | (defun frame-font-smaller () 56 | (interactive) 57 | (let* ((inc frame-font-increment) 58 | (sz (face-attribute 'default :height (selected-frame))) 59 | (ceil (- (* inc (ceiling sz inc)) (* 2 inc)))) 60 | (condition-case err 61 | (progn 62 | (set-face-attribute 'default (selected-frame) :height ceil) 63 | ;; adjust the split width threshold auotmatically 64 | (setq split-width-threshold sz)) 65 | (error (message "can't change frame font size"))))) 66 | 67 | ;;;###autoload 68 | (defun frame-font-keychord-init () 69 | (key-chord-mode t) 70 | (key-chord-define-global "fv" 'frame-font-bigger) 71 | (key-chord-define-global "fc" 'frame-font-smaller)) 72 | 73 | (provide 'framesize) 74 | 75 | ;;; framesize.el ends here 76 | --------------------------------------------------------------------------------