annotate lisp/electric/electric.el @ 167:85ec50267440 r20-3b10

Import from CVS: tag r20-3b10
author cvs
date Mon, 13 Aug 2007 09:45:46 +0200
parents 59463afc5666
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; electric.el --- window maker and Command loop for `electric' modes.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
3 ;; Copyright (C) 1985, 1986, 1995 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: K. Shane Hartman
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Maintainer: FSF
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; Keywords: extensions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the Free
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
23 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
24 ;; 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
26 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ; zaaaaaaap
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; This loop is the guts for non-standard modes which retain control
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; until some event occurs. It is a `do-forever', the only way out is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; to throw. It assumes that you have set up the keymap, window, and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; everything else: all it does is read commands and execute them -
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; providing error messages should one occur (if there is no loop
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; function - which see). The required argument is a tag which should
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; expect a value of nil if the user decides to punt. The second
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; argument is the prompt to be used: if nil, use "->", if 'noprompt,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ;; don't use a prompt, if a string, use that string as prompt, and if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; a function of no variable, it will be evaluated in every iteration
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; of the loop and its return value, which can be nil, 'noprompt or a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; string, will be used as prompt. Given third argument non-nil, it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;; INHIBITS quitting unless the user types C-g at toplevel. This is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;; so user can do things like C-u C-g and not get thrown out. Fourth
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;; argument, if non-nil, should be a function of two arguments which
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 ;; is called after every command is executed. The fifth argument, if
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 ;; provided, is the state variable for the function. If the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 ;; loop-function gets an error, the loop will abort WITHOUT throwing
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 ;; (moral: use unwind-protect around call to this function for any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 ;; critical stuff). The second argument for the loop function is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 ;; conditions for any error that occurred or nil if none.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (defun Electric-command-loop (return-tag
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 &optional prompt inhibit-quit
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 loop-function loop-state)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (let (cmd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (err nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (electrified-buffer (current-buffer)) ; XEmacs -
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (prompt-string prompt))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (while t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (if (not (or (stringp prompt) (eq prompt nil) (eq prompt 'noprompt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (setq prompt-string (funcall prompt)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (if (not (stringp prompt-string))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (if (eq prompt-string 'noprompt)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (setq prompt-string nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (setq prompt-string "->")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (setq cmd (read-key-sequence prompt-string))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
72 ;; XEmacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (or prefix-arg (setq last-command this-command))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (setq last-command-event (aref cmd (1- (length cmd)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 current-mouse-event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (and (or (button-press-event-p last-command-event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (button-release-event-p last-command-event)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 140
diff changeset
78 (misc-user-event-p last-command-event))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 last-command-event)
151
59463afc5666 Import from CVS: tag r20-3b2
cvs
parents: 140
diff changeset
80 this-command (if (misc-user-event-p last-command-event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 last-command-event
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (key-binding cmd t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 cmd this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 ;; This makes universal-argument-other-key work.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq universal-argument-num-events 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (if (or (prog1 quit-flag (setq quit-flag nil))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
87 ;; XEmacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (eq (event-to-character last-input-event) (quit-char)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (progn (setq unread-command-events nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 prefix-arg nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 ;; If it wasn't cancelling a prefix character, then quit.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (if (or (= (length (this-command-keys)) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (not inhibit-quit)) ; safety
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (progn (ding nil 'quit) ; XEmacs -
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (message "Quit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (throw return-tag nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (setq cmd nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (setq current-prefix-arg prefix-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (if cmd
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (condition-case conditions
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
101 ;; XEmacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (progn (if (eventp cmd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (let ((b (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (dispatch-event cmd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (if (not (eq b (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (throw return-tag (current-buffer)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (command-execute cmd))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (setq last-command this-command)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (if (or (prog1 quit-flag (setq quit-flag nil))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
111 ;; XEmacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (eq (event-to-character last-input-event)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (quit-char)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (progn (setq unread-command-events nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (if (not inhibit-quit)
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
116 ;; XEmacs
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (progn (ding nil 'quit)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (message "Quit")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (throw return-tag nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (message "Quit inhibited")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (ding)))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
122 (buffer-read-only (if loop-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
123 (setq err conditions)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
124 (ding)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
125 (message "Buffer is read-only")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
126 (sit-for 2)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
127 (beginning-of-buffer (if loop-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
128 (setq err conditions)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
129 (ding)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
130 (message "Beginning of Buffer")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
131 (sit-for 2)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
132 (end-of-buffer (if loop-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
133 (setq err conditions)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
134 (ding)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
135 (message "End of Buffer")
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
136 (sit-for 2)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
137 (error (if loop-function
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
138 (setq err conditions)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
139 (ding)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
140 (message "Error: %s"
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
141 (if (eq (car conditions) 'error)
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
142 (car (cdr conditions))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
143 (prin1-to-string conditions)))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
144 (sit-for 2))))
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
145 (ding))
140
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
146 (and (not (eq (current-buffer) electrified-buffer)) ; XEmacs -
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
147 (not (eq (selected-window) (minibuffer-window)))
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
148 (progn (ding nil 'quit)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
149 (message "Leaving electric command loop %s."
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
150 "because buffer has changed")
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
151 (sit-for 2)
585fb297b004 Import from CVS: tag r20-2b4
cvs
parents: 72
diff changeset
152 (throw return-tag nil)))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (if loop-function (funcall loop-function loop-state err))))
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
154 ;; XEmacs - huh? It should be impossible to ever get here...
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (ding nil 'alarm)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (throw return-tag nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ;; This function is like pop-to-buffer, sort of.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 ;; The algorithm is
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ;; If there is a window displaying buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ;; Select it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; Else if there is only one window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ;; Split it, selecting the window on the bottom with height being
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ;; the lesser of max-height (if non-nil) and the number of lines in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 ;; the buffer to be displayed subject to window-min-height constraint.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ;; Else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 ;; Switch to buffer in the current window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 ;; Then if max-height is nil, and not all of the lines in the buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 ;; are displayed, grab the whole frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 ;; Returns selected window on buffer positioned at point-min.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (defun Electric-pop-up-window (buffer &optional max-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (let* ((win (or (get-buffer-window buffer) (selected-window)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (buf (get-buffer buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (one-window (one-window-p t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (pop-up-windows t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (target-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 (lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 (if (not buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 (error "Buffer %s does not exist" buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (set-buffer buf)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (setq lines (count-lines (point-min) (point-max)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (setq target-height
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 (min (max (if max-height (min max-height (1+ lines)) (1+ lines))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 window-min-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (delete-other-windows)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (1- (window-height (selected-window)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (cond ((and (eq (window-buffer win) buf))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (select-window win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (one-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (goto-char (window-start win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (pop-to-buffer buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (setq win (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (enlarge-window (- target-height (window-height win))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (t
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (switch-to-buffer buf)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (if (and (not max-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 (> target-height (window-height (selected-window))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (progn (goto-char (window-start win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 (enlarge-window (- target-height (window-height win)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 win)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
72
b9518feda344 Import from CVS: tag r20-0b31
cvs
parents: 70
diff changeset
208 (provide 'electric)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 ;;; electric.el ends here