aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-25 05:45:46 +0000
committerRichard M. Stallman1997-06-25 05:45:46 +0000
commitc3421833c80f6d101193741493db35c51f0c280f (patch)
tree8550b500f5228f53f9ce45fac2fb5ea8a09e8e39 /src
parent937ab68f833ac77bf7d78e2803dc6b79001703f8 (diff)
downloademacs-c3421833c80f6d101193741493db35c51f0c280f.tar.gz
emacs-c3421833c80f6d101193741493db35c51f0c280f.zip
(read_minibuf): New arg allow_props.
If it is 0, discard text properties from the result. Callers changed. (minibuffer_allow_text_properties): New variable. (Fread_from_minibuffer): That variable controls allow_props arg. (syms_of_minibuf): Set up Lisp var.
Diffstat (limited to 'src')
-rw-r--r--src/minibuf.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index b8c44e23447..c518f5243c2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -60,6 +60,10 @@ Lisp_Object last_minibuf_string;
60 invoke recursive minibuffers (to read arguments, or whatever) */ 60 invoke recursive minibuffers (to read arguments, or whatever) */
61int enable_recursive_minibuffers; 61int enable_recursive_minibuffers;
62 62
63/* Nonzero means don't ignore text properties
64 in Fread_from_minibuffer. */
65int minibuffer_allow_text_properties;
66
63/* help-form is bound to this while in the minibuffer. */ 67/* help-form is bound to this while in the minibuffer. */
64 68
65Lisp_Object Vminibuffer_help_form; 69Lisp_Object Vminibuffer_help_form;
@@ -179,11 +183,13 @@ static Lisp_Object read_minibuf ();
179 match the front of that history list exactly. The value is pushed onto 183 match the front of that history list exactly. The value is pushed onto
180 the list as the string that was read. 184 the list as the string that was read.
181 185
182 DEFALT specifies te default value for the sake of history commands. */ 186 DEFALT specifies te default value for the sake of history commands.
187
188 If ALLOW_PROPS is nonzero, we do not throw away text properties. */
183 189
184static Lisp_Object 190static Lisp_Object
185read_minibuf (map, initial, prompt, backup_n, expflag, 191read_minibuf (map, initial, prompt, backup_n, expflag,
186 histvar, histpos, defalt) 192 histvar, histpos, defalt, allow_props)
187 Lisp_Object map; 193 Lisp_Object map;
188 Lisp_Object initial; 194 Lisp_Object initial;
189 Lisp_Object prompt; 195 Lisp_Object prompt;
@@ -362,9 +368,9 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
362 update_frame (selected_frame, 1, 1); 368 update_frame (selected_frame, 1, 1);
363 } 369 }
364 370
365 /* Make minibuffer contents into a string */ 371 /* Make minibuffer contents into a string. */
366 Fset_buffer (minibuffer); 372 Fset_buffer (minibuffer);
367 val = make_buffer_string (1, Z, 1); 373 val = make_buffer_string (1, Z, allow_props);
368#if 0 /* make_buffer_string should handle the gap. */ 374#if 0 /* make_buffer_string should handle the gap. */
369 bcopy (GAP_END_ADDR, XSTRING (val)->data + GPT - BEG, Z - GPT); 375 bcopy (GAP_END_ADDR, XSTRING (val)->data + GPT - BEG, Z - GPT);
370#endif 376#endif
@@ -570,7 +576,9 @@ Fifth arg HIST, if non-nil, specifies a history list\n\
570Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is used\n\ 576Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is used\n\
571 for history commands, and as the value to return if the user enters\n\ 577 for history commands, and as the value to return if the user enters\n\
572 the empty string.\n\ 578 the empty string.\n\
573*/ 579If the variable `minibuffer-allow-text-properties is non-nil,\n\
580 then the string which is returned includes whatever text properties\n\
581 were present in the minibuffer. Otherwise the value has no text properties. */
574 582
575DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 6, 0, 583DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 6, 0,
576 0 /* See immediately above */) 584 0 /* See immediately above */)
@@ -627,7 +635,8 @@ DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1,
627 GCPRO1 (default_value); 635 GCPRO1 (default_value);
628 val = read_minibuf (keymap, initial_contents, prompt, 636 val = read_minibuf (keymap, initial_contents, prompt,
629 make_number (pos), !NILP (read), 637 make_number (pos), !NILP (read),
630 histvar, histpos, default_value); 638 histvar, histpos, default_value,
639 minibuffer_allow_text_properties);
631 if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (default_value)) 640 if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (default_value))
632 val = default_value; 641 val = default_value;
633 UNGCPRO; 642 UNGCPRO;
@@ -646,7 +655,7 @@ is a string to insert in the minibuffer before reading.")
646 CHECK_STRING (initial_contents, 1); 655 CHECK_STRING (initial_contents, 1);
647 return read_minibuf (Vminibuffer_local_map, initial_contents, 656 return read_minibuf (Vminibuffer_local_map, initial_contents,
648 prompt, Qnil, 1, Qminibuffer_history, 657 prompt, Qnil, 1, Qminibuffer_history,
649 make_number (0), Qnil); 658 make_number (0), Qnil, 0);
650} 659}
651 660
652DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, 661DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
@@ -685,7 +694,7 @@ Prompt with PROMPT, and provide INIT as an initial value of the input string.")
685 CHECK_STRING (init, 1); 694 CHECK_STRING (init, 1);
686 695
687 return read_minibuf (Vminibuffer_local_ns_map, init, prompt, Qnil, 696 return read_minibuf (Vminibuffer_local_ns_map, init, prompt, Qnil,
688 0, Qminibuffer_history, make_number (0), Qnil); 697 0, Qminibuffer_history, make_number (0), Qnil, 0);
689} 698}
690 699
691DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, 700DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
@@ -1190,7 +1199,7 @@ DEFUN ("completing-read", Fcompleting_read, Scompleting_read, 2, 7, 0,
1190 ? Vminibuffer_local_completion_map 1199 ? Vminibuffer_local_completion_map
1191 : Vminibuffer_local_must_match_map, 1200 : Vminibuffer_local_must_match_map,
1192 init, prompt, make_number (pos), 0, 1201 init, prompt, make_number (pos), 0,
1193 histvar, histpos, def); 1202 histvar, histpos, def, 0);
1194 if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (def)) 1203 if (STRINGP (val) && XSTRING (val)->size == 0 && ! NILP (def))
1195 val = def; 1204 val = def;
1196 return unbind_to (count, val); 1205 return unbind_to (count, val);
@@ -1983,6 +1992,14 @@ Some uses of the echo area also raise that frame (since they use it too).");
1983 "List of regexps that should restrict possible completions."); 1992 "List of regexps that should restrict possible completions.");
1984 Vcompletion_regexp_list = Qnil; 1993 Vcompletion_regexp_list = Qnil;
1985 1994
1995 DEFVAR_BOOL ("minibuffer-allow-text-properties",
1996 &minibuffer_allow_text_properties,
1997 "Non-nil means `read-from-miniffer' should not discard text properties.\n\
1998This also affects `read-string', but it does not affect `read-minibuffer',\n\
1999`read-no-blanks-input', or any of the functions that do minibuffer input\n\
2000with completion; they always discard text properties.")
2001 minibuffer_allow_text_properties = 0;
2002
1986 defsubr (&Sset_minibuffer_window); 2003 defsubr (&Sset_minibuffer_window);
1987 defsubr (&Sread_from_minibuffer); 2004 defsubr (&Sread_from_minibuffer);
1988 defsubr (&Seval_minibuffer); 2005 defsubr (&Seval_minibuffer);