gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emake-frame.el --- Enhanced make-frame operation for Emacs


From: Kevin A. Burton - burtonator
Subject: emake-frame.el --- Enhanced make-frame operation for Emacs
Date: 15 Dec 2001 13:07:00 -0800
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


OK.  This is version 2.0.  Basically it removes some redundant code and adds
support for customization.

;;; emake-frame.el --- Enhanced make-frame operation for Emacs

;;; $Id: emake-frame.el,v 1.4 2001/01/19 07:58:55 burton Exp $

;; Copyright (C) 1997-2000 Free Software Foundation, Inc.

;; Author: Kevin A. Burton (address@hidden)
;; Maintainer: Kevin A. Burton (address@hidden)
;; Location: http://relativity.yi.org
;; Keywords: frames new customization
;; Version: 2.0

;; This file is [not yet] part of GNU Emacs.

;; This program 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 of the License, or any later version.
;;
;; This program 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
;; this program; if not, write to the Free Software Foundation, Inc., 59 Temple
;; Place - Suite 330, Boston, MA 02111-1307, USA.

;;; Commentary:

;; This is a simple way to easily create new frames under Emacs.  It might not
;; work in your configuration, but I like it.

;; Basically it is setup like the bindings in Mozilla for creating new frames.
;; C-n creates the new frame which is a child of the current frame.  Note that
;; by default Emacs uses 'next-line' on C-n but in modern installations this is
;; redundant because most users use the arrow keys IMO.

;; I usually keep my main emacs window maximized.  If I want to go open another
;; frame but I currently have a sensitive window geometry (say while I am in
;; gnus) I will just create a new smaller frame with emake-frame-command.

;;; Installation

;; put this in your lisp load path and just do a (require 'emake-frame) in your
;; .emacs

;;; TODO:
;;

;;; History
;;

;; Sat Dec 08 2001 12:07 PM (address@hidden): : now using customization
;; for setup.

;; Fri Dec  1 05:40:45 2000 (burton): need to make sure that *scratch* isn't
;; read only.

;; dired required to setup key bindings there.
(require 'dired) 

(defcustom emake-frame-new-frame-width 130
  "Specify the width of the new frame.  See `make-frame' for more information."
  :group 'emake-frame)

(defcustom emake-frame-new-frame-height 75
  "Specify the height of the new frame.  See `make-frame' for more information."
  :group 'emake-frame)

(defcustom emake-frame-new-frame-left 50
  "Specify the left offset of the new frame.  See `make-frame' for more
information."
  :group 'emake-frame)

(defcustom emake-frame-new-frame-top 50
  "Specify the top offset of the new frame.  See `make-frame' for more
information."
  :group 'emake-frame)

(defcustom emake-frame-default-buffer "*scratch*"
  "The buffer to open when emake-frame-command is run."
  :group 'emake-frame)

(defun emake-frame()
  "Make a child frame to the current frame with the correct buffer.  When
complete return the frame created."

  (interactive)

  (let(frame)

    (select-frame (make-frame (list (cons 'left emake-frame-new-frame-left)
                                    (cons 'top emake-frame-new-frame-top)
                                    (cons 'width emake-frame-new-frame-width)
                                    (cons 'height 
emake-frame-new-frame-height))))
    ;;(select-frame frame))))

    (view-buffer emake-frame-default-buffer)

    (if (string= emake-frame-default-buffer "*scratch*")
        (toggle-read-only -1))))

;; make a new window just like Mozilla.. this
(global-set-key [?\C-n] 'emake-frame)

;; kill the current frame
(global-set-key [?\C-x?\C-n] 'delete-frame)

;;make sure to setup the same binding in dired....
(define-key dired-mode-map [?\C-n] 'emake-frame)
(define-key dired-mode-map [?\C-x?\C-n] 'delete-frame)

(provide 'emake-frame)

;;; emake-frame.el ends here

- -- 
Kevin A. Burton ( address@hidden, address@hidden, address@hidden )
             Location - San Francisco, CA, Cell - 415.595.9965
        Jabber - address@hidden,  Web - http://relativity.yi.org/

In order to see the fish, you must watch the water.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Get my public key at: http://relativity.yi.org/pgpkey.txt

iD8DBQE8G7t0AwM6xb2dfE0RAvmEAKDEUV36Ejin/LNG8gULPdrTOeRPPACfcpgM
eDN0VxkPNSYqQaS3HJeo/kU=
=dQPI
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]