;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 ;; David J. Biesack ;; This file is not part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; Some functions for setting/resizing frames. ;; Author: David Biesack (David.Biesack@sas.com or biesack@mindspring.com) ;; Last Modified By: biesack@mindspring.com ;; Last Modified: Thu Mar 15 17:50:07 2001 (defvar *emacs19-left-border* 10) (defvar *emacs19-top-border* 0) (defun home () (interactive) (set-frame-position (selected-frame) *emacs19-left-border* *emacs19-top-border*) ) (defvar narrow-width 95) ;; 90 (defvar wide-width 180) (defvar short-height 24) (defvar tall-height 60) (defvar medium-height (/ (+ short-height tall-height) 2)) (defun tall (&optional height) "Grow the Emacs window" (interactive "p") (set-frame-size (selected-frame) (frame-width) (if (and (numberp height) (> height 1)) taheight tall-height)) (sit-for 0) (home) ) (defun medium () "Change the Emacs window height to medium-height" (interactive) (set-frame-size (selected-frame) (frame-width) medium-height ) (sit-for 0) (home) ) (defun set-height (height) (interactive "nHeight: ") (let ((frame (selected-frame))) (set-frame-size frame (frame-width) height) (select-frame frame))) (defun set-width (width) (interactive "nWidth: ") (let ((frame (selected-frame))) (set-frame-size frame width (frame-height)) (select-frame frame))) (defun sss (width height) "Set the Screen Size to WIDTH by HEIGHT. If either is not an integer or an unreasonable number, don't change that value." (interactive "nWidth: \nnHeight: ") (let ((frame (selected-frame))) (or (and (integerp width) (< 8 width) (< width 300)) (setq width (frame-width))) (or (and (integerp height) (> 300 height) (> height 4)) (setq height (frame-height))) (set-frame-size frame width height) (select-frame frame))) (defun wide (width) "Widen the Emacs window" (interactive "p") (set-frame-size (selected-frame) (if (> width 1) width wide-width) (frame-height)) (set-mouse-position-to-point) ) (defmacro Emacs19-new-width-key (width) "Macro to bind a C-z key followed by a digit to set the current frame width. C-z0 through C-z5 set frame widths to 100-150 characters. C-z6 through C-z9 set the frame with to 60-90 characters." (let ((key (concat "\C-z" (int-to-string width))) (width (+ (* 10 width) (if (< width 6) 100 0)))) (list 'define-key 'global-map key (list 'function (list 'lambda nil '(interactive) (list 'let '((frame (selected-frame))) (list 'set-frame-size 'frame width '(frame-height)) '(set-mouse-position-to-point))))))) (global-unset-key "\C-z") ;; (macroexpand '(Emacs19-new-width-key 5)) (Emacs19-new-width-key 5) (Emacs19-new-width-key 6) (Emacs19-new-width-key 7) (Emacs19-new-width-key 8) (Emacs19-new-width-key 9) (Emacs19-new-width-key 7) (Emacs19-new-width-key 10) (Emacs19-new-width-key 11) (Emacs19-new-width-key 12) (Emacs19-new-width-key 13) (Emacs19-new-width-key 14) (Emacs19-new-width-key 15) (Emacs19-new-width-key 16) (Emacs19-new-width-key 17) (Emacs19-new-width-key 18) (Emacs19-new-width-key 19) ;(macroexpand '(Emacs19-new-width-key 9)) (defun huge () "Grow the Emacs window to full screen" (interactive) (set-frame-size (selected-frame) wide-width tall-height) (set-mouse-position-to-point)) (defun small () (interactive) (set-frame-size (selected-frame) narrow-width short-height) (set-mouse-position-to-point)) (fset 'large 'huge) (defun narrow (width) "Grow the Emacs window to narrow-width characters wide" (interactive "p") (set-frame-size (selected-frame) (if (> width 1) width narrow-width) (frame-height)) (set-frame-size (selected-frame) narrow-width (frame-height)) (set-mouse-position-to-point) ) (defun short (height) "Shrink the Emacs window" (interactive "p") (set-frame-size (selected-frame) (frame-width) (if (> height 1) height short-height)) (sit-for 0) (set-mouse-position-to-point) ) (provide 'resizing)