Mercurial > emacs
annotate lisp/rsz-mini.el @ 10495:70bd087c47a9
(xbufobjfwd, xbuflocal, xwinconfig):
Renamed from xbuffer_objfwd, xbuffer_local_value, xwindow_configuration
since gdb doesn't allow underscores in macro names.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 20 Jan 1995 20:12:25 +0000 |
parents | 363f719d47a5 |
children | 056c7266a614 |
rev | line source |
---|---|
7267 | 1 ;;; rsz-mini.el --- dynamically resize minibuffer to display entire contents |
2 | |
3 ;;; Copyright (C) 1990, 1993, 1994 Free Software Foundation, Inc. | |
4 | |
5 ;;; Author: Noah Friedman <friedman@prep.ai.mit.edu> | |
6 ;;; Roland McGrath <roland@prep.ai.mit.edu> | |
7 ;;; Maintainer: friedman@prep.ai.mit.edu | |
8 ;;; Keywords: minibuffer, window, frame, display | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
9 ;;; Status: Known to work in FSF GNU Emacs 19.26 and later. |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
10 ;;; $Id: rsz-mini.el,v 1.6 1994/07/12 19:51:30 rms Exp friedman $ |
7267 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
25 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
27 | |
28 ;;; Commentary: | |
29 | |
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 | |
32 ;;; reached, the minibuffer will resize itself. When the user is done | |
33 ;;; typing, the minibuffer will return to its original size. | |
34 | |
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 | |
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 | |
39 ;;; `minibuffer-exit-hook' didn't exist until version 19.23. | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
40 ;;; |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
41 ;;; Prior to Emacs 19.26, minibuffer-exit-hook wasn't called after exiting |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
42 ;;; from the minibuffer by hitting the quit char. That meant that the |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
43 ;;; frame size restoration function wasn't being called in that case. In |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
44 ;;; 19.26 or later, minibuffer-exit-hook should be called anyway. |
7267 | 45 |
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 | |
48 ;;; the echo area will not cause any resizing by this package. | |
49 | |
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 | |
52 ;;; has no mode line. | |
53 | |
54 ;;; To use this package, put the following in your .emacs: | |
55 ;;; | |
56 ;;; (autoload 'resize-minibuffer-mode "rsz-mini" nil t) | |
57 ;;; | |
58 ;;; Invoking the command `resize-minibuffer-mode' will then enable this mode. | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
59 ;;; Simply loading this file will also enable it. |
7267 | 60 |
61 ;;; Code: | |
62 | |
63 | |
64 ;;;###autoload | |
65 (defvar resize-minibuffer-mode nil | |
66 "*If non-`nil', resize the minibuffer so its entire contents are visible.") | |
67 | |
68 ;;;###autoload | |
69 (defvar resize-minibuffer-window-max-height nil | |
70 "*Maximum size the minibuffer window is allowed to become. | |
71 If less than 1 or not a number, the limit is the height of the frame in | |
72 which the active minibuffer window resides.") | |
73 | |
74 ;;;###autoload | |
75 (defvar resize-minibuffer-window-exactly t | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
76 "*Allow making minibuffer exactly the size to display all its contents. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
77 If `nil', the minibuffer window can temporarily increase in size but |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
78 never get smaller while it is active. Any other value allows exact |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
79 resizing.") |
7267 | 80 |
81 ;;;###autoload | |
82 (defvar resize-minibuffer-frame nil | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
83 "*Allow changing the frame height of minibuffer frames. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
84 If non-`nil' and the active minibuffer is the sole window in its frame, |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
85 allow changing the frame height.") |
7267 | 86 |
87 ;;;###autoload | |
88 (defvar resize-minibuffer-frame-max-height nil | |
89 "*Maximum size the minibuffer frame is allowed to become. | |
90 If less than 1 or not a number, there is no limit.") | |
91 | |
92 ;;;###autoload | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
93 (defvar resize-minibuffer-frame-exactly t |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
94 "*Allow making minibuffer frame exactly the size to display all its contents. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
95 If `nil', the minibuffer frame can temporarily increase in size but |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
96 never get smaller while it is active. Any other value allows exact |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
97 resizing.") |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
98 |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
99 ;; Variable used to store the height of the minibuffer frame |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
100 ;; on entry, so it can be restored on exit. It is made local before it is |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
101 ;; modified. Do not use it yourself. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
102 (defvar resize-minibuffer-frame-original-height nil) |
7267 | 103 |
104 | |
105 ;;;###autoload | |
106 (defun resize-minibuffer-mode (&optional prefix) | |
107 "Enable or disable resize-minibuffer mode. | |
108 A negative prefix argument disables this mode. A positive argument or | |
109 argument of 0 enables it. | |
110 | |
111 When this minor mode is enabled, the minibuffer is dynamically resized to | |
112 contain the entire region of text put in it as you type. | |
113 | |
114 The variable `resize-minibuffer-mode' is set to t or nil depending on | |
115 whether this mode is active or not. | |
116 | |
117 The maximum height to which the minibuffer can grow is controlled by the | |
118 variable `resize-minibuffer-window-max-height'. | |
119 | |
120 The variable `resize-minibuffer-window-exactly' determines whether the | |
121 minibuffer window should ever be shrunk to make it no larger than needed to | |
122 display its contents. | |
123 | |
7512 | 124 When using a window system, it is possible for a minibuffer to be the sole |
7267 | 125 window in a frame. Since that window is already its maximum size, the only |
126 way to make more text visible at once is to increase the size of the frame. | |
127 The variable `resize-minibuffer-frame' controls whether this should be | |
128 done. The variables `resize-minibuffer-frame-max-height' and | |
129 `resize-minibuffer-frame-exactly' are analogous to their window | |
130 counterparts." | |
131 (interactive "p") | |
132 (or prefix (setq prefix 0)) | |
133 (cond | |
134 ((>= prefix 0) | |
135 (setq resize-minibuffer-mode t)) | |
136 (t | |
137 (setq resize-minibuffer-mode nil)))) | |
138 | |
139 (defun resize-minibuffer-setup () | |
140 (cond | |
141 (resize-minibuffer-mode | |
142 (cond | |
143 ((and window-system | |
144 (eq 'only (cdr (assq 'minibuffer (frame-parameters))))) | |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
145 ;; Checking for resize-minibuffer-frame is done outside the cond |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
146 ;; predicate because that should always be t if this is a minibuffer |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
147 ;; frame; it just shouldn't do anything if this flag is nil. |
7267 | 148 (and resize-minibuffer-frame |
149 (progn | |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
150 ;; Can't trust the height stored in minibuffer-frame-alist |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
151 ;; since the frame can be resized by the window manager and |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
152 ;; that variable isn't updated. |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
153 (make-local-variable 'resize-minibuffer-frame-original-height) |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
154 (setq resize-minibuffer-frame-original-height (frame-height)) |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
155 |
7267 | 156 (make-local-variable 'post-command-hook) |
8226
3ad4ec3c9228
(resize-minibuffer-setup):
Richard M. Stallman <rms@gnu.org>
parents:
8093
diff
changeset
|
157 ;; Copy this because add-hook modifies the list structure. |
3ad4ec3c9228
(resize-minibuffer-setup):
Richard M. Stallman <rms@gnu.org>
parents:
8093
diff
changeset
|
158 (setq post-command-hook (copy-sequence post-command-hook)) |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
159 (add-hook 'post-command-hook 'resize-minibuffer-frame 'append) |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
160 |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
161 (make-local-variable 'minibuffer-exit-hook) |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
162 (add-hook 'minibuffer-exit-hook 'resize-minibuffer-frame-restore) |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
163 |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
164 (resize-minibuffer-frame)))) |
7267 | 165 (t |
166 (make-local-variable 'post-command-hook) | |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
167 ;; Copy this because add-hook modifies the list structure. |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
168 (setq post-command-hook (copy-sequence post-command-hook)) |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
169 (add-hook 'post-command-hook 'resize-minibuffer-window 'append) |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
170 |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
171 (make-local-variable 'minibuffer-exit-hook) |
8240
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
172 (add-hook 'minibuffer-exit-hook 'resize-minibuffer-window-restore) |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
173 |
363f719d47a5
(resize-minibuffer-setup): Copy post-command-hook when handling minibuffer
Noah Friedman <friedman@splode.com>
parents:
8226
diff
changeset
|
174 (resize-minibuffer-window)))))) |
7267 | 175 |
176 (defun resize-minibuffer-count-window-lines (&optional start end) | |
177 "Return number of window lines occupied by text in region. | |
178 The number of window lines may be greater than the number of actual lines | |
179 in the buffer if any wrap on the display due to their length. | |
180 | |
181 Optional arguments START and END default to point-min and point-max, | |
182 respectively." | |
183 (or start (setq start (point-min))) | |
184 (or end (setq end (point-max))) | |
185 (if (= start end) | |
186 0 | |
187 (save-excursion | |
188 (save-restriction | |
189 (widen) | |
190 (narrow-to-region start end) | |
191 (goto-char start) | |
192 (vertical-motion (buffer-size)))))) | |
193 | |
194 | |
195 ;; Resize the minibuffer window to contain the minibuffer's contents. | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
196 ;; The minibuffer window must be current. |
7267 | 197 (defun resize-minibuffer-window () |
198 (let ((height (window-height)) | |
199 (lines (1+ (resize-minibuffer-count-window-lines)))) | |
200 (and (numberp resize-minibuffer-window-max-height) | |
201 (> resize-minibuffer-window-max-height 0) | |
202 (setq lines (min lines resize-minibuffer-window-max-height))) | |
203 (or (if resize-minibuffer-window-exactly | |
204 (= lines height) | |
205 (<= lines height)) | |
206 (enlarge-window (- lines height))))) | |
207 | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
208 ;; This resizes the minibuffer back to one line as soon as it is exited |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
209 ;; (e.g. when the user hits RET). This way, subsequent messages put in the |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
210 ;; echo area aren't cluttered with leftover minibuffer text. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
211 ;; It should be called by minibuffer-exit-hook. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
212 ;; |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
213 ;; Note that because it calls sit-for to force a screen update, strange |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
214 ;; things may happen in the minibuffer, such as unexpanded partial |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
215 ;; completions by complete.el showing their completion. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
216 ;; If this bothers you, just redefine this function to do nothing, in, say, |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
217 ;; your after-load-alist. Perhaps there should be an option variable, |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
218 ;; but I don't know if there's really any demand for it. |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
219 ;; (Clobbering this definition is harmless because eventually emacs restores |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
220 ;; its idea of the minibuffer window size when the minibuffer isn't in use |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
221 ;; anyway; this is just a kludge because of the timing for that update). |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
222 (defun resize-minibuffer-window-restore () |
8093
1978838b7b6f
(resize-minibuffer-window-restore): Don't do anything if the window height
Noah Friedman <friedman@splode.com>
parents:
8012
diff
changeset
|
223 (cond |
1978838b7b6f
(resize-minibuffer-window-restore): Don't do anything if the window height
Noah Friedman <friedman@splode.com>
parents:
8012
diff
changeset
|
224 ((> (window-height) 1) |
1978838b7b6f
(resize-minibuffer-window-restore): Don't do anything if the window height
Noah Friedman <friedman@splode.com>
parents:
8012
diff
changeset
|
225 (enlarge-window (- 1 (window-height))) |
1978838b7b6f
(resize-minibuffer-window-restore): Don't do anything if the window height
Noah Friedman <friedman@splode.com>
parents:
8012
diff
changeset
|
226 (sit-for 0)))) |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
227 |
7267 | 228 |
229 ;; Resize the minibuffer frame to contain the minibuffer's contents. | |
230 ;; The minibuffer frame must be the current frame. | |
231 (defun resize-minibuffer-frame () | |
232 (let ((height (frame-height)) | |
233 (lines (1+ (resize-minibuffer-count-window-lines)))) | |
234 (and (numberp resize-minibuffer-frame-max-height) | |
235 (> resize-minibuffer-frame-max-height 0) | |
236 (setq lines (min lines resize-minibuffer-frame-max-height))) | |
237 (cond | |
238 ((> lines height) | |
239 (set-frame-size (selected-frame) (frame-width) lines)) | |
240 ((and resize-minibuffer-frame-exactly | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
241 (> height resize-minibuffer-frame-original-height) |
7267 | 242 (< lines height)) |
243 (set-frame-size (selected-frame) (frame-width) lines))))) | |
244 | |
245 ;; Restore the original height of the frame. | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
246 ;; resize-minibuffer-frame-original-height is set in |
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
247 ;; resize-minibuffer-setup. |
7267 | 248 (defun resize-minibuffer-frame-restore () |
249 (set-frame-size (selected-frame) | |
250 (frame-width) | |
8012
df03bfa5b694
(resize-minibuffer-window-exactly, resize-minibuffer-frame,
Noah Friedman <friedman@splode.com>
parents:
7590
diff
changeset
|
251 resize-minibuffer-frame-original-height)) |
7267 | 252 |
253 | |
254 (provide 'rsz-mini) | |
255 | |
256 (add-hook 'minibuffer-setup-hook 'resize-minibuffer-setup) | |
7590
e70581cde056
Enable resize-minibuffer-mode when this file is loaded.
Noah Friedman <friedman@splode.com>
parents:
7512
diff
changeset
|
257 (resize-minibuffer-mode) |
7267 | 258 |
259 ;; rsz-mini.el ends here |