aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJuri Linkov2005-12-16 19:03:17 +0000
committerJuri Linkov2005-12-16 19:03:17 +0000
commitb5e1e44946511148e43bc80b01602f217c76e5b5 (patch)
tree2411a7856dedab8ac335b1cffc566b83cc3119c0 /src
parentec6328a24a5b7e1fb3e307b276dc8ed07f2f3816 (diff)
downloademacs-b5e1e44946511148e43bc80b01602f217c76e5b5.tar.gz
emacs-b5e1e44946511148e43bc80b01602f217c76e5b5.zip
(Fminibuffer_completion_contents): New Lisp function
created from minibuffer_completion_contents. (minibuffer_completion_contents): Remove. (do_completion, Fminibuffer_complete_word) (Fminibuffer_completion_help): Replace minibuffer_completion_contents with Fminibuffer_completion_contents. (syms_of_minibuf): Add Sminibuffer_completion_contents. (Fdisplay_completion_list): Doc fix. (display_completion_list_1): Use `nil' for second arg of `Fdisplay_completion_list'.
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 48e15c11fa8..4016d57c0c1 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -388,6 +388,19 @@ The current buffer must be a minibuffer. */)
388 return make_buffer_string (prompt_end, ZV, 0); 388 return make_buffer_string (prompt_end, ZV, 0);
389} 389}
390 390
391DEFUN ("minibuffer-completion-contents", Fminibuffer_completion_contents,
392 Sminibuffer_completion_contents, 0, 0, 0,
393 doc: /* Return the user input in a minibuffer before point as a string.
394That is what completion commands operate on.
395The current buffer must be a minibuffer. */)
396 ()
397{
398 int prompt_end = XINT (Fminibuffer_prompt_end ());
399 if (PT < prompt_end)
400 error ("Cannot do completion in the prompt");
401 return make_buffer_string (prompt_end, PT, 1);
402}
403
391DEFUN ("delete-minibuffer-contents", Fdelete_minibuffer_contents, 404DEFUN ("delete-minibuffer-contents", Fdelete_minibuffer_contents,
392 Sdelete_minibuffer_contents, 0, 0, 0, 405 Sdelete_minibuffer_contents, 0, 0, 0,
393 doc: /* Delete all user input in a minibuffer. 406 doc: /* Delete all user input in a minibuffer.
@@ -400,17 +413,6 @@ The current buffer must be a minibuffer. */)
400 return Qnil; 413 return Qnil;
401} 414}
402 415
403/* Get the text in the minibuffer before point.
404 That is what completion commands operate on. */
405
406Lisp_Object
407minibuffer_completion_contents ()
408{
409 int prompt_end = XINT (Fminibuffer_prompt_end ());
410 if (PT < prompt_end)
411 error ("Cannot do completion in the prompt");
412 return make_buffer_string (prompt_end, PT, 1);
413}
414 416
415/* Read from the minibuffer using keymap MAP and initial contents INITIAL, 417/* Read from the minibuffer using keymap MAP and initial contents INITIAL,
416 putting point minus BACKUP_N bytes from the end of INITIAL, 418 putting point minus BACKUP_N bytes from the end of INITIAL,
@@ -1899,7 +1901,7 @@ do_completion ()
1899 Lisp_Object last; 1901 Lisp_Object last;
1900 struct gcpro gcpro1, gcpro2; 1902 struct gcpro gcpro1, gcpro2;
1901 1903
1902 completion = Ftry_completion (minibuffer_completion_contents (), 1904 completion = Ftry_completion (Fminibuffer_completion_contents (),
1903 Vminibuffer_completion_table, 1905 Vminibuffer_completion_table,
1904 Vminibuffer_completion_predicate); 1906 Vminibuffer_completion_predicate);
1905 last = last_exact_completion; 1907 last = last_exact_completion;
@@ -1921,7 +1923,7 @@ do_completion ()
1921 return 1; 1923 return 1;
1922 } 1924 }
1923 1925
1924 string = minibuffer_completion_contents (); 1926 string = Fminibuffer_completion_contents ();
1925 1927
1926 /* COMPLETEDP should be true if some completion was done, which 1928 /* COMPLETEDP should be true if some completion was done, which
1927 doesn't include simply changing the case of the entered string. 1929 doesn't include simply changing the case of the entered string.
@@ -1988,7 +1990,7 @@ do_completion ()
1988 last_exact_completion = completion; 1990 last_exact_completion = completion;
1989 if (!NILP (last)) 1991 if (!NILP (last))
1990 { 1992 {
1991 tem = minibuffer_completion_contents (); 1993 tem = Fminibuffer_completion_contents ();
1992 if (!NILP (Fequal (tem, last))) 1994 if (!NILP (Fequal (tem, last)))
1993 Fminibuffer_completion_help (); 1995 Fminibuffer_completion_help ();
1994 } 1996 }
@@ -2191,7 +2193,7 @@ Return nil if there is no valid completion, else t. */)
2191 /* We keep calling Fbuffer_string rather than arrange for GC to 2193 /* We keep calling Fbuffer_string rather than arrange for GC to
2192 hold onto a pointer to one of the strings thus made. */ 2194 hold onto a pointer to one of the strings thus made. */
2193 2195
2194 completion = Ftry_completion (minibuffer_completion_contents (), 2196 completion = Ftry_completion (Fminibuffer_completion_contents (),
2195 Vminibuffer_completion_table, 2197 Vminibuffer_completion_table,
2196 Vminibuffer_completion_predicate); 2198 Vminibuffer_completion_predicate);
2197 if (NILP (completion)) 2199 if (NILP (completion))
@@ -2223,7 +2225,7 @@ Return nil if there is no valid completion, else t. */)
2223 int buffer_nchars, completion_nchars; 2225 int buffer_nchars, completion_nchars;
2224 2226
2225 CHECK_STRING (completion); 2227 CHECK_STRING (completion);
2226 tem = minibuffer_completion_contents (); 2228 tem = Fminibuffer_completion_contents ();
2227 GCPRO2 (completion, tem); 2229 GCPRO2 (completion, tem);
2228 /* If reading a file name, 2230 /* If reading a file name,
2229 expand any $ENVVAR refs in the buffer and in TEM. */ 2231 expand any $ENVVAR refs in the buffer and in TEM. */
@@ -2287,7 +2289,7 @@ Return nil if there is no valid completion, else t. */)
2287 if (i == SCHARS (completion)) 2289 if (i == SCHARS (completion))
2288 { 2290 {
2289 GCPRO1 (completion); 2291 GCPRO1 (completion);
2290 tem = Ftry_completion (concat2 (minibuffer_completion_contents (), 2292 tem = Ftry_completion (concat2 (Fminibuffer_completion_contents (),
2291 build_string (" ")), 2293 build_string (" ")),
2292 Vminibuffer_completion_table, 2294 Vminibuffer_completion_table,
2293 Vminibuffer_completion_predicate); 2295 Vminibuffer_completion_predicate);
@@ -2299,7 +2301,7 @@ Return nil if there is no valid completion, else t. */)
2299 { 2301 {
2300 GCPRO1 (completion); 2302 GCPRO1 (completion);
2301 tem = 2303 tem =
2302 Ftry_completion (concat2 (minibuffer_completion_contents (), 2304 Ftry_completion (concat2 (Fminibuffer_completion_contents (),
2303 build_string ("-")), 2305 build_string ("-")),
2304 Vminibuffer_completion_table, 2306 Vminibuffer_completion_table,
2305 Vminibuffer_completion_predicate); 2307 Vminibuffer_completion_predicate);
@@ -2371,8 +2373,8 @@ The optional second arg COMMON-SUBSTRING is a string.
2371It is used to put faces, `completions-first-difference' and 2373It is used to put faces, `completions-first-difference' and
2372`completions-common-part' on the completion buffer. The 2374`completions-common-part' on the completion buffer. The
2373`completions-common-part' face is put on the common substring 2375`completions-common-part' face is put on the common substring
2374specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil, 2376specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil
2375the faces are not put. 2377and the current buffer is not the minibuffer, the faces are not put.
2376Internally, COMMON-SUBSTRING is bound to `completion-common-substring' 2378Internally, COMMON-SUBSTRING is bound to `completion-common-substring'
2377during running `completion-setup-hook'. */) 2379during running `completion-setup-hook'. */)
2378 (completions, common_substring) 2380 (completions, common_substring)
@@ -2563,7 +2565,7 @@ static Lisp_Object
2563display_completion_list_1 (list) 2565display_completion_list_1 (list)
2564 Lisp_Object list; 2566 Lisp_Object list;
2565{ 2567{
2566 return Fdisplay_completion_list (list, minibuffer_completion_contents ()); 2568 return Fdisplay_completion_list (list, Qnil);
2567} 2569}
2568 2570
2569DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_completion_help, 2571DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_completion_help,
@@ -2574,7 +2576,7 @@ DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_co
2574 Lisp_Object completions; 2576 Lisp_Object completions;
2575 2577
2576 message ("Making completion list..."); 2578 message ("Making completion list...");
2577 completions = Fall_completions (minibuffer_completion_contents (), 2579 completions = Fall_completions (Fminibuffer_completion_contents (),
2578 Vminibuffer_completion_table, 2580 Vminibuffer_completion_table,
2579 Vminibuffer_completion_predicate, 2581 Vminibuffer_completion_predicate,
2580 Qt); 2582 Qt);
@@ -2883,6 +2885,7 @@ properties. */);
2883 defsubr (&Sminibuffer_prompt_end); 2885 defsubr (&Sminibuffer_prompt_end);
2884 defsubr (&Sminibuffer_contents); 2886 defsubr (&Sminibuffer_contents);
2885 defsubr (&Sminibuffer_contents_no_properties); 2887 defsubr (&Sminibuffer_contents_no_properties);
2888 defsubr (&Sminibuffer_completion_contents);
2886 defsubr (&Sdelete_minibuffer_contents); 2889 defsubr (&Sdelete_minibuffer_contents);
2887 2890
2888 defsubr (&Stry_completion); 2891 defsubr (&Stry_completion);