comparison src/minibuf.c @ 6544:a84c4990fa36

(read_minibuf): Return val via unbind_to. (Fminibuffer_complete): Scroll the completion window in some cases.
author Richard M. Stallman <rms@gnu.org>
date Sun, 27 Mar 1994 07:55:46 +0000
parents c867b9af8de4
children 764913e8463c
comparison
equal deleted inserted replaced
6543:33032ee16c7c 6544:a84c4990fa36
96 then this is the string completed then; otherwise this is nil. */ 96 then this is the string completed then; otherwise this is nil. */
97 97
98 static Lisp_Object last_exact_completion; 98 static Lisp_Object last_exact_completion;
99 99
100 Lisp_Object Quser_variable_p; 100 Lisp_Object Quser_variable_p;
101
102 /* Non-nil means it is the window for C-M-v to scroll
103 when the minibuffer is selected. */
104 extern Lisp_Object Vminibuf_scroll_window;
101 105
102 /* Actual minibuffer invocation. */ 106 /* Actual minibuffer invocation. */
103 107
104 void read_minibuf_unwind (); 108 void read_minibuf_unwind ();
105 Lisp_Object get_minibuffer (); 109 Lisp_Object get_minibuffer ();
305 if (*p != ' ' && *p != '\t' && *p != '\n') 309 if (*p != ' ' && *p != '\t' && *p != '\n')
306 error ("Trailing garbage following expression"); 310 error ("Trailing garbage following expression");
307 val = Fcar (expr_and_pos); 311 val = Fcar (expr_and_pos);
308 } 312 }
309 313
310 unbind_to (count, Qnil); /* The appropriate frame will get selected
311 in set-window-configuration. */
312
313 UNGCPRO; 314 UNGCPRO;
314 315 return unbind_to (count, val); /* The appropriate frame will get selected
315 return val; 316 in set-window-configuration. */
316 } 317 }
317 318
318 /* Return a buffer to be used as the minibuffer at depth `depth'. 319 /* Return a buffer to be used as the minibuffer at depth `depth'.
319 depth = 0 is the lowest allowed argument, and that is the value 320 depth = 0 is the lowest allowed argument, and that is the value
320 used for nonrecursive minibuffer invocations */ 321 used for nonrecursive minibuffer invocations */
1115 return Qnil; 1116 return Qnil;
1116 } 1117 }
1117 1118
1118 DEFUN ("minibuffer-complete", Fminibuffer_complete, Sminibuffer_complete, 0, 0, "", 1119 DEFUN ("minibuffer-complete", Fminibuffer_complete, Sminibuffer_complete, 0, 0, "",
1119 "Complete the minibuffer contents as far as possible.\n\ 1120 "Complete the minibuffer contents as far as possible.\n\
1120 Return nil if there is no valid completion, else t.") 1121 Return nil if there is no valid completion, else t.\n\
1122 If no characters can be completed, display a list of possible completions.\n\
1123 If you repeat this command after it displayed such a list,\n\
1124 scroll the window of possible completions.")
1121 () 1125 ()
1122 { 1126 {
1123 register int i = do_completion (); 1127 register int i;
1128 Lisp_Object window, tem;
1129
1130 /* If the previous command was not this, then mark the completion
1131 buffer obsolete. */
1132 if (! EQ (last_command, this_command))
1133 Vminibuf_scroll_window = Qnil;
1134
1135 window = Vminibuf_scroll_window;
1136 /* If there's a fresh completion window with a live buffer,
1137 and this command is repeated, scroll that window. */
1138 if (! NILP (window) && ! NILP (XWINDOW (window)->buffer)
1139 && !NILP (XBUFFER (XWINDOW (window)->buffer)->name))
1140 {
1141 struct buffer *obuf = current_buffer;
1142
1143 Fset_buffer (XWINDOW (window)->buffer);
1144 tem = Fpos_visible_in_window_p (make_number (ZV), window);
1145 if (! NILP (tem))
1146 /* If end is in view, scroll up to the beginning. */
1147 Fset_window_start (window, BEGV);
1148 else
1149 /* Else scroll down one screen. */
1150 Fscroll_other_window (Qnil);
1151
1152 set_buffer_internal (obuf);
1153 return Qnil;
1154 }
1155
1156 i = do_completion ();
1124 switch (i) 1157 switch (i)
1125 { 1158 {
1126 case 0: 1159 case 0:
1127 return Qnil; 1160 return Qnil;
1128 1161