diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index 9f96f15d5df..bd5d3155e8e 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1095,7 +1095,7 @@ is added, provided that matches some possible completion.") | |||
| 1095 | 1095 | ||
| 1096 | DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list, | 1096 | DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list, |
| 1097 | 1, 1, 0, | 1097 | 1, 1, 0, |
| 1098 | "Display in a buffer the list of completions, COMPLETIONS.\n\ | 1098 | "Display the list of completions, COMPLETIONS, using `standard-output'.\n\ |
| 1099 | Each element may be just a symbol or string\n\ | 1099 | Each element may be just a symbol or string\n\ |
| 1100 | or may be a list of two strings to be printed as if concatenated.") | 1100 | or may be a list of two strings to be printed as if concatenated.") |
| 1101 | (completions) | 1101 | (completions) |
| @@ -1103,17 +1103,18 @@ or may be a list of two strings to be printed as if concatenated.") | |||
| 1103 | { | 1103 | { |
| 1104 | register Lisp_Object tail, elt; | 1104 | register Lisp_Object tail, elt; |
| 1105 | register int i; | 1105 | register int i; |
| 1106 | struct buffer *old = current_buffer; | 1106 | int column = 0; |
| 1107 | /* No GCPRO needed, since (when it matters) every variable | 1107 | /* No GCPRO needed, since (when it matters) every variable |
| 1108 | points to a non-string that is pointed to by COMPLETIONS. */ | 1108 | points to a non-string that is pointed to by COMPLETIONS. */ |
| 1109 | 1109 | struct buffer *old = current_buffer; | |
| 1110 | set_buffer_internal (XBUFFER (Vstandard_output)); | 1110 | if (XTYPE (Vstandard_output) == Lisp_Buffer) |
| 1111 | set_buffer_internal (XBUFFER (Vstandard_output)); | ||
| 1111 | 1112 | ||
| 1112 | if (NILP (completions)) | 1113 | if (NILP (completions)) |
| 1113 | insert_string ("There are no possible completions of what you have typed."); | 1114 | write_string ("There are no possible completions of what you have typed.", -1); |
| 1114 | else | 1115 | else |
| 1115 | { | 1116 | { |
| 1116 | insert_string ("Possible completions are:"); | 1117 | write_string ("Possible completions are:", -1); |
| 1117 | for (tail = completions, i = 0; !NILP (tail); tail = Fcdr (tail), i++) | 1118 | for (tail = completions, i = 0; !NILP (tail); tail = Fcdr (tail), i++) |
| 1118 | { | 1119 | { |
| 1119 | /* this needs fixing for the case of long completions | 1120 | /* this needs fixing for the case of long completions |
| @@ -1121,20 +1122,52 @@ or may be a list of two strings to be printed as if concatenated.") | |||
| 1121 | /* Sadly, the window it will appear in is not known | 1122 | /* Sadly, the window it will appear in is not known |
| 1122 | until after the text has been made. */ | 1123 | until after the text has been made. */ |
| 1123 | if (i & 1) | 1124 | if (i & 1) |
| 1124 | Findent_to (make_number (35), make_number (1)); | 1125 | { |
| 1126 | if (XTYPE (Vstandard_output) == Lisp_Buffer) | ||
| 1127 | Findent_to (make_number (35), make_number (1)); | ||
| 1128 | else | ||
| 1129 | { | ||
| 1130 | do | ||
| 1131 | { | ||
| 1132 | write_string (" ", -1); | ||
| 1133 | column++; | ||
| 1134 | } | ||
| 1135 | while (column < 35); | ||
| 1136 | } | ||
| 1137 | } | ||
| 1125 | else | 1138 | else |
| 1126 | Fterpri (Qnil); | 1139 | { |
| 1140 | Fterpri (Qnil); | ||
| 1141 | column = 0; | ||
| 1142 | } | ||
| 1127 | elt = Fcar (tail); | 1143 | elt = Fcar (tail); |
| 1128 | if (CONSP (elt)) | 1144 | if (CONSP (elt)) |
| 1129 | { | 1145 | { |
| 1146 | if (XTYPE (Vstandard_output) != Lisp_Buffer) | ||
| 1147 | { | ||
| 1148 | tem = Flength (Fcar (elt)); | ||
| 1149 | column += XINT (tem); | ||
| 1150 | tem = Flength (Fcar (Fcdr (elt))); | ||
| 1151 | column += XINT (tem); | ||
| 1152 | } | ||
| 1130 | Fprinc (Fcar (elt), Qnil); | 1153 | Fprinc (Fcar (elt), Qnil); |
| 1131 | Fprinc (Fcar (Fcdr (elt)), Qnil); | 1154 | Fprinc (Fcar (Fcdr (elt)), Qnil); |
| 1132 | } | 1155 | } |
| 1133 | else | 1156 | else |
| 1134 | Fprinc (elt, Qnil); | 1157 | { |
| 1158 | if (XTYPE (Vstandard_output) != Lisp_Buffer) | ||
| 1159 | { | ||
| 1160 | Lisp_Object tem; | ||
| 1161 | tem = Flength (elt, Qt); | ||
| 1162 | column += XINT (tem); | ||
| 1163 | } | ||
| 1164 | Fprinc (elt, Qnil); | ||
| 1165 | } | ||
| 1135 | } | 1166 | } |
| 1136 | } | 1167 | } |
| 1137 | set_buffer_internal (old); | 1168 | |
| 1169 | if (XTYPE (Vstandard_output) == Lisp_Buffer) | ||
| 1170 | set_buffer_internal (old); | ||
| 1138 | return Qnil; | 1171 | return Qnil; |
| 1139 | } | 1172 | } |
| 1140 | 1173 | ||