X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/ecb21060d5c1752d41d7a742be565c59b5fcb855..0e2501ed344f5c8e251bcdca981f5d81dd78f663:/src/minibuf.c diff --git a/src/minibuf.c b/src/minibuf.c index 74220d0c7c..86dd095fa2 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -1,7 +1,7 @@ /* Minibuffer input and completion. Copyright (C) 1985, 1986, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, - 2006, 2007 Free Software Foundation, Inc. + 2006, 2007, 2008 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -35,6 +35,7 @@ Boston, MA 02110-1301, USA. */ #include "syntax.h" #include "intervals.h" #include "keymap.h" +#include "termhooks.h" extern int quit_char; @@ -117,6 +118,7 @@ Lisp_Object Vread_buffer_function; /* Nonzero means completion ignores case. */ int completion_ignore_case; +Lisp_Object Qcompletion_ignore_case; /* List of regexps that should restrict possible completions. */ @@ -255,9 +257,13 @@ string_to_object (val, defalt) GCPRO2 (val, defalt); - if (STRINGP (val) && SCHARS (val) == 0 - && STRINGP (defalt)) - val = defalt; + if (STRINGP (val) && SCHARS (val) == 0) + { + if (STRINGP (defalt)) + val = defalt; + else if (CONSP (defalt) && STRINGP (XCAR (defalt))) + val = XCAR (defalt); + } expr_and_pos = Fread_from_string (val, Qnil, Qnil); pos = XINT (Fcdr (expr_and_pos)); @@ -335,7 +341,7 @@ read_minibuf_noninteractive (map, initial, prompt, backup_n, expflag, /* If Lisp form desired instead of string, parse it. */ if (expflag) - val = string_to_object (val, defalt); + val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt); return val; } @@ -491,7 +497,6 @@ read_minibuf (map, initial, prompt, backup_n, expflag, if (EQ (Vminibuffer_completing_file_name, Qlambda)) Vminibuffer_completing_file_name = Qnil; - single_kboard_state (); #ifdef HAVE_X_WINDOWS if (display_hourglass_p) cancel_hourglass (); @@ -575,6 +580,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, if (minibuffer_auto_raise) Fraise_frame (mini_frame); + temporarily_switch_to_single_kboard (XFRAME (mini_frame)); + /* We have to do this after saving the window configuration since that is what restores the current buffer. */ @@ -758,8 +765,12 @@ read_minibuf (map, initial, prompt, backup_n, expflag, XWINDOW (minibuf_window)->cursor.x = 0; XWINDOW (minibuf_window)->must_be_updated_p = 1; update_frame (XFRAME (selected_frame), 1, 1); - if (rif && rif->flush_display) - rif->flush_display (XFRAME (XWINDOW (minibuf_window)->frame)); + { + struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame); + struct redisplay_interface *rif = FRAME_RIF (f); + if (rif && rif->flush_display) + rif->flush_display (f); + } } /* Make minibuffer contents into a string. */ @@ -778,6 +789,8 @@ read_minibuf (map, initial, prompt, backup_n, expflag, histstring = val; else if (STRINGP (defalt)) histstring = defalt; + else if (CONSP (defalt) && STRINGP (XCAR (defalt))) + histstring = XCAR (defalt); else histstring = Qnil; @@ -1045,8 +1058,8 @@ DEFUN ("read-minibuffer", Fread_minibuffer, Sread_minibuffer, 1, 2, 0, doc: /* Return a Lisp object read using the minibuffer, unevaluated. Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS is a string to insert in the minibuffer before reading. -\(INITIAL-CONTENTS can also be a cons of a string and an integer. Such -arguments are used as in `read-from-minibuffer'.) */) +\(INITIAL-CONTENTS can also be a cons of a string and an integer. +Such arguments are used as in `read-from-minibuffer'.) */) (prompt, initial_contents) Lisp_Object prompt, initial_contents; { @@ -1060,8 +1073,8 @@ DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0, doc: /* Return value of Lisp expression read using the minibuffer. Prompt with PROMPT. If non-nil, optional second arg INITIAL-CONTENTS is a string to insert in the minibuffer before reading. -\(INITIAL-CONTENTS can also be a cons of a string and an integer. Such -arguments are used as in `read-from-minibuffer'.) */) +\(INITIAL-CONTENTS can also be a cons of a string and an integer. +Such arguments are used as in `read-from-minibuffer'.) */) (prompt, initial_contents) Lisp_Object prompt, initial_contents; { @@ -1095,7 +1108,7 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits Qnil, history, default_value, inherit_input_method); if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value)) - val = default_value; + val = CONSP (default_value) ? XCAR (default_value) : default_value; return val; } @@ -1218,7 +1231,7 @@ The argument PROMPT should be a string ending with a colon and a space. */) args[0] = build_string ("%s (default %s): "); args[1] = prompt; - args[2] = def; + args[2] = CONSP (def) ? XCAR (def) : def; prompt = Fformat (3, args); } @@ -1828,7 +1841,7 @@ Completion ignores case if the ambient value of !NILP (inherit_input_method)); if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) - val = def; + val = CONSP (def) ? XCAR (def) : def; RETURN_UNGCPRO (unbind_to (count, val)); } @@ -2103,10 +2116,10 @@ string rather than a cons cell whose car is a string. */) if (SYMBOLP (key)) key = Fsymbol_name (key); - for (tail = list; !NILP (tail); tail = Fcdr (tail)) + for (tail = list; CONSP (tail); tail = XCDR (tail)) { register Lisp_Object elt, tem, thiscar; - elt = Fcar (tail); + elt = XCAR (tail); thiscar = CONSP (elt) ? XCAR (elt) : elt; if (SYMBOLP (thiscar)) thiscar = Fsymbol_name (thiscar); @@ -2816,6 +2829,9 @@ syms_of_minibuf () minibuf_save_list = Qnil; staticpro (&minibuf_save_list); + Qcompletion_ignore_case = intern ("completion-ignore-case"); + staticpro (&Qcompletion_ignore_case); + Qread_file_name_internal = intern ("read-file-name-internal"); staticpro (&Qread_file_name_internal);