aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann1999-08-21 19:30:16 +0000
committerGerd Moellmann1999-08-21 19:30:16 +0000
commit39e98b382bd74d9f4e7f915d73166777b1004be7 (patch)
treeefa412b71f4d0fcafe57e1d0fde19fc65aa6755d /src
parent986113dff2f9910849c7f0d356467becea1adec4 (diff)
downloademacs-39e98b382bd74d9f4e7f915d73166777b1004be7.tar.gz
emacs-39e98b382bd74d9f4e7f915d73166777b1004be7.zip
Remove conditional compilation on
NO_PROMPT_IN_BUFFER. (Fminibuffer_prompt_end): New. (syms_of_minibuf): Defsubr it. Remove minibuffer-prompt-in-buffer. (Fminibuffer_prompt_width): Return 0 if not in mini-buffer. Extend documentation. (read_minibuf): Use clear_message instead of setting echo_area_glyphs. (Fminibuffer_completion_help): Ditto.
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c76
1 files changed, 23 insertions, 53 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 8c79b9edf07..3ad44c6b500 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -130,14 +130,6 @@ Lisp_Object Qcurrent_input_method, Qactivate_input_method;
130 130
131extern Lisp_Object Qmouse_face; 131extern Lisp_Object Qmouse_face;
132 132
133/* If the following variable is bound, mini-buffer prompts are
134 inserted into mini-buffers instead of being displayed via
135 display_string. Tested in simple.el. No other use. */
136
137#if !NO_PROMPT_IN_BUFFER
138Lisp_Object Vminibuffer_prompt_in_buffer;
139#endif
140
141 133
142/* Put minibuf on currently selected frame's minibuffer. 134/* Put minibuf on currently selected frame's minibuffer.
143 We do this whenever the user starts a new minibuffer 135 We do this whenever the user starts a new minibuffer
@@ -248,9 +240,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
248 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; 240 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
249 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 241 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
250 Lisp_Object enable_multibyte; 242 Lisp_Object enable_multibyte;
251#if !NO_PROMPT_IN_BUFFER
252 extern Lisp_Object Qinvisible, Qintangible, Qread_only, Qfront_sticky; 243 extern Lisp_Object Qinvisible, Qintangible, Qread_only, Qfront_sticky;
253#endif
254 244
255 specbind (Qminibuffer_default, defalt); 245 specbind (Qminibuffer_default, defalt);
256 246
@@ -320,11 +310,9 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
320 Fcons (Vminibuffer_history_position, 310 Fcons (Vminibuffer_history_position,
321 Fcons (Vminibuffer_history_variable, 311 Fcons (Vminibuffer_history_variable,
322 minibuf_save_list)))))); 312 minibuf_save_list))))));
323#if !NO_PROMPT_IN_BUFFER
324 minibuf_save_list 313 minibuf_save_list
325 = Fcons (current_buffer->minibuffer_prompt_length, 314 = Fcons (current_buffer->minibuffer_prompt_length,
326 minibuf_save_list); 315 minibuf_save_list);
327#endif
328 316
329 record_unwind_protect (read_minibuf_unwind, Qnil); 317 record_unwind_protect (read_minibuf_unwind, Qnil);
330 minibuf_level++; 318 minibuf_level++;
@@ -389,9 +377,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
389 377
390 Fmake_local_variable (Qprint_escape_newlines); 378 Fmake_local_variable (Qprint_escape_newlines);
391 print_escape_newlines = 1; 379 print_escape_newlines = 1;
392#if !NO_PROMPT_IN_BUFFER
393 XSETFASTINT (current_buffer->minibuffer_prompt_length, 0); 380 XSETFASTINT (current_buffer->minibuffer_prompt_length, 0);
394#endif
395 381
396 /* Erase the buffer. */ 382 /* Erase the buffer. */
397 { 383 {
@@ -405,7 +391,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
405 && ! STRING_MULTIBYTE (minibuf_prompt)) 391 && ! STRING_MULTIBYTE (minibuf_prompt))
406 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt); 392 minibuf_prompt = Fstring_make_multibyte (minibuf_prompt);
407 393
408#if !NO_PROMPT_IN_BUFFER
409 /* Insert the prompt, record where it ends. */ 394 /* Insert the prompt, record where it ends. */
410 Finsert (1, &minibuf_prompt); 395 Finsert (1, &minibuf_prompt);
411 XSETFASTINT (current_buffer->minibuffer_prompt_length, PT); 396 XSETFASTINT (current_buffer->minibuffer_prompt_length, PT);
@@ -418,7 +403,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
418 Fput_text_property (make_number (PT - 1), make_number (Z), 403 Fput_text_property (make_number (PT - 1), make_number (Z),
419 Qrear_nonsticky, Qt, Qnil); 404 Qrear_nonsticky, Qt, Qnil);
420 } 405 }
421#endif
422 406
423 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */ 407 /* If appropriate, copy enable-multibyte-characters into the minibuffer. */
424 if (inherit_input_method) 408 if (inherit_input_method)
@@ -432,11 +416,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
432 Fforward_char (backup_n); 416 Fforward_char (backup_n);
433 } 417 }
434 418
435 echo_area_glyphs = 0; 419 clear_message (1, 1);
436 /* This is in case the minibuffer-setup-hook calls Fsit_for. */
437 previous_echo_glyphs = 0;
438 echo_area_message = previous_echo_area_message = Qnil,
439
440 current_buffer->keymap = map; 420 current_buffer->keymap = map;
441 421
442 /* Turn on an input method stored in INPUT_METHOD if any. */ 422 /* Turn on an input method stored in INPUT_METHOD if any. */
@@ -618,10 +598,8 @@ read_minibuf_unwind (data)
618 Fset_buffer (XWINDOW (window)->buffer); 598 Fset_buffer (XWINDOW (window)->buffer);
619 599
620 /* Restore prompt, etc, from outer minibuffer level. */ 600 /* Restore prompt, etc, from outer minibuffer level. */
621#if !NO_PROMPT_IN_BUFFER
622 current_buffer->minibuffer_prompt_length = Fcar (minibuf_save_list); 601 current_buffer->minibuffer_prompt_length = Fcar (minibuf_save_list);
623 minibuf_save_list = Fcdr (minibuf_save_list); 602 minibuf_save_list = Fcdr (minibuf_save_list);
624#endif
625 603
626 minibuf_prompt = Fcar (minibuf_save_list); 604 minibuf_prompt = Fcar (minibuf_save_list);
627 minibuf_save_list = Fcdr (minibuf_save_list); 605 minibuf_save_list = Fcdr (minibuf_save_list);
@@ -1667,11 +1645,7 @@ a repetition of this command will exit.")
1667 Lisp_Object val; 1645 Lisp_Object val;
1668 1646
1669 /* Allow user to specify null string */ 1647 /* Allow user to specify null string */
1670#if !NO_PROMPT_IN_BUFFER
1671 if (XFASTINT (current_buffer->minibuffer_prompt_length) == ZV) 1648 if (XFASTINT (current_buffer->minibuffer_prompt_length) == ZV)
1672#else
1673 if (BEGV == ZV)
1674#endif
1675 goto exit; 1649 goto exit;
1676 1650
1677 if (!NILP (test_completion (Fbuffer_string ()))) 1651 if (!NILP (test_completion (Fbuffer_string ())))
@@ -1806,7 +1780,6 @@ Return nil if there is no valid completion, else t.")
1806 } 1780 }
1807#endif /* Rewritten code */ 1781#endif /* Rewritten code */
1808 1782
1809#if !NO_PROMPT_IN_BUFFER
1810 { 1783 {
1811 int prompt_end_charpos, prompt_end_bytepos; 1784 int prompt_end_charpos, prompt_end_bytepos;
1812 prompt_end_charpos = XFASTINT (current_buffer->minibuffer_prompt_length); 1785 prompt_end_charpos = XFASTINT (current_buffer->minibuffer_prompt_length);
@@ -1814,10 +1787,6 @@ Return nil if there is no valid completion, else t.")
1814 i = ZV - prompt_end_charpos; 1787 i = ZV - prompt_end_charpos;
1815 i_byte = ZV_BYTE - prompt_end_bytepos; 1788 i_byte = ZV_BYTE - prompt_end_bytepos;
1816 } 1789 }
1817#else
1818 i = ZV - BEGV;
1819 i_byte = ZV_BYTE - BEGV_BYTE;
1820#endif
1821 1790
1822 /* If completion finds next char not unique, 1791 /* If completion finds next char not unique,
1823 consider adding a space or a hyphen. */ 1792 consider adding a space or a hyphen. */
@@ -1867,11 +1836,7 @@ Return nil if there is no valid completion, else t.")
1867 1836
1868 /* If got no characters, print help for user. */ 1837 /* If got no characters, print help for user. */
1869 1838
1870#if !NO_PROMPT_IN_BUFFER
1871 if (i == ZV - XFASTINT (current_buffer->minibuffer_prompt_length)) 1839 if (i == ZV - XFASTINT (current_buffer->minibuffer_prompt_length))
1872#else
1873 if (i == ZV - BEGV)
1874#endif
1875 { 1840 {
1876 if (auto_help) 1841 if (auto_help)
1877 Fminibuffer_completion_help (); 1842 Fminibuffer_completion_help ();
@@ -2078,8 +2043,7 @@ DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_co
2078 Vminibuffer_completion_table, 2043 Vminibuffer_completion_table,
2079 Vminibuffer_completion_predicate, 2044 Vminibuffer_completion_predicate,
2080 Qt); 2045 Qt);
2081 echo_area_glyphs = 0; 2046 clear_message (1, 0);
2082 echo_area_message = Qnil;
2083 2047
2084 if (NILP (completions)) 2048 if (NILP (completions))
2085 { 2049 {
@@ -2129,17 +2093,31 @@ If no minibuffer is active, return nil.")
2129 2093
2130DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width, 2094DEFUN ("minibuffer-prompt-width", Fminibuffer_prompt_width,
2131 Sminibuffer_prompt_width, 0, 0, 0, 2095 Sminibuffer_prompt_width, 0, 0, 0,
2132 "Return the display width of the minibuffer prompt.") 2096 "Return the display width of the minibuffer prompt.\n\
2097Return 0 if current buffer is not a mini-buffer.")
2133 () 2098 ()
2134{ 2099{
2135 Lisp_Object width; 2100 Lisp_Object width;
2136#if !NO_PROMPT_IN_BUFFER 2101 if (NILP (current_buffer->minibuffer_prompt_length))
2137 XSETFASTINT (width, current_buffer->minibuffer_prompt_length); 2102 width = make_number (0);
2138#else 2103 else
2139 XSETFASTINT (width, minibuf_prompt_width); 2104 width = make_number (current_buffer->minibuffer_prompt_length);
2140#endif
2141 return width; 2105 return width;
2142} 2106}
2107
2108
2109DEFUN ("minibuffer-prompt-end", Fminibuffer_prompt_end,
2110 Sminibuffer_prompt_end, 0, 0, 0,
2111 "Return the end buffer position of the mini-buffer prompt.\n\
2112Value is 0 if current buffer is not a mini-buffer.")
2113 ()
2114{
2115 return (NILP (current_buffer->minibuffer_prompt_length)
2116 ? make_number (0)
2117 : make_number (current_buffer->minibuffer_prompt_length));
2118}
2119
2120
2143 2121
2144/* Temporarily display the string M at the end of the current 2122/* Temporarily display the string M at the end of the current
2145 minibuffer contents. This is used to display things like 2123 minibuffer contents. This is used to display things like
@@ -2252,15 +2230,6 @@ syms_of_minibuf ()
2252 Qactivate_input_method = intern ("activate-input-method"); 2230 Qactivate_input_method = intern ("activate-input-method");
2253 staticpro (&Qactivate_input_method); 2231 staticpro (&Qactivate_input_method);
2254 2232
2255#if !NO_PROMPT_IN_BUFFER
2256 /* This variable should be removed once it has been decided whether or
2257 not to use prompts in buffers. */
2258 DEFVAR_LISP ("minibuffer-prompt-in-buffer", &Vminibuffer_prompt_in_buffer,
2259 "The existance of this variable indicates that mini-buffer prompts are\n\
2260inserted into the mini-buffer.");
2261 Vminibuffer_prompt_in_buffer = Qnil;
2262#endif /* !NO_PROMPT_IN_BUFFER */
2263
2264 DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function, 2233 DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function,
2265 "If this is non-nil, `read-buffer' does its work by calling this function."); 2234 "If this is non-nil, `read-buffer' does its work by calling this function.");
2266 Vread_buffer_function = Qnil; 2235 Vread_buffer_function = Qnil;
@@ -2365,6 +2334,7 @@ with completion; they always discard text properties.");
2365 defsubr (&Sminibuffer_depth); 2334 defsubr (&Sminibuffer_depth);
2366 defsubr (&Sminibuffer_prompt); 2335 defsubr (&Sminibuffer_prompt);
2367 defsubr (&Sminibuffer_prompt_width); 2336 defsubr (&Sminibuffer_prompt_width);
2337 defsubr (&Sminibuffer_prompt_end);
2368 2338
2369 defsubr (&Stry_completion); 2339 defsubr (&Stry_completion);
2370 defsubr (&Sall_completions); 2340 defsubr (&Sall_completions);