aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Friedman1995-04-08 08:22:07 +0000
committerNoah Friedman1995-04-08 08:22:07 +0000
commit2ca4ad7ef5fe7c3f435e48e8b0de0665be96a22e (patch)
tree2ea4073b7832341e51f4e588fb1b28691926429b
parent919a07bb1d628890cbd729285d9b307bb9fe471f (diff)
downloademacs-2ca4ad7ef5fe7c3f435e48e8b0de0665be96a22e.tar.gz
emacs-2ca4ad7ef5fe7c3f435e48e8b0de0665be96a22e.zip
(resize-minibuffer-window): Make sure minibuffer window is selected.
(resize-minibuffer-window-restore): Likewise.
-rw-r--r--lisp/rsz-mini.el95
1 files changed, 48 insertions, 47 deletions
diff --git a/lisp/rsz-mini.el b/lisp/rsz-mini.el
index 5ea3bc787ef..684a55cf42c 100644
--- a/lisp/rsz-mini.el
+++ b/lisp/rsz-mini.el
@@ -1,13 +1,13 @@
1;;; rsz-mini.el --- dynamically resize minibuffer to display entire contents 1;;; rsz-mini.el --- dynamically resize minibuffer to display entire contents
2 2
3;;; Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1990, 1993, 1994, 1995 Free Software Foundation, Inc.
4 4
5;;; Author: Noah Friedman <friedman@prep.ai.mit.edu> 5;; Author: Noah Friedman <friedman@prep.ai.mit.edu>
6;;; Roland McGrath <roland@prep.ai.mit.edu> 6;; Roland McGrath <roland@prep.ai.mit.edu>
7;;; Maintainer: friedman@prep.ai.mit.edu 7;; Maintainer: friedman@prep.ai.mit.edu
8;;; Keywords: minibuffer, window, frame, display 8;; Keywords: minibuffer, window, frame, display
9;;; Status: Known to work in FSF GNU Emacs 19.26 and later. 9;; Status: Known to work in FSF GNU Emacs 19.26 and later.
10;;; $Id: rsz-mini.el,v 1.6 1994/07/12 19:51:30 rms Exp friedman $ 10;; $Id: rsz-mini.el,v 1.7 1994/07/13 17:19:23 friedman Exp friedman $
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
13 13
@@ -27,36 +27,36 @@
27 27
28;;; Commentary: 28;;; Commentary:
29 29
30;;; This package allows the entire contents (or as much as possible) of the 30;; This package allows the entire contents (or as much as possible) of the
31;;; minibuffer to be visible at once when typing. As the end of a line is 31;; minibuffer to be visible at once when typing. As the end of a line is
32;;; reached, the minibuffer will resize itself. When the user is done 32;; reached, the minibuffer will resize itself. When the user is done
33;;; typing, the minibuffer will return to its original size. 33;; typing, the minibuffer will return to its original size.
34 34
35;;; In window systems where it is possible to have a frame in which the 35;; In window systems where it is possible to have a frame in which the
36;;; minibuffer is the only window, the frame itself can be resized. In FSF 36;; minibuffer is the only window, the frame itself can be resized. In FSF
37;;; GNU Emacs 19.22 and earlier, the frame may not be properly returned to 37;; GNU Emacs 19.22 and earlier, the frame may not be properly returned to
38;;; its original size after it ceases to be active because 38;; its original size after it ceases to be active because
39;;; `minibuffer-exit-hook' didn't exist until version 19.23. 39;; `minibuffer-exit-hook' didn't exist until version 19.23.
40;;; 40;;
41;;; Prior to Emacs 19.26, minibuffer-exit-hook wasn't called after exiting 41;; Prior to Emacs 19.26, minibuffer-exit-hook wasn't called after exiting
42;;; from the minibuffer by hitting the quit char. That meant that the 42;; from the minibuffer by hitting the quit char. That meant that the
43;;; frame size restoration function wasn't being called in that case. In 43;; frame size restoration function wasn't being called in that case. In
44;;; 19.26 or later, minibuffer-exit-hook should be called anyway. 44;; 19.26 or later, minibuffer-exit-hook should be called anyway.
45 45
46;;; Note that the minibuffer and echo area are not the same! They simply 46;; Note that the minibuffer and echo area are not the same! They simply
47;;; happen to occupy roughly the same place on the frame. Messages put in 47;; happen to occupy roughly the same place on the frame. Messages put in
48;;; the echo area will not cause any resizing by this package. 48;; the echo area will not cause any resizing by this package.
49 49
50;;; This package is considered a minor mode but it doesn't put anything in 50;; This package is considered a minor mode but it doesn't put anything in
51;;; minor-mode-alist because this mode is specific to the minibuffer, which 51;; minor-mode-alist because this mode is specific to the minibuffer, which
52;;; has no mode line. 52;; has no mode line.
53 53
54;;; To use this package, put the following in your .emacs: 54;; To use this package, put the following in your .emacs:
55;;; 55;;
56;;; (autoload 'resize-minibuffer-mode "rsz-mini" nil t) 56;; (autoload 'resize-minibuffer-mode "rsz-mini" nil t)
57;;; 57;;
58;;; Invoking the command `resize-minibuffer-mode' will then enable this mode. 58;; Invoking the command `resize-minibuffer-mode' will then enable this mode.
59;;; Simply loading this file will also enable it. 59;; Simply loading this file will also enable it.
60 60
61;;; Code: 61;;; Code:
62 62
@@ -193,17 +193,17 @@ respectively."
193 193
194 194
195;; Resize the minibuffer window to contain the minibuffer's contents. 195;; Resize the minibuffer window to contain the minibuffer's contents.
196;; The minibuffer window must be current.
197(defun resize-minibuffer-window () 196(defun resize-minibuffer-window ()
198 (let ((height (window-height)) 197 (and (eq (selected-window) (minibuffer-window))
199 (lines (1+ (resize-minibuffer-count-window-lines)))) 198 (let ((height (window-height))
200 (and (numberp resize-minibuffer-window-max-height) 199 (lines (1+ (resize-minibuffer-count-window-lines))))
201 (> resize-minibuffer-window-max-height 0) 200 (and (numberp resize-minibuffer-window-max-height)
202 (setq lines (min lines resize-minibuffer-window-max-height))) 201 (> resize-minibuffer-window-max-height 0)
203 (or (if resize-minibuffer-window-exactly 202 (setq lines (min lines resize-minibuffer-window-max-height)))
204 (= lines height) 203 (or (if resize-minibuffer-window-exactly
205 (<= lines height)) 204 (= lines height)
206 (enlarge-window (- lines height))))) 205 (<= lines height))
206 (enlarge-window (- lines height))))))
207 207
208;; This resizes the minibuffer back to one line as soon as it is exited 208;; This resizes the minibuffer back to one line as soon as it is exited
209;; (e.g. when the user hits RET). This way, subsequent messages put in the 209;; (e.g. when the user hits RET). This way, subsequent messages put in the
@@ -221,6 +221,7 @@ respectively."
221;; anyway; this is just a kludge because of the timing for that update). 221;; anyway; this is just a kludge because of the timing for that update).
222(defun resize-minibuffer-window-restore () 222(defun resize-minibuffer-window-restore ()
223 (cond 223 (cond
224 ((not (eq (minibuffer-window) (selected-window))))
224 ((> (window-height) 1) 225 ((> (window-height) 1)
225 (enlarge-window (- 1 (window-height))) 226 (enlarge-window (- 1 (window-height)))
226 (sit-for 0)))) 227 (sit-for 0))))