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

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

window+.el - extensions to GNU `window.el'


From: Drew Adams
Subject: window+.el - extensions to GNU `window.el'
Date: Tue, 16 Jan 2001 21:35:20 -0500

;;; window+.el --- Extensions to `window.el'.
;; 
;; Filename: window+.el
;; Description: Extensions to `window.el'.
;; Author: Drew Adams
;; Maintainer: Drew Adams
;; Copyright (C) 1996-2001, Drew Adams, all rights reserved.
;; Created: Thu Jan 25 14:22:13 1996
;; Version: $Id: window+.el,v 1.4 2001/01/09 22:41:17 dadams Exp $
;; Last-Updated: Tue Jan  9 14:41:15 2001
;;           By: dadams
;;     Update #: 65
;; Keywords: internal, local, windows
;; Compatibility: GNU Emacs 20.x
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Commentary: 
;; 
;;    Extensions to `window.el'.
;;
;;
;;  ***** NOTE: The following function defined in `window.el' has been
;;              REDEFINED HERE:
;;
;;  `count-windows' -
;;     Only use arg MINIBUF if current frame has a minibuffer.
;;
;;
;;  This file should be loaded after loading the standard GNU file
;;  `window.el'.  So, in your `~/.emacs' file, do this:
;;  (eval-after-load "window" '(require 'window+))
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Change log:
;; 
;; RCS $Log: window+.el,v $
;; RCS Revision 1.4  2001/01/09 22:41:17  dadams
;; RCS Adapted file header for Emacs Lisp Archive.
;; RCS
;; RCS Revision 1.3  2001/01/03 23:22:31  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.2  2001/01/03 17:49:05  dadams
;; RCS *** empty log message ***
;; RCS
;; RCS Revision 1.1  2000/09/14 17:24:48  dadams
;; RCS Initial revision
;; RCS
; Revision 1.2  1999/03/17  16:48:29  dadams
; (trivial)
;
; Revision 1.1  1997/03/20  10:46:56  dadams
; Initial revision
;
; Revision 1.6  1996/07/01  13:28:24  dadams
; (trivial)
;
; Revision 1.5  1996/04/05  14:39:30  dadams
; Improved Commentary:  List redefinitions.
;
; Revision 1.4  1996/03/08  14:41:36  dadams
; Copyright.
;
; Revision 1.3  1996/02/12  10:11:09  dadams
; Updated header keywords (for finder).
;
; Revision 1.2  1996/01/25  16:42:22  dadams
; count-windows: Returned to original meaning of arg (so corrected doc string),
;                except only use the arg if the frame has a minibuffer.
;
; Revision 1.1  1996/01/25  13:28:28  dadams
; Initial revision
;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;; 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, or (at your option)
;; 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; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;; Code: 

 ;; Cannot do (require 'window), because `window.el' does no `provide'.
 ;; Don't want to do a (load-library "window") either, because it wouldn't
 ;; allow doing (eval-after-load "window" '(progn (require 'window+)))

(provide 'window+)

;;;;;;;;;;;;;;;;;;;;;;;;;;


;; REPLACES ORIGINAL in `window.el':
;; 1. Only use arg MINIBUF if current frame has a minibuffer. 
;; 2. Corrected doc string:
;;    Original doc string indicated opposite behavior for arg MINIBUF.
(defun count-windows (&optional minibuf)
  "Returns the number of visible windows in selected frame.
Optional arg MINIBUF is only used if selected frame has a minibuffer.

MINIBUF = t means count the minibuffer window even if *not* active.
MINIBUF = nil or omitted means count the minibuffer iff it is active.
If MINIBUF is neither t nor nil it means not to count the minibuffer
even if it is active.  (See function `walk-windows'.)"
  (let ((count 0))
    (walk-windows (function (lambda (w) (setq count (+ count 1))))
                  (and (memq (cdr (assoc 'minibuffer (frame-parameters)))
                             '(only t)) ; If this frame has a minibuffer,
                       minibuf))        ; pass the arg.  (Else pass nil.)
    count))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; `window+.el' ends here



reply via email to

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