annotate lisp/electric.el @ 109130:cd13b432f239

Fix more prototypes. * atimer.c (start_atimer): Use EMACS_TIME, not struct timeval. * sysdep.c (set_file_times): Use EMACS_TIME, not struct timeval. * xgselect.c (xg_select): Use SELECT_TYPE, EMACS_TIME.
author Juanma Barranquero <lekktu@gmail.com>
date Sun, 04 Jul 2010 15:41:55 +0200
parents 8e422499f0ff
children c9b982e5aefd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 14941
diff changeset
1 ;;; electric.el --- window maker and Command loop for `electric' modes
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
2
74439
ddcbd2c1b70d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
3 ;; Copyright (C) 1985, 1986, 1995, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 101013
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
5
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 778
diff changeset
6 ;; Author: K. Shane Hartman
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 778
diff changeset
7 ;; Maintainer: FSF
811
e694e0879463 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
8 ;; Keywords: extensions
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 778
diff changeset
9
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; This file is part of GNU Emacs.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
14 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; (at your option) any later version.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; GNU Emacs is distributed in the hope that it will be useful,
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; GNU General Public License for more details.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
2229
bd3c525fa6fc Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1821
diff changeset
25 ;;; Commentary:
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 35
diff changeset
27 ; zaaaaaaap
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28
2229
bd3c525fa6fc Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1821
diff changeset
29 ;;; Code:
bd3c525fa6fc Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1821
diff changeset
30
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;; This loop is the guts for non-standard modes which retain control
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
32 ;; until some event occurs. It is a `do-forever', the only way out is
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
33 ;; to throw. It assumes that you have set up the keymap, window, and
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; everything else: all it does is read commands and execute them -
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; providing error messages should one occur (if there is no loop
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; function - which see). The required argument is a tag which should
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
37 ;; expect a value of nil if the user decides to punt. The second
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
38 ;; argument is the prompt to be used: if nil, use "->", if 'noprompt,
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
39 ;; don't use a prompt, if a string, use that string as prompt, and if
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
40 ;; a function of no variable, it will be evaluated in every iteration
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
41 ;; of the loop and its return value, which can be nil, 'noprompt or a
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
42 ;; string, will be used as prompt. Given third argument non-nil, it
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
43 ;; INHIBITS quitting unless the user types C-g at toplevel. This is
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
44 ;; so user can do things like C-u C-g and not get thrown out. Fourth
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
45 ;; argument, if non-nil, should be a function of two arguments which
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
46 ;; is called after every command is executed. The fifth argument, if
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
47 ;; provided, is the state variable for the function. If the
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;; loop-function gets an error, the loop will abort WITHOUT throwing
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;; (moral: use unwind-protect around call to this function for any
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 ;; critical stuff). The second argument for the loop function is the
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 ;; conditions for any error that occurred or nil if none.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 (defun Electric-command-loop (return-tag
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 &optional prompt inhibit-quit
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 loop-function loop-state)
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
56
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
57 (let (cmd
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
58 (err nil)
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
59 (prompt-string prompt))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 (while t
108309
8e422499f0ff Misc code tweaks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106815
diff changeset
61 (if (functionp prompt)
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
62 (setq prompt-string (funcall prompt)))
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
63 (if (not (stringp prompt-string))
108309
8e422499f0ff Misc code tweaks.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 106815
diff changeset
64 (setq prompt-string (unless (eq prompt-string 'noprompt) "->")))
13260
a10616f0ad17 (Electric-command-loop): Don't display a prompt
Richard M. Stallman <rms@gnu.org>
parents: 3439
diff changeset
65 (setq cmd (read-key-sequence prompt-string))
101010
4efc7ca085ce Replace last-command-char with last-command-event.
Glenn Morris <rgm@gnu.org>
parents: 100908
diff changeset
66 (setq last-command-event (aref cmd (1- (length cmd)))
14941
7e8ee35d0fb9 (Electric-command-loop): Set universal-argument-other-key to 0.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
67 this-command (key-binding cmd t)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 cmd this-command)
14941
7e8ee35d0fb9 (Electric-command-loop): Set universal-argument-other-key to 0.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
69 ;; This makes universal-argument-other-key work.
7e8ee35d0fb9 (Electric-command-loop): Set universal-argument-other-key to 0.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
70 (setq universal-argument-num-events 0)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 (if (or (prog1 quit-flag (setq quit-flag nil))
101013
dbe70c3aa01d Replace last-input-char with last-input-event.
Glenn Morris <rgm@gnu.org>
parents: 101010
diff changeset
72 (eq last-input-event ?\C-g))
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1609
diff changeset
73 (progn (setq unread-command-events nil
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 prefix-arg nil)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 ;; If it wasn't cancelling a prefix character, then quit.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 (if (or (= (length (this-command-keys)) 1)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 (not inhibit-quit)) ; safety
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 (progn (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 (message "Quit")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 (throw return-tag nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 (setq cmd nil))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 (setq current-prefix-arg prefix-arg)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 (if cmd
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 (condition-case conditions
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 (progn (command-execute cmd)
703
e2780d9a814c *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 662
diff changeset
86 (setq last-command this-command)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 (if (or (prog1 quit-flag (setq quit-flag nil))
101013
dbe70c3aa01d Replace last-input-char with last-input-event.
Glenn Morris <rgm@gnu.org>
parents: 101010
diff changeset
88 (eq last-input-event ?\C-g))
1821
04fb1d3d6992 JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents: 1609
diff changeset
89 (progn (setq unread-command-events nil)
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (if (not inhibit-quit)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (progn (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 (message "Quit")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 (throw return-tag nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 (ding)))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 (buffer-read-only (if loop-function
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 (setq err conditions)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 (message "Buffer is read-only")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 (sit-for 2)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (beginning-of-buffer (if loop-function
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 (setq err conditions)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 (message "Beginning of Buffer")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 (sit-for 2)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 (end-of-buffer (if loop-function
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 (setq err conditions)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 (message "End of Buffer")
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 (sit-for 2)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 (error (if loop-function
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 (setq err conditions)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 (message "Error: %s"
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 (if (eq (car conditions) 'error)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 (car (cdr conditions))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (prin1-to-string conditions)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 (sit-for 2))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 (ding))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 (if loop-function (funcall loop-function loop-state err))))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 (ding)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 (throw return-tag nil))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122
49588
37645a051842 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
123 ;; This function is like pop-to-buffer, sort of.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 ;; The algorithm is
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 ;; If there is a window displaying buffer
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 ;; Select it
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 ;; Else if there is only one window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 ;; Split it, selecting the window on the bottom with height being
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 ;; the lesser of max-height (if non-nil) and the number of lines in
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 ;; the buffer to be displayed subject to window-min-height constraint.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 ;; Else
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 ;; Switch to buffer in the current window.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 ;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 ;; Then if max-height is nil, and not all of the lines in the buffer
778
cd00bdacc17b *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 703
diff changeset
135 ;; are displayed, grab the whole frame.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 ;;
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 ;; Returns selected window on buffer positioned at point-min.
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 (defun Electric-pop-up-window (buffer &optional max-height)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 (let* ((win (or (get-buffer-window buffer) (selected-window)))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 (buf (get-buffer buffer))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 (one-window (one-window-p t))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 (pop-up-windows t)
59315
c5ee87e89147 (Electric-pop-up-window): Use fit-window-to-buffer
Richard M. Stallman <rms@gnu.org>
parents: 54575
diff changeset
144 (pop-up-frames nil))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 (if (not buf)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 (error "Buffer %s does not exist" buffer)
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 (cond ((and (eq (window-buffer win) buf))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 (select-window win))
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 (one-window
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 (pop-to-buffer buffer)
59315
c5ee87e89147 (Electric-pop-up-window): Use fit-window-to-buffer
Richard M. Stallman <rms@gnu.org>
parents: 54575
diff changeset
151 (setq win (selected-window)))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (t
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 (switch-to-buffer buf)))
99234
770ae8d8f7f4 (Electric-pop-up-window): Don't shrink the window if it's already big
Chong Yidong <cyd@stupidchicken.com>
parents: 94678
diff changeset
154 ;; Don't shrink the window, but expand it if necessary.
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 (goto-char (point-min))
99362
b162bc232856 (Electric-pop-up-window): Call window-end with UPDATE set to t.
Martin Rudalics <rudalics@gmx.at>
parents: 99234
diff changeset
156 (unless (= (point-max) (window-end win t))
99234
770ae8d8f7f4 (Electric-pop-up-window): Don't shrink the window if it's already big
Chong Yidong <cyd@stupidchicken.com>
parents: 94678
diff changeset
157 (fit-window-to-buffer win max-height))
35
63b375f17a65 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 win)))
584
4cd7543be581 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 35
diff changeset
159
662
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
160 (provide 'electric)
8a533acedb77 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 584
diff changeset
161
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 79721
diff changeset
162 ;; arch-tag: dae045eb-dc2d-4fb7-9f27-9cc2ce277be8
2229
bd3c525fa6fc Added standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1821
diff changeset
163 ;;; electric.el ends here