comparison src/minibuf.c @ 18444:825ff9e2e44e

(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.
author Richard M. Stallman <rms@gnu.org>
date Wed, 25 Jun 1997 05:45:46 +0000
parents f1625c2d3db9
children 2b1d3330e750
comparison
equal deleted inserted replaced
18443:393843d18bec 18444:825ff9e2e44e
58 58
59 /* Nonzero means let functions called when within a minibuffer 59 /* Nonzero means let functions called when within a minibuffer
60 invoke recursive minibuffers (to read arguments, or whatever) */ 60 invoke recursive minibuffers (to read arguments, or whatever) */
61 int enable_recursive_minibuffers; 61 int enable_recursive_minibuffers;
62 62
63 /* Nonzero means don't ignore text properties
64 in Fread_from_minibuffer. */
65 int 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
65 Lisp_Object Vminibuffer_help_form; 69 Lisp_Object Vminibuffer_help_form;
66 70
67 /* Variable which is the history list to add minibuffer values to. */ 71 /* Variable which is the history list to add minibuffer values to. */
177 but if EXPFLAG is nonzero, read it and return the object read. 181 but if EXPFLAG is nonzero, read it and return the object read.
178 If HISTVAR is given, save the value read on that history only if it doesn't 182 If HISTVAR is given, save the value read on that history only if it doesn't
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
184 static Lisp_Object 190 static Lisp_Object
185 read_minibuf (map, initial, prompt, backup_n, expflag, 191 read_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;
190 Lisp_Object backup_n; 196 Lisp_Object backup_n;
191 int expflag; 197 int expflag;
360 FRAME_CURSOR_X (selected_frame) 366 FRAME_CURSOR_X (selected_frame)
361 = FRAME_LEFT_SCROLL_BAR_WIDTH (selected_frame); 367 = FRAME_LEFT_SCROLL_BAR_WIDTH (selected_frame);
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
371 377
372 /* VAL is the string of minibuffer text. */ 378 /* VAL is the string of minibuffer text. */
568 which INITIAL-CONTENTS corresponds to).\n\ 574 which INITIAL-CONTENTS corresponds to).\n\
569 Positions are counted starting from 1 at the beginning of the list.\n\ 575 Positions are counted starting from 1 at the beginning of the list.\n\
570 Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is used\n\ 576 Sixth 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 */ 579 If 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
575 DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 6, 0, 583 DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 1, 6, 0,
576 0 /* See immediately above */) 584 0 /* See immediately above */)
577 (prompt, initial_contents, keymap, read, hist, default_value) 585 (prompt, initial_contents, keymap, read, hist, default_value)
578 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value; 586 Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
625 XSETFASTINT (histpos, 0); 633 XSETFASTINT (histpos, 0);
626 634
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;
634 return val; 643 return val;
635 } 644 }
644 CHECK_STRING (prompt, 0); 653 CHECK_STRING (prompt, 0);
645 if (!NILP (initial_contents)) 654 if (!NILP (initial_contents))
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
652 DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, 661 DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
653 "Return value of Lisp expression read using the minibuffer.\n\ 662 "Return value of Lisp expression read using the minibuffer.\n\
654 Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS\n\ 663 Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS\n\
683 CHECK_STRING (prompt, 0); 692 CHECK_STRING (prompt, 0);
684 if (! NILP (init)) 693 if (! NILP (init))
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
691 DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0, 700 DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
692 "Read the name of a command and return as a symbol.\n\ 701 "Read the name of a command and return as a symbol.\n\
693 Prompts with PROMPT. By default, return DEFAULT-VALUE.") 702 Prompts with PROMPT. By default, return DEFAULT-VALUE.")
1188 1197
1189 val = read_minibuf (NILP (require_match) 1198 val = read_minibuf (NILP (require_match)
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);
1197 } 1206 }
1198 1207
1981 1990
1982 DEFVAR_LISP ("completion-regexp-list", &Vcompletion_regexp_list, 1991 DEFVAR_LISP ("completion-regexp-list", &Vcompletion_regexp_list,
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\
1998 This 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\
2000 with 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);
1989 defsubr (&Sread_minibuffer); 2006 defsubr (&Sread_minibuffer);
1990 defsubr (&Sread_string); 2007 defsubr (&Sread_string);