Mercurial > emacs
comparison src/minibuf.c @ 83556:07774e5c3ff5
Merged from emacs@sv.gnu.org
Patches applied:
* emacs@sv.gnu.org/emacs--devo--0--patch-619
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-620
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-621
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-622
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-623
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-624
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-625
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-626
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-627
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-628
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-629
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-630
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-631
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-632
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-633
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-634
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-635
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-636
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-637
Remove RCS keywords
* emacs@sv.gnu.org/emacs--devo--0--patch-638
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-639
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-640
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-641
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-642
Merge from gnus--rel--5.10
* emacs@sv.gnu.org/emacs--devo--0--patch-643
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-644
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-645
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-646
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-647
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-648
Update from CVS
* emacs@sv.gnu.org/emacs--devo--0--patch-649
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-197
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-198
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-199
Update from CVS
* emacs@sv.gnu.org/gnus--rel--5.10--patch-200
Merge from emacs--devo--0
* emacs@sv.gnu.org/gnus--rel--5.10--patch-201
Update from CVS: lisp/nnweb.el (nnweb-google-parse-1): Update parser.
* emacs@sv.gnu.org/gnus--rel--5.10--patch-202
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-596
author | Karoly Lorentey <karoly@lorentey.hu> |
---|---|
date | Sat, 24 Feb 2007 19:26:54 +0000 |
parents | b8d9a391daf3 c76aa2fa987a |
children | 738ce3540ffb |
comparison
equal
deleted
inserted
replaced
83555:053bf1a38bfa | 83556:07774e5c3ff5 |
---|---|
133 | 133 |
134 static Lisp_Object last_exact_completion; | 134 static Lisp_Object last_exact_completion; |
135 | 135 |
136 /* Keymap for reading expressions. */ | 136 /* Keymap for reading expressions. */ |
137 Lisp_Object Vread_expression_map; | 137 Lisp_Object Vread_expression_map; |
138 | |
139 Lisp_Object Vminibuffer_completion_table, Qminibuffer_completion_table; | |
140 Lisp_Object Vminibuffer_completion_predicate, Qminibuffer_completion_predicate; | |
141 Lisp_Object Vminibuffer_completion_confirm, Qminibuffer_completion_confirm; | |
142 Lisp_Object Vminibuffer_completing_file_name; | |
138 | 143 |
139 Lisp_Object Quser_variable_p; | 144 Lisp_Object Quser_variable_p; |
140 | 145 |
141 Lisp_Object Qminibuffer_default; | 146 Lisp_Object Qminibuffer_default; |
142 | 147 |
466 int count = SPECPDL_INDEX (); | 471 int count = SPECPDL_INDEX (); |
467 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; | 472 Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; |
468 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 473 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
469 Lisp_Object enable_multibyte; | 474 Lisp_Object enable_multibyte; |
470 int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0; | 475 int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0; |
471 | |
472 /* String to add to the history. */ | 476 /* String to add to the history. */ |
473 Lisp_Object histstring; | 477 Lisp_Object histstring; |
474 | 478 |
475 Lisp_Object empty_minibuf; | 479 Lisp_Object empty_minibuf; |
476 Lisp_Object dummy, frame; | 480 Lisp_Object dummy, frame; |
477 | 481 |
478 extern Lisp_Object Qfront_sticky; | 482 extern Lisp_Object Qfront_sticky; |
479 extern Lisp_Object Qrear_nonsticky; | 483 extern Lisp_Object Qrear_nonsticky; |
480 | 484 |
481 specbind (Qminibuffer_default, defalt); | 485 specbind (Qminibuffer_default, defalt); |
486 | |
487 /* If Vminibuffer_completing_file_name is `lambda' on entry, it was t | |
488 in previous recursive minibuffer, but was not set explicitly | |
489 to t for this invocation, so set it to nil in this minibuffer. | |
490 Save the old value now, before we change it. */ | |
491 specbind (intern ("minibuffer-completing-file-name"), Vminibuffer_completing_file_name); | |
492 if (EQ (Vminibuffer_completing_file_name, Qlambda)) | |
493 Vminibuffer_completing_file_name = Qnil; | |
482 | 494 |
483 #ifdef HAVE_X_WINDOWS | 495 #ifdef HAVE_X_WINDOWS |
484 if (display_hourglass_p) | 496 if (display_hourglass_p) |
485 cancel_hourglass (); | 497 cancel_hourglass (); |
486 #endif | 498 #endif |
571 /* Arrange to restore a number of minibuffer-related variables. | 583 /* Arrange to restore a number of minibuffer-related variables. |
572 We could bind each variable separately, but that would use lots of | 584 We could bind each variable separately, but that would use lots of |
573 specpdl slots. */ | 585 specpdl slots. */ |
574 minibuf_save_list | 586 minibuf_save_list |
575 = Fcons (Voverriding_local_map, | 587 = Fcons (Voverriding_local_map, |
576 Fcons (minibuf_window, minibuf_save_list)); | 588 Fcons (minibuf_window, |
589 minibuf_save_list)); | |
577 minibuf_save_list | 590 minibuf_save_list |
578 = Fcons (minibuf_prompt, | 591 = Fcons (minibuf_prompt, |
579 Fcons (make_number (minibuf_prompt_width), | 592 Fcons (make_number (minibuf_prompt_width), |
580 Fcons (Vhelp_form, | 593 Fcons (Vhelp_form, |
581 Fcons (Vcurrent_prefix_arg, | 594 Fcons (Vcurrent_prefix_arg, |
597 minibuf_prompt_width = 0; | 610 minibuf_prompt_width = 0; |
598 minibuf_prompt = Fcopy_sequence (prompt); | 611 minibuf_prompt = Fcopy_sequence (prompt); |
599 Vminibuffer_history_position = histpos; | 612 Vminibuffer_history_position = histpos; |
600 Vminibuffer_history_variable = histvar; | 613 Vminibuffer_history_variable = histvar; |
601 Vhelp_form = Vminibuffer_help_form; | 614 Vhelp_form = Vminibuffer_help_form; |
615 /* If this minibuffer is reading a file name, that doesn't mean | |
616 recursive ones are. But we cannot set it to nil, because | |
617 completion code still need to know the minibuffer is completing a | |
618 file name. So use `lambda' as intermediate value meaning | |
619 "t" in this minibuffer, but "nil" in next minibuffer. */ | |
620 if (!NILP (Vminibuffer_completing_file_name)) | |
621 Vminibuffer_completing_file_name = Qlambda; | |
602 | 622 |
603 if (inherit_input_method) | 623 if (inherit_input_method) |
604 { | 624 { |
605 /* `current-input-method' is buffer local. So, remember it in | 625 /* `current-input-method' is buffer local. So, remember it in |
606 INPUT_METHOD before changing the current buffer. */ | 626 INPUT_METHOD before changing the current buffer. */ |
1688 } | 1708 } |
1689 | 1709 |
1690 return Fnreverse (allmatches); | 1710 return Fnreverse (allmatches); |
1691 } | 1711 } |
1692 | 1712 |
1693 Lisp_Object Vminibuffer_completion_table, Qminibuffer_completion_table; | |
1694 Lisp_Object Vminibuffer_completion_predicate, Qminibuffer_completion_predicate; | |
1695 Lisp_Object Vminibuffer_completion_confirm, Qminibuffer_completion_confirm; | |
1696 Lisp_Object Vminibuffer_completing_file_name; | |
1697 | |
1698 DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, | 1713 DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 8, 0, |
1699 doc: /* Read a string in the minibuffer, with completion. | 1714 doc: /* Read a string in the minibuffer, with completion. |
1700 PROMPT is a string to prompt with; normally it ends in a colon and a space. | 1715 PROMPT is a string to prompt with; normally it ends in a colon and a space. |
1701 COLLECTION can be a list of strings, an alist, an obarray or a hash table. | 1716 COLLECTION can be a list of strings, an alist, an obarray or a hash table. |
1702 COLLECTION can also be a function to do the completion itself. | 1717 COLLECTION can also be a function to do the completion itself. |
1790 if (NILP (histpos)) | 1805 if (NILP (histpos)) |
1791 XSETFASTINT (histpos, 0); | 1806 XSETFASTINT (histpos, 0); |
1792 | 1807 |
1793 val = read_minibuf (NILP (require_match) | 1808 val = read_minibuf (NILP (require_match) |
1794 ? (NILP (Vminibuffer_completing_file_name) | 1809 ? (NILP (Vminibuffer_completing_file_name) |
1810 || EQ (Vminibuffer_completing_file_name, Qlambda) | |
1795 ? Vminibuffer_local_completion_map | 1811 ? Vminibuffer_local_completion_map |
1796 : Vminibuffer_local_filename_completion_map) | 1812 : Vminibuffer_local_filename_completion_map) |
1797 : (NILP (Vminibuffer_completing_file_name) | 1813 : (NILP (Vminibuffer_completing_file_name) |
1814 || EQ (Vminibuffer_completing_file_name, Qlambda) | |
1798 ? Vminibuffer_local_must_match_map | 1815 ? Vminibuffer_local_must_match_map |
1799 : Vminibuffer_local_must_match_filename_map), | 1816 : Vminibuffer_local_must_match_filename_map), |
1800 init, prompt, make_number (pos), 0, | 1817 init, prompt, make_number (pos), 0, |
1801 histvar, histpos, def, 0, | 1818 histvar, histpos, def, 0, |
1802 !NILP (inherit_input_method)); | 1819 !NILP (inherit_input_method)); |
2060 } | 2077 } |
2061 | 2078 |
2062 /* Like assoc but assumes KEY is a string, and ignores case if appropriate. */ | 2079 /* Like assoc but assumes KEY is a string, and ignores case if appropriate. */ |
2063 | 2080 |
2064 DEFUN ("assoc-string", Fassoc_string, Sassoc_string, 2, 3, 0, | 2081 DEFUN ("assoc-string", Fassoc_string, Sassoc_string, 2, 3, 0, |
2065 doc: /* Like `assoc' but specifically for strings. | 2082 doc: /* Like `assoc' but specifically for strings (and symbols). |
2066 Unibyte strings are converted to multibyte for comparison. | 2083 Symbols are converted to strings, and unibyte strings are converted to |
2067 And case is ignored if CASE-FOLD is non-nil. | 2084 multibyte for comparison. |
2085 Case is ignored if optional arg CASE-FOLD is non-nil. | |
2068 As opposed to `assoc', it will also match an entry consisting of a single | 2086 As opposed to `assoc', it will also match an entry consisting of a single |
2069 string rather than a cons cell whose car is a string. */) | 2087 string rather than a cons cell whose car is a string. */) |
2070 (key, list, case_fold) | 2088 (key, list, case_fold) |
2071 register Lisp_Object key; | 2089 register Lisp_Object key; |
2072 Lisp_Object list, case_fold; | 2090 Lisp_Object list, case_fold; |
2073 { | 2091 { |
2074 register Lisp_Object tail; | 2092 register Lisp_Object tail; |
2075 | 2093 |
2094 if (SYMBOLP (key)) | |
2095 key = Fsymbol_name (key); | |
2096 | |
2076 for (tail = list; !NILP (tail); tail = Fcdr (tail)) | 2097 for (tail = list; !NILP (tail); tail = Fcdr (tail)) |
2077 { | 2098 { |
2078 register Lisp_Object elt, tem, thiscar; | 2099 register Lisp_Object elt, tem, thiscar; |
2079 elt = Fcar (tail); | 2100 elt = Fcar (tail); |
2080 thiscar = CONSP (elt) ? XCAR (elt) : elt; | 2101 thiscar = CONSP (elt) ? XCAR (elt) : elt; |
2081 if (!STRINGP (thiscar)) | 2102 if (SYMBOLP (thiscar)) |
2103 thiscar = Fsymbol_name (thiscar); | |
2104 else if (!STRINGP (thiscar)) | |
2082 continue; | 2105 continue; |
2083 tem = Fcompare_strings (thiscar, make_number (0), Qnil, | 2106 tem = Fcompare_strings (thiscar, make_number (0), Qnil, |
2084 key, make_number (0), Qnil, | 2107 key, make_number (0), Qnil, |
2085 case_fold); | 2108 case_fold); |
2086 if (EQ (tem, Qt)) | 2109 if (EQ (tem, Qt)) |
2907 doc: /* Non-nil means to demand confirmation of completion before exiting minibuffer. */); | 2930 doc: /* Non-nil means to demand confirmation of completion before exiting minibuffer. */); |
2908 Vminibuffer_completion_confirm = Qnil; | 2931 Vminibuffer_completion_confirm = Qnil; |
2909 | 2932 |
2910 DEFVAR_LISP ("minibuffer-completing-file-name", | 2933 DEFVAR_LISP ("minibuffer-completing-file-name", |
2911 &Vminibuffer_completing_file_name, | 2934 &Vminibuffer_completing_file_name, |
2912 doc: /* Non-nil means completing file names. */); | 2935 doc: /* Non-nil and non-`lambda' means completing file names. */); |
2913 Vminibuffer_completing_file_name = Qnil; | 2936 Vminibuffer_completing_file_name = Qnil; |
2914 | 2937 |
2915 DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form, | 2938 DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form, |
2916 doc: /* Value that `help-form' takes on inside the minibuffer. */); | 2939 doc: /* Value that `help-form' takes on inside the minibuffer. */); |
2917 Vminibuffer_help_form = Qnil; | 2940 Vminibuffer_help_form = Qnil; |