diff options
| author | Richard M. Stallman | 1994-03-27 07:55:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-03-27 07:55:46 +0000 |
| commit | 2cb6da5c7863c517e711e57165452c0ab39716b4 (patch) | |
| tree | d933caf4c18b7c210f03392d3610772deb8aef86 /src | |
| parent | 5b9cf4b2e050f8f53ff87eaf1cbcfd581786a168 (diff) | |
| download | emacs-2cb6da5c7863c517e711e57165452c0ab39716b4.tar.gz emacs-2cb6da5c7863c517e711e57165452c0ab39716b4.zip | |
(read_minibuf): Return val via unbind_to.
(Fminibuffer_complete): Scroll the completion window in some cases.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index d7da13d57b7..6ab992b5c1c 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -98,6 +98,10 @@ int minibuffer_auto_raise; | |||
| 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 | ||
| @@ -307,12 +311,9 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histvar, histpos) | |||
| 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'. |
| @@ -1117,10 +1118,42 @@ assoc_for_completion (key, list) | |||
| 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: |