]> code.delx.au - gnu-emacs/blobdiff - src/minibuf.c
Add 2010 to copyright years.
[gnu-emacs] / src / minibuf.c
index 5cd821e51791a1bee6be15d836d5c9a9b78f824d..ad81bfdd0b493c3477880068c18bfba8fb4ed71a 100644 (file)
@@ -1,14 +1,14 @@
 /* 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.
+   Copyright (C) 1985, 1986, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+                 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+                 2008, 2009, 2010  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
-GNU Emacs is free software; you can redistribute it and/or modify
+GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3, or (at your option)
-any later version.
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,18 +16,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 #include <config.h>
 #include <stdio.h>
+#include <setjmp.h>
 
 #include "lisp.h"
 #include "commands.h"
 #include "buffer.h"
-#include "charset.h"
+#include "character.h"
 #include "dispextern.h"
 #include "keyboard.h"
 #include "frame.h"
@@ -55,10 +54,6 @@ Lisp_Object minibuf_save_list;
 
 int minibuf_level;
 
-/* Nonzero means display completion help for invalid input.  */
-
-Lisp_Object Vcompletion_auto_help;
-
 /* The maximum length of a minibuffer history.  */
 
 Lisp_Object Qhistory_length, Vhistory_length;
@@ -119,6 +114,7 @@ Lisp_Object Vread_buffer_function;
 
 int completion_ignore_case;
 Lisp_Object Qcompletion_ignore_case;
+int read_buffer_completion_ignore_case;
 
 /* List of regexps that should restrict possible completions.  */
 
@@ -129,11 +125,6 @@ Lisp_Object Vcompletion_regexp_list;
 
 int minibuffer_auto_raise;
 
-/* If last completion attempt reported "Complete but not unique"
-   then this is the string completed then; otherwise this is nil.  */
-
-static Lisp_Object last_exact_completion;
-
 /* Keymap for reading expressions.  */
 Lisp_Object Vread_expression_map;
 
@@ -197,7 +188,7 @@ choose_minibuf_frame ()
       if (MINI_WINDOW_P (XWINDOW (FRAME_SELECTED_WINDOW (XFRAME (frame))))
          && !(EQ (frame, selected_frame)
               && minibuf_level > 0))
-       Fset_frame_selected_window (frame, Fframe_first_window (frame));
+       Fset_frame_selected_window (frame, Fframe_first_window (frame), Qnil);
   }
 }
 
@@ -422,18 +413,6 @@ If the current buffer is not a minibuffer, return its entire contents.  */)
   return make_buffer_string (prompt_end, PT, 1);
 }
 
-DEFUN ("delete-minibuffer-contents", Fdelete_minibuffer_contents,
-       Sdelete_minibuffer_contents, 0, 0, 0,
-       doc: /* Delete all user input in a minibuffer.
-If the current buffer is not a minibuffer, erase its entire contents.  */)
-     ()
-{
-  int prompt_end = XINT (Fminibuffer_prompt_end ());
-  if (prompt_end < ZV)
-    del_range (prompt_end, ZV);
-  return Qnil;
-}
-
 \f
 /* Read from the minibuffer using keymap MAP and initial contents INITIAL,
    putting point minus BACKUP_N bytes from the end of INITIAL,
@@ -497,7 +476,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
   if (EQ (Vminibuffer_completing_file_name, Qlambda))
     Vminibuffer_completing_file_name = Qnil;
 
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
   if (display_hourglass_p)
     cancel_hourglass ();
 #endif
@@ -547,7 +526,11 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
                build_string ("Command attempted to use minibuffer while in minibuffer"));
     }
 
-  if (noninteractive && NILP (Vexecuting_kbd_macro))
+  if ((noninteractive
+       /* In case we are running as a daemon, only do this before
+         detaching from the terminal.  */
+       || (IS_DAEMON && (daemon_pipe[1] >= 0)))
+      && NILP (Vexecuting_kbd_macro))
     {
       val = read_minibuf_noninteractive (map, initial, prompt,
                                         make_number (pos),
@@ -804,10 +787,10 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
       Lisp_Object histval;
 
       /* If variable is unbound, make it nil.  */
-      if (EQ (SYMBOL_VALUE (Vminibuffer_history_variable), Qunbound))
-       Fset (Vminibuffer_history_variable, Qnil);
 
-      histval = Fsymbol_value (Vminibuffer_history_variable);
+      histval = find_symbol_value (Vminibuffer_history_variable);
+      if (EQ (histval, Qunbound))
+       Fset (Vminibuffer_history_variable, Qnil);
 
       /* The value of the history variable must be a cons or nil.  Other
         values are unacceptable.  We silently ignore these values.  */
@@ -995,10 +978,12 @@ Fifth arg HIST, if non-nil, specifies a history list and optionally
   history commands.  For consistency, you should also specify that
   element of the history as the value of INITIAL-CONTENTS.  Positions
   are counted starting from 1 at the beginning of the list.
-Sixth arg DEFAULT-VALUE is the default value.  If non-nil, it is available
-  for history commands; but, unless READ is non-nil, `read-from-minibuffer'
-  does NOT return DEFAULT-VALUE if the user enters empty input!  It returns
-  the empty string.
+Sixth arg DEFAULT-VALUE is the default value or the list of default values.
+  If non-nil, it is available for history commands, and as the value
+  (or the first element of the list of default values) to return
+  if the user enters the empty string.  But, unless READ is non-nil,
+  `read-from-minibuffer' does NOT return DEFAULT-VALUE if the user enters
+  empty input!  It returns the empty string.
 Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
  the current input method and the setting of `enable-multibyte-characters'.
 If the variable `minibuffer-allow-text-properties' is non-nil,
@@ -1094,9 +1079,10 @@ If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
 The third arg HISTORY, if non-nil, specifies a history list
   and optionally the initial position in the list.
 See `read-from-minibuffer' for details of HISTORY argument.
-Fourth arg DEFAULT-VALUE is the default value.  If non-nil, it is used
- for history commands, and as the value to return if the user enters
- the empty string.
+Fourth arg DEFAULT-VALUE is the default value or the list of default values.
+ If non-nil, it is used for history commands, and as the value (or the first
+ element of the list of default values) to return if the user enters the
+ empty string.
 Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
  the current input method and the setting of `enable-multibyte-characters'.  */)
      (prompt, initial_input, history, default_value, inherit_input_method)
@@ -1133,7 +1119,8 @@ the current input method and the setting of`enable-multibyte-characters'.  */)
 
 DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
        doc: /* Read the name of a command and return as a symbol.
-Prompt with PROMPT.  By default, return DEFAULT-VALUE.  */)
+Prompt with PROMPT.  By default, return DEFAULT-VALUE or its first element
+if it is a list.  */)
      (prompt, default_value)
      Lisp_Object prompt, default_value;
 {
@@ -1167,7 +1154,8 @@ Prompt with PROMPT.  */)
 
 DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
        doc: /* Read the name of a user variable and return it as a symbol.
-Prompt with PROMPT.  By default, return DEFAULT-VALUE.
+Prompt with PROMPT.  By default, return DEFAULT-VALUE or its first element
+if it is a list.
 A user variable is one for which `user-variable-p' returns non-nil.  */)
      (prompt, default_value)
      Lisp_Object prompt, default_value;
@@ -1193,19 +1181,29 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0,
        doc: /* Read the name of a buffer and return as a string.
 Prompt with PROMPT.
 Optional second arg DEF is value to return if user enters an empty line.
-If optional third arg REQUIRE-MATCH is non-nil,
- only existing buffer names are allowed.
-The argument PROMPT should be a string ending with a colon and a space.  */)
+ If DEF is a list of default values, return its first element.
+Optional third arg REQUIRE-MATCH determines whether non-existing
+ buffer names are allowed.  It has the same meaning as the
+ REQUIRE-MATCH argument of `confirm-after-completion'.
+The argument PROMPT should be a string ending with a colon and a space.
+If `read-buffer-completion-ignore-case' is non-nil, completion ignores
+case while reading the buffer name.
+If `read-buffer-function' is non-nil, this works by calling it as a
+function, instead of the usual behavior.  */)
      (prompt, def, require_match)
      Lisp_Object prompt, def, require_match;
 {
-  Lisp_Object args[4];
+  Lisp_Object args[4], result;
   unsigned char *s;
   int len;
+  int count = SPECPDL_INDEX ();
 
   if (BUFFERP (def))
     def = XBUFFER (def)->name;
 
+  specbind (Qcompletion_ignore_case,
+           read_buffer_completion_ignore_case ? Qt : Qnil);
+
   if (NILP (Vread_buffer_function))
     {
       if (!NILP (def))
@@ -1235,9 +1233,9 @@ The argument PROMPT should be a string ending with a colon and a space.  */)
          prompt = Fformat (3, args);
        }
 
-      return Fcompleting_read (prompt, intern ("internal-complete-buffer"),
-                              Qnil, require_match, Qnil, Qbuffer_name_history,
-                              def, Qnil);
+      result = Fcompleting_read (prompt, intern ("internal-complete-buffer"),
+                                Qnil, require_match, Qnil, Qbuffer_name_history,
+                                def, Qnil);
     }
   else
     {
@@ -1245,8 +1243,9 @@ The argument PROMPT should be a string ending with a colon and a space.  */)
       args[1] = prompt;
       args[2] = def;
       args[3] = require_match;
-      return Ffuncall(4, args);
+      result = Ffuncall(4, args);
     }
+  return unbind_to (count, result);
 }
 \f
 static Lisp_Object
@@ -1460,9 +1459,6 @@ is used to further constrain the set of candidates.  */)
              else
                matchsize = XINT (tem) - 1;
 
-             if (matchsize < 0)
-               /* When can this happen ?  -stef  */
-               matchsize = compare;
              if (completion_ignore_case)
                {
                  /* If this is an exact match except for case,
@@ -1528,13 +1524,7 @@ is used to further constrain the set of candidates.  */)
 
   /* Return t if the supplied string is an exact match (counting case);
      it does not require any change to be made.  */
-  if (matchcount == 1 && bestmatchsize == SCHARS (string)
-      && (tem = Fcompare_strings (bestmatch, make_number (0),
-                                 make_number (bestmatchsize),
-                                 string, make_number (0),
-                                 make_number (bestmatchsize),
-                                 Qnil),
-         EQ (Qt, tem)))
+  if (matchcount == 1 && !NILP (Fequal (bestmatch, string)))
     return Qt;
 
   XSETFASTINT (zero, 0);               /* Else extract the part in which */
@@ -1571,9 +1561,9 @@ predicate is called with two arguments: the key and the value.
 Additionally to this predicate, `completion-regexp-list'
 is used to further constrain the set of candidates.
 
-If the optional fourth argument HIDE-SPACES is non-nil,
-strings in COLLECTION that start with a space
-are ignored unless STRING itself starts with a space.  */)
+An obsolete optional fourth argument HIDE-SPACES is still accepted for
+backward compatibility.  If non-nil, strings in COLLECTION that start
+with a space are ignored unless STRING itself starts with a space.  */)
      (string, collection, predicate, hide_spaces)
      Lisp_Object string, collection, predicate, hide_spaces;
 {
@@ -1657,10 +1647,10 @@ are ignored unless STRING itself starts with a space.  */)
          && SCHARS (string) <= SCHARS (eltstring)
          /* If HIDE_SPACES, reject alternatives that start with space
             unless the input starts with space.  */
-         && ((SBYTES (string) > 0
-              && SREF (string, 0) == ' ')
-             || SREF (eltstring, 0) != ' '
-             || NILP (hide_spaces))
+         && (NILP (hide_spaces)
+             || (SBYTES (string) > 0
+                 && SREF (string, 0) == ' ')
+             || SREF (eltstring, 0) != ' ')
          && (tem = Fcompare_strings (eltstring, zero,
                                      make_number (SCHARS (string)),
                                      string, zero,
@@ -1739,13 +1729,18 @@ REQUIRE-MATCH can take the following values:
 - t means that the user is not allowed to exit unless
   the input is (or completes to) an element of COLLECTION or is null.
 - nil means that the user can exit with any input.
-- `confirm-only' means that the user can exit with any input, but she will
-  need to confirm her choice if the input is not an element of COLLECTION.
+- `confirm' means that the user can exit with any input, but she needs
+  to confirm her choice if the input is not an element of COLLECTION.
+- `confirm-after-completion' means that the user can exit with any
+  input, but she needs to confirm her choice if she called
+  `minibuffer-complete' right before `minibuffer-complete-and-exit'
+  and the input is not an element of COLLECTION.
 - anything else behaves like t except that typing RET does not exit if it
   does non-null completion.
 
-If the input is null, `completing-read' returns DEF, or an empty string
- if DEF is nil, regardless of the value of REQUIRE-MATCH.
+If the input is null, `completing-read' returns DEF, or the first element
+of the list of default values, or an empty string if DEF is nil,
+regardless of the value of REQUIRE-MATCH.
 
 If INITIAL-INPUT is non-nil, insert it in the minibuffer initially,
   with point positioned at the end.
@@ -1769,7 +1764,7 @@ HIST, if non-nil, specifies a history list and optionally the initial
   1 at the beginning of the list.  The variable `history-length'
   controls the maximum length of a history list.
 
-DEF, if non-nil, is the default value.
+DEF, if non-nil, is the default value or the list of default values.
 
 If INHERIT-INPUT-METHOD is non-nil, the minibuffer inherits
   the current input method and the setting of `enable-multibyte-characters'.
@@ -1793,7 +1788,6 @@ Completion ignores case if the ambient value of
   specbind (Qminibuffer_completion_predicate, predicate);
   specbind (Qminibuffer_completion_confirm,
            EQ (require_match, Qt) ? Qnil : require_match);
-  last_exact_completion = Qnil;
 
   position = Qnil;
   if (!NILP (init))
@@ -1835,7 +1829,7 @@ Completion ignores case if the ambient value of
                      : (NILP (Vminibuffer_completing_file_name)
                         || EQ (Vminibuffer_completing_file_name, Qlambda)
                         ? Vminibuffer_local_must_match_map
-                        : Vminibuffer_local_must_match_filename_map),
+                        : Vminibuffer_local_filename_must_match_map),
                      init, prompt, make_number (pos), 0,
                      histvar, histpos, def, 0,
                      !NILP (inherit_input_method));
@@ -1846,7 +1840,6 @@ Completion ignores case if the ambient value of
   RETURN_UNGCPRO (unbind_to (count, val));
 }
 \f
-Lisp_Object Fminibuffer_completion_help ();
 Lisp_Object Fassoc_string ();
 
 /* Test whether TXT is an exact completion.  */
@@ -1980,133 +1973,45 @@ The arguments STRING and PREDICATE are as in `try-completion',
   if (NILP (flag))
     return Ftry_completion (string, Vbuffer_alist, predicate);
   else if (EQ (flag, Qt))
-    return Fall_completions (string, Vbuffer_alist, predicate, Qt);
-  else                         /* assume `lambda' */
-    return Ftest_completion (string, Vbuffer_alist, predicate);
-}
-
-/* returns:
- * 0 no possible completion
- * 1 was already an exact and unique completion
- * 3 was already an exact completion
- * 4 completed to an exact completion
- * 5 some completion happened
- * 6 no completion happened
- */
-int
-do_completion ()
-{
-  Lisp_Object completion, string, tem;
-  int completedp;
-  Lisp_Object last;
-  struct gcpro gcpro1, gcpro2;
-
-  completion = Ftry_completion (Fminibuffer_completion_contents (),
-                               Vminibuffer_completion_table,
-                               Vminibuffer_completion_predicate);
-  last = last_exact_completion;
-  last_exact_completion = Qnil;
-
-  GCPRO2 (completion, last);
-
-  if (NILP (completion))
-    {
-      bitch_at_user ();
-      temp_echo_area_glyphs (build_string (" [No match]"));
-      UNGCPRO;
-      return 0;
-    }
-
-  if (EQ (completion, Qt))     /* exact and unique match */
     {
-      UNGCPRO;
-      return 1;
-    }
-
-  string = Fminibuffer_completion_contents ();
-
-  /* COMPLETEDP should be true if some completion was done, which
-     doesn't include simply changing the case of the entered string.
-     However, for appearance, the string is rewritten if the case
-     changes.  */
-  tem = Fcompare_strings (completion, Qnil, Qnil, string, Qnil, Qnil, Qt);
-  completedp = !EQ (tem, Qt);
-
-  tem = Fcompare_strings (completion, Qnil, Qnil, string, Qnil, Qnil, Qnil);
-  if (!EQ (tem, Qt))
-    /* Rewrite the user's input.  */
-    {
-      int prompt_end = XINT (Fminibuffer_prompt_end ());
-      /* Some completion happened */
-
-      if (! NILP (Vminibuffer_completing_file_name)
-         && SREF (completion, SBYTES (completion) - 1) == '/'
-         && PT < ZV
-         && FETCH_CHAR (PT_BYTE) == '/')
-       {
-         del_range (prompt_end, PT + 1);
-       }
+      Lisp_Object res = Fall_completions (string, Vbuffer_alist, predicate, Qnil);
+      if (SCHARS (string) > 0)
+       return res;
       else
-       del_range (prompt_end, PT);
-
-      Finsert (1, &completion);
-
-      if (! completedp)
-       /* The case of the string changed, but that's all.  We're not
-          sure whether this is a unique completion or not, so try again
-          using the real case (this shouldn't recurse again, because
-          the next time try-completion will return either `t' or the
-          exact string).  */
-       {
-         UNGCPRO;
-         return do_completion ();
+       { /* Strip out internal buffers.  */
+         Lisp_Object bufs = res;
+         /* First, look for a non-internal buffer in `res'.  */
+         while (CONSP (bufs) && SREF (XCAR (bufs), 0) == ' ')
+           bufs = XCDR (bufs);
+         if (NILP (bufs))
+           /* All bufs in `res' are internal, so don't trip them out.  */
+           return res;
+         res = bufs;
+         while (CONSP (XCDR (bufs)))
+           if (SREF (XCAR (XCDR (bufs)), 0) == ' ')
+             XSETCDR (bufs, XCDR (XCDR (bufs)));
+           else
+             bufs = XCDR (bufs);
+         return res;
        }
     }
-
-  /* It did find a match.  Do we match some possibility exactly now? */
-  tem = Ftest_completion (Fminibuffer_contents (),
-                         Vminibuffer_completion_table,
-                         Vminibuffer_completion_predicate);
-  if (NILP (tem))
-    {
-      /* not an exact match */
-      UNGCPRO;
-      if (completedp)
-       return 5;
-      else if (!NILP (Vcompletion_auto_help))
-       Fminibuffer_completion_help ();
-      else
-       temp_echo_area_glyphs (build_string (" [Next char not unique]"));
-      return 6;
-    }
-  else if (completedp)
-    {
-      UNGCPRO;
-      return 4;
-    }
-  /* If the last exact completion and this one were the same,
-     it means we've already given a "Complete but not unique"
-     message and the user's hit TAB again, so now we give him help.  */
-  last_exact_completion = completion;
-  if (!NILP (last))
-    {
-      tem = Fminibuffer_completion_contents ();
-      if (!NILP (Fequal (tem, last)))
-       Fminibuffer_completion_help ();
-    }
-  UNGCPRO;
-  return 3;
+  else                         /* assume `lambda' */
+    return Ftest_completion (string, Vbuffer_alist, predicate);
 }
 
 /* Like assoc but assumes KEY is a string, and ignores case if appropriate.  */
 
 DEFUN ("assoc-string", Fassoc_string, Sassoc_string, 2, 3, 0,
        doc: /* Like `assoc' but specifically for strings (and symbols).
-Symbols are converted to strings, and unibyte strings are converted to
-multibyte for comparison.
-Case is ignored if optional arg CASE-FOLD is non-nil.
-As opposed to `assoc', it will also match an entry consisting of a single
-string rather than a cons cell whose car is a string.  */)
+
+This returns the first element of LIST whose car matches the string or
+symbol KEY, or nil if no match exists.  When performing the
+comparison, symbols are first converted to strings, and unibyte
+strings to multibyte.  If the optional arg CASE-FOLD is non-nil, case
+is ignored.
+
+Unlike `assoc', KEY can also match an entry in LIST consisting of a
+single string, rather than a cons cell whose car is a string.  */)
        (key, list, case_fold)
      register Lisp_Object key;
      Lisp_Object list, case_fold;
@@ -2135,621 +2040,7 @@ string rather than a cons cell whose car is a string.  */)
   return Qnil;
 }
 
-DEFUN ("minibuffer-complete", Fminibuffer_complete, Sminibuffer_complete, 0, 0, "",
-       doc: /* Complete the minibuffer contents as far as possible.
-Return nil if there is no valid completion, else t.
-If no characters can be completed, display a list of possible completions.
-If you repeat this command after it displayed such a list,
-scroll the window of possible completions.  */)
-     ()
-{
-  register int i;
-  Lisp_Object window, tem;
-
-  /* If the previous command was not this,
-     mark the completion buffer obsolete.  */
-  if (! EQ (current_kboard->Vlast_command, Vthis_command))
-    Vminibuf_scroll_window = Qnil;
-
-  window = Vminibuf_scroll_window;
-  /* If there's a fresh completion window with a live buffer,
-     and this command is repeated, scroll that window.  */
-  if (! NILP (window) && ! NILP (XWINDOW (window)->buffer)
-      && !NILP (XBUFFER (XWINDOW (window)->buffer)->name))
-    {
-      struct buffer *obuf = current_buffer;
-
-      Fset_buffer (XWINDOW (window)->buffer);
-      tem = Fpos_visible_in_window_p (make_number (ZV), window, Qnil);
-      if (! NILP (tem))
-       /* If end is in view, scroll up to the beginning.  */
-       Fset_window_start (window, make_number (BEGV), Qnil);
-      else
-       /* Else scroll down one screen.  */
-       Fscroll_other_window (Qnil);
-
-      set_buffer_internal (obuf);
-      return Qnil;
-    }
-
-  i = do_completion ();
-  switch (i)
-    {
-    case 0:
-      return Qnil;
-
-    case 1:
-      if (PT != ZV)
-       Fgoto_char (make_number (ZV));
-      temp_echo_area_glyphs (build_string (" [Sole completion]"));
-      break;
-
-    case 3:
-      if (PT != ZV)
-       Fgoto_char (make_number (ZV));
-      temp_echo_area_glyphs (build_string (" [Complete, but not unique]"));
-      break;
-    }
-
-  return Qt;
-}
-\f
-/* Subroutines of Fminibuffer_complete_and_exit.  */
-
-/* This one is called by internal_condition_case to do the real work.  */
-
-Lisp_Object
-complete_and_exit_1 ()
-{
-  return make_number (do_completion ());
-}
-
-/* This one is called by internal_condition_case if an error happens.
-   Pretend the current value is an exact match.  */
-
-Lisp_Object
-complete_and_exit_2 (ignore)
-     Lisp_Object ignore;
-{
-  return make_number (1);
-}
-
-EXFUN (Fexit_minibuffer, 0) NO_RETURN;
-
-DEFUN ("minibuffer-complete-and-exit", Fminibuffer_complete_and_exit,
-       Sminibuffer_complete_and_exit, 0, 0, "",
-       doc: /* If the minibuffer contents is a valid completion then exit.
-Otherwise try to complete it.  If completion leads to a valid completion,
-a repetition of this command will exit.  */)
-     ()
-{
-  register int i;
-  Lisp_Object val, tem;
-
-  /* Allow user to specify null string */
-  if (XINT (Fminibuffer_prompt_end ()) == ZV)
-    goto exit;
-
-  val = Fminibuffer_contents ();
-  tem = Ftest_completion (val,
-                         Vminibuffer_completion_table,
-                         Vminibuffer_completion_predicate);
-  if (!NILP (tem))
-    {
-      if (completion_ignore_case)
-       { /* Fixup case of the field, if necessary. */
-         Lisp_Object compl
-           = Ftry_completion (val,
-                              Vminibuffer_completion_table,
-                              Vminibuffer_completion_predicate);
-         if (STRINGP (compl)
-             /* If it weren't for this piece of paranoia, I'd replace
-                the whole thing with a call to do_completion. */
-             && EQ (Flength (val), Flength (compl)))
-           {
-             del_range (XINT (Fminibuffer_prompt_end ()), ZV);
-             Finsert (1, &compl);
-           }
-       }
-      goto exit;
-    }
-
-  if (EQ (Vminibuffer_completion_confirm, intern ("confirm-only")))
-    { /* The user is permitted to exit with an input that's rejected
-        by test-completion, but at the condition to confirm her choice.  */
-      if (EQ (current_kboard->Vlast_command, Vthis_command))
-       goto exit;
-      else
-       {
-         temp_echo_area_glyphs (build_string (" [Confirm]"));
-         return Qnil;
-       }
-    }
-
-  /* Call do_completion, but ignore errors.  */
-  SET_PT (ZV);
-  val = internal_condition_case (complete_and_exit_1, Qerror,
-                                complete_and_exit_2);
-
-  i = XFASTINT (val);
-  switch (i)
-    {
-    case 1:
-    case 3:
-      goto exit;
-
-    case 4:
-      if (!NILP (Vminibuffer_completion_confirm))
-       {
-         temp_echo_area_glyphs (build_string (" [Confirm]"));
-         return Qnil;
-       }
-      else
-       goto exit;
-
-    default:
-      return Qnil;
-    }
- exit:
-  return Fexit_minibuffer ();
-  /* NOTREACHED */
-}
-
-DEFUN ("minibuffer-complete-word", Fminibuffer_complete_word, Sminibuffer_complete_word,
-       0, 0, "",
-       doc: /* Complete the minibuffer contents at most a single word.
-After one word is completed as much as possible, a space or hyphen
-is added, provided that matches some possible completion.
-Return nil if there is no valid completion, else t.  */)
-     ()
-{
-  Lisp_Object completion, tem, tem1;
-  register int i, i_byte;
-  struct gcpro gcpro1, gcpro2;
-  int prompt_end_charpos = XINT (Fminibuffer_prompt_end ());
-
-  /* We keep calling Fbuffer_string rather than arrange for GC to
-     hold onto a pointer to one of the strings thus made.  */
-
-  completion = Ftry_completion (Fminibuffer_completion_contents (),
-                               Vminibuffer_completion_table,
-                               Vminibuffer_completion_predicate);
-  if (NILP (completion))
-    {
-      bitch_at_user ();
-      temp_echo_area_glyphs (build_string (" [No match]"));
-      return Qnil;
-    }
-  if (EQ (completion, Qt))
-    return Qnil;
-
-#if 0 /* How the below code used to look, for reference. */
-  tem = Fminibuffer_contents ();
-  b = SDATA (tem);
-  i = ZV - 1 - SCHARS (completion);
-  p = SDATA (completion);
-  if (i > 0 ||
-      0 <= scmp (b, p, ZV - 1))
-    {
-      i = 1;
-      /* Set buffer to longest match of buffer tail and completion head. */
-      while (0 <= scmp (b + i, p, ZV - 1 - i))
-       i++;
-      del_range (1, i + 1);
-      SET_PT (ZV);
-    }
-#else /* Rewritten code */
-  {
-    int buffer_nchars, completion_nchars;
-
-    CHECK_STRING (completion);
-    tem = Fminibuffer_completion_contents ();
-    GCPRO2 (completion, tem);
-    /* If reading a file name,
-       expand any $ENVVAR refs in the buffer and in TEM.  */
-    if (! NILP (Vminibuffer_completing_file_name))
-      {
-       Lisp_Object substituted;
-       substituted = Fsubstitute_in_file_name (tem);
-       if (! EQ (substituted, tem))
-         {
-           tem = substituted;
-           del_range (prompt_end_charpos, PT);
-           Finsert (1, &tem);
-         }
-      }
-    buffer_nchars = SCHARS (tem); /* # chars in what we completed.  */
-    completion_nchars = SCHARS (completion);
-    i = buffer_nchars - completion_nchars;
-    if (i > 0
-       ||
-       (tem1 = Fcompare_strings (tem, make_number (0),
-                                 make_number (buffer_nchars),
-                                 completion, make_number (0),
-                                 make_number (buffer_nchars),
-                                 completion_ignore_case ? Qt : Qnil),
-        ! EQ (tem1, Qt)))
-      {
-       int start_pos;
-
-       /* Make buffer (before point) contain the longest match
-          of TEM's tail and COMPLETION's head.  */
-       if (i <= 0) i = 1;
-       start_pos= i;
-       buffer_nchars -= i;
-       while (i > 0)
-         {
-           tem1 = Fcompare_strings (tem, make_number (start_pos), Qnil,
-                                    completion, make_number (0),
-                                    make_number (buffer_nchars),
-                                    completion_ignore_case ? Qt : Qnil);
-           start_pos++;
-           if (EQ (tem1, Qt))
-             break;
-           i++;
-           buffer_nchars--;
-         }
-       del_range (start_pos, start_pos + buffer_nchars);
-      }
-    UNGCPRO;
-  }
-#endif /* Rewritten code */
-
-  {
-    int prompt_end_bytepos;
-    prompt_end_bytepos = CHAR_TO_BYTE (prompt_end_charpos);
-    i = PT - prompt_end_charpos;
-    i_byte = PT_BYTE - prompt_end_bytepos;
-  }
-
-  /* If completion finds next char not unique,
-     consider adding a space or a hyphen. */
-  if (i == SCHARS (completion))
-    {
-      GCPRO1 (completion);
-      tem = Ftry_completion (concat2 (Fminibuffer_completion_contents (),
-                                     build_string (" ")),
-                            Vminibuffer_completion_table,
-                            Vminibuffer_completion_predicate);
-      UNGCPRO;
-
-      if (STRINGP (tem))
-       completion = tem;
-      else
-       {
-         GCPRO1 (completion);
-         tem =
-           Ftry_completion (concat2 (Fminibuffer_completion_contents (),
-                                     build_string ("-")),
-                            Vminibuffer_completion_table,
-                            Vminibuffer_completion_predicate);
-         UNGCPRO;
-
-         if (STRINGP (tem))
-           completion = tem;
-       }
-    }
-
-  /* Now find first word-break in the stuff found by completion.
-     i gets index in string of where to stop completing.  */
-  {
-    int len, c;
-    int bytes = SBYTES (completion);
-    register const unsigned char *completion_string = SDATA (completion);
-    for (; i_byte < SBYTES (completion); i_byte += len, i++)
-      {
-       c = STRING_CHAR_AND_LENGTH (completion_string + i_byte,
-                                   bytes - i_byte,
-                                   len);
-       if (SYNTAX (c) != Sword)
-         {
-           i_byte += len;
-           i++;
-           break;
-         }
-      }
-  }
-
-  /* If got no characters, print help for user.  */
-
-  if (i == PT - prompt_end_charpos)
-    {
-      if (!NILP (Vcompletion_auto_help))
-       Fminibuffer_completion_help ();
-      return Qnil;
-    }
-
-  /* Otherwise insert in minibuffer the chars we got */
-
-  if (! NILP (Vminibuffer_completing_file_name)
-      && SREF (completion, SBYTES (completion) - 1) == '/'
-      && PT < ZV
-      && FETCH_CHAR (PT_BYTE) == '/')
-    {
-      del_range (prompt_end_charpos, PT + 1);
-    }
-  else
-    del_range (prompt_end_charpos, PT);
-
-  insert_from_string (completion, 0, 0, i, i_byte, 1);
-  return Qt;
-}
-\f
-DEFUN ("display-completion-list", Fdisplay_completion_list, Sdisplay_completion_list,
-       1, 2, 0,
-       doc: /* Display the list of completions, COMPLETIONS, using `standard-output'.
-Each element may be just a symbol or string
-or may be a list of two strings to be printed as if concatenated.
-If it is a list of two strings, the first is the actual completion
-alternative, the second serves as annotation.
-`standard-output' must be a buffer.
-The actual completion alternatives, as inserted, are given `mouse-face'
-properties of `highlight'.
-At the end, this runs the normal hook `completion-setup-hook'.
-It can find the completion buffer in `standard-output'.
-The optional second arg COMMON-SUBSTRING is a string.
-It is used to put faces, `completions-first-difference' and
-`completions-common-part' on the completion buffer. The
-`completions-common-part' face is put on the common substring
-specified by COMMON-SUBSTRING.  If COMMON-SUBSTRING is nil
-and the current buffer is not the minibuffer, the faces are not put.
-Internally, COMMON-SUBSTRING is bound to `completion-common-substring'
-during running `completion-setup-hook'. */)
-     (completions, common_substring)
-     Lisp_Object completions;
-     Lisp_Object common_substring;
-{
-  Lisp_Object tail, elt;
-  register int i;
-  int column = 0;
-  struct gcpro gcpro1, gcpro2, gcpro3;
-  struct buffer *old = current_buffer;
-  int first = 1;
-
-  /* Note that (when it matters) every variable
-     points to a non-string that is pointed to by COMPLETIONS,
-     except for ELT.  ELT can be pointing to a string
-     when terpri or Findent_to calls a change hook.  */
-  elt = Qnil;
-  GCPRO3 (completions, elt, common_substring);
-
-  if (BUFFERP (Vstandard_output))
-    set_buffer_internal (XBUFFER (Vstandard_output));
-
-  if (NILP (completions))
-    write_string ("There are no possible completions of what you have typed.",
-                 -1);
-  else
-    {
-      write_string ("Possible completions are:", -1);
-      for (tail = completions, i = 0; CONSP (tail); tail = XCDR (tail), i++)
-       {
-         Lisp_Object tem, string;
-         int length;
-         Lisp_Object startpos, endpos;
-
-         startpos = Qnil;
-
-         elt = XCAR (tail);
-         if (SYMBOLP (elt))
-           elt = SYMBOL_NAME (elt);
-         /* Compute the length of this element.  */
-         if (CONSP (elt))
-           {
-             tem = XCAR (elt);
-             CHECK_STRING (tem);
-             length = SCHARS (tem);
-
-             tem = Fcar (XCDR (elt));
-             CHECK_STRING (tem);
-             length += SCHARS (tem);
-           }
-         else
-           {
-             CHECK_STRING (elt);
-             length = SCHARS (elt);
-           }
-
-         /* This does a bad job for narrower than usual windows.
-            Sadly, the window it will appear in is not known
-            until after the text has been made.  */
-
-         if (BUFFERP (Vstandard_output))
-           XSETINT (startpos, BUF_PT (XBUFFER (Vstandard_output)));
-
-         /* If the previous completion was very wide,
-            or we have two on this line already,
-            don't put another on the same line.  */
-         if (column > 33 || first
-             /* If this is really wide, don't put it second on a line.  */
-             || (column > 0 && length > 45))
-           {
-             Fterpri (Qnil);
-             column = 0;
-           }
-         /* Otherwise advance to column 35.  */
-         else
-           {
-             if (BUFFERP (Vstandard_output))
-               {
-                 tem = Findent_to (make_number (35), make_number (2));
-
-                 column = XINT (tem);
-               }
-             else
-               {
-                 do
-                   {
-                     write_string (" ", -1);
-                     column++;
-                   }
-                 while (column < 35);
-               }
-           }
-
-         if (BUFFERP (Vstandard_output))
-           {
-             XSETINT (endpos, BUF_PT (XBUFFER (Vstandard_output)));
-             Fset_text_properties (startpos, endpos,
-                                   Qnil, Vstandard_output);
-           }
-
-         /* Output this element.
-            If necessary, convert it to unibyte or to multibyte first.  */
-         if (CONSP (elt))
-           string = Fcar (elt);
-         else
-           string = elt;
-         if (NILP (current_buffer->enable_multibyte_characters)
-             && STRING_MULTIBYTE (string))
-           string = Fstring_make_unibyte (string);
-         else if (!NILP (current_buffer->enable_multibyte_characters)
-                  && !STRING_MULTIBYTE (string))
-           string = Fstring_make_multibyte (string);
-
-         if (BUFFERP (Vstandard_output))
-           {
-             XSETINT (startpos, BUF_PT (XBUFFER (Vstandard_output)));
-
-             Fprinc (string, Qnil);
-
-             XSETINT (endpos, BUF_PT (XBUFFER (Vstandard_output)));
-
-             Fput_text_property (startpos, endpos,
-                                 Qmouse_face, intern ("highlight"),
-                                 Vstandard_output);
-           }
-         else
-           {
-             Fprinc (string, Qnil);
-           }
-
-         /* Output the annotation for this element.  */
-         if (CONSP (elt))
-           {
-             if (BUFFERP (Vstandard_output))
-               {
-                 XSETINT (startpos, BUF_PT (XBUFFER (Vstandard_output)));
-
-                 Fprinc (Fcar (Fcdr (elt)), Qnil);
-
-                 XSETINT (endpos, BUF_PT (XBUFFER (Vstandard_output)));
-
-                 Fset_text_properties (startpos, endpos, Qnil,
-                                       Vstandard_output);
-               }
-             else
-               {
-                 Fprinc (Fcar (Fcdr (elt)), Qnil);
-               }
-           }
-
-
-         /* Update COLUMN for what we have output.  */
-         column += length;
-
-         /* If output is to a buffer, recompute COLUMN in a way
-            that takes account of character widths.  */
-         if (BUFFERP (Vstandard_output))
-           {
-             tem = Fcurrent_column ();
-             column = XINT (tem);
-           }
-
-         first = 0;
-       }
-    }
-
-  if (BUFFERP (Vstandard_output))
-    set_buffer_internal (old);
-
-  if (!NILP (Vrun_hooks))
-    {
-      int count1 = SPECPDL_INDEX ();
-
-      specbind (intern ("completion-common-substring"), common_substring);
-      call1 (Vrun_hooks, intern ("completion-setup-hook"));
-
-      unbind_to (count1, Qnil);
-    }
-
-  UNGCPRO;
-
-  return Qnil;
-}
-
-
-static Lisp_Object
-display_completion_list_1 (list)
-     Lisp_Object list;
-{
-  return Fdisplay_completion_list (list, Qnil);
-}
-
-DEFUN ("minibuffer-completion-help", Fminibuffer_completion_help, Sminibuffer_completion_help,
-       0, 0, "",
-       doc: /* Display a list of possible completions of the current minibuffer contents.  */)
-     ()
-{
-  Lisp_Object completions;
-
-  message ("Making completion list...");
-  completions = Fall_completions (Fminibuffer_completion_contents (),
-                                 Vminibuffer_completion_table,
-                                 Vminibuffer_completion_predicate,
-                                 Qt);
-  clear_message (1, 0);
-
-  if (NILP (completions))
-    {
-      bitch_at_user ();
-      temp_echo_area_glyphs (build_string (" [No completions]"));
-    }
-  else
-    {
-      /* Sort and remove duplicates.  */
-      Lisp_Object tmp = completions = Fsort (completions, Qstring_lessp);
-      while (CONSP (tmp))
-       {
-         if (CONSP (XCDR (tmp))
-             && !NILP (Fequal (XCAR (tmp), XCAR (XCDR (tmp)))))
-           XSETCDR (tmp, XCDR (XCDR (tmp)));
-         else
-           tmp = XCDR (tmp);
-       }
-      internal_with_output_to_temp_buffer ("*Completions*",
-                                          display_completion_list_1,
-                                          completions);
-    }
-  return Qnil;
-}
 \f
-DEFUN ("self-insert-and-exit", Fself_insert_and_exit, Sself_insert_and_exit, 0, 0, "",
-       doc: /* Terminate minibuffer input.  */)
-     ()
-{
-  if (INTEGERP (last_command_char))
-    internal_self_insert (XINT (last_command_char), 0);
-  else
-    bitch_at_user ();
-
-  return Fexit_minibuffer ();
-}
-
-DEFUN ("exit-minibuffer", Fexit_minibuffer, Sexit_minibuffer, 0, 0, "",
-       doc: /* Terminate this minibuffer argument.  */)
-     ()
-{
-  /* If the command that uses this has made modifications in the minibuffer,
-     we don't want them to cause deactivation of the mark in the original
-     buffer.
-     A better solution would be to make deactivate-mark buffer-local
-     (or to turn it into a list of buffers, ...), but in the mean time,
-     this should do the trick in most cases.  */
-  Vdeactivate_mark = Qnil;
-  Fthrow (Qexit, Qnil);
-}
-
 DEFUN ("minibuffer-depth", Fminibuffer_depth, Sminibuffer_depth, 0, 0, 0,
        doc: /* Return current depth of activations of minibuffer, a nonnegative integer.  */)
      ()
@@ -2765,61 +2056,6 @@ If no minibuffer is active, return nil.  */)
   return Fcopy_sequence (minibuf_prompt);
 }
 
-\f
-/* Temporarily display STRING at the end of the current
-   minibuffer contents.  This is used to display things like
-   "[No Match]" when the user requests a completion for a prefix
-   that has no possible completions, and other quick, unobtrusive
-   messages.  */
-
-extern Lisp_Object Vminibuffer_message_timeout;
-
-void
-temp_echo_area_glyphs (string)
-     Lisp_Object string;
-{
-  int osize = ZV;
-  int osize_byte = ZV_BYTE;
-  int opoint = PT;
-  int opoint_byte = PT_BYTE;
-  Lisp_Object oinhibit;
-  oinhibit = Vinhibit_quit;
-
-  /* Clear out any old echo-area message to make way for our new thing.  */
-  message (0);
-
-  SET_PT_BOTH (osize, osize_byte);
-  insert_from_string (string, 0, 0, SCHARS (string), SBYTES (string), 0);
-  SET_PT_BOTH (opoint, opoint_byte);
-  Vinhibit_quit = Qt;
-
-  if (NUMBERP (Vminibuffer_message_timeout))
-    sit_for (Vminibuffer_message_timeout, 0, 2);
-  else
-    sit_for (Qt, 0, 2);
-
-  del_range_both (osize, osize_byte, ZV, ZV_BYTE, 1);
-  SET_PT_BOTH (opoint, opoint_byte);
-  if (!NILP (Vquit_flag))
-    {
-      Vquit_flag = Qnil;
-      Vunread_command_events = Fcons (make_number (quit_char), Qnil);
-    }
-  Vinhibit_quit = oinhibit;
-}
-
-DEFUN ("minibuffer-message", Fminibuffer_message, Sminibuffer_message,
-       1, 1, 0,
-       doc: /* Temporarily display STRING at the end of the minibuffer.
-The text is displayed for a period controlled by `minibuffer-message-timeout',
-or until the next input event arrives, whichever comes first.  */)
-     (string)
-     Lisp_Object string;
-{
-  CHECK_STRING (string);
-  temp_echo_area_glyphs (string);
-  return Qnil;
-}
 \f
 void
 init_minibuf_once ()
@@ -2838,66 +2074,68 @@ syms_of_minibuf ()
   minibuf_save_list = Qnil;
   staticpro (&minibuf_save_list);
 
-  Qcompletion_ignore_case = intern ("completion-ignore-case");
+  Qcompletion_ignore_case = intern_c_string ("completion-ignore-case");
   staticpro (&Qcompletion_ignore_case);
 
-  Qread_file_name_internal = intern ("read-file-name-internal");
+  Qread_file_name_internal = intern_c_string ("read-file-name-internal");
   staticpro (&Qread_file_name_internal);
 
-  Qminibuffer_default = intern ("minibuffer-default");
+  Qminibuffer_default = intern_c_string ("minibuffer-default");
   staticpro (&Qminibuffer_default);
   Fset (Qminibuffer_default, Qnil);
 
-  Qminibuffer_completion_table = intern ("minibuffer-completion-table");
+  Qminibuffer_completion_table = intern_c_string ("minibuffer-completion-table");
   staticpro (&Qminibuffer_completion_table);
 
-  Qminibuffer_completion_confirm = intern ("minibuffer-completion-confirm");
+  Qminibuffer_completion_confirm = intern_c_string ("minibuffer-completion-confirm");
   staticpro (&Qminibuffer_completion_confirm);
 
-  Qminibuffer_completion_predicate = intern ("minibuffer-completion-predicate");
+  Qminibuffer_completion_predicate = intern_c_string ("minibuffer-completion-predicate");
   staticpro (&Qminibuffer_completion_predicate);
 
-  staticpro (&last_exact_completion);
-  last_exact_completion = Qnil;
-
   staticpro (&last_minibuf_string);
   last_minibuf_string = Qnil;
 
-  Quser_variable_p = intern ("user-variable-p");
+  Quser_variable_p = intern_c_string ("user-variable-p");
   staticpro (&Quser_variable_p);
 
-  Qminibuffer_history = intern ("minibuffer-history");
+  Qminibuffer_history = intern_c_string ("minibuffer-history");
   staticpro (&Qminibuffer_history);
 
-  Qbuffer_name_history = intern ("buffer-name-history");
+  Qbuffer_name_history = intern_c_string ("buffer-name-history");
   staticpro (&Qbuffer_name_history);
   Fset (Qbuffer_name_history, Qnil);
 
-  Qminibuffer_setup_hook = intern ("minibuffer-setup-hook");
+  Qminibuffer_setup_hook = intern_c_string ("minibuffer-setup-hook");
   staticpro (&Qminibuffer_setup_hook);
 
-  Qminibuffer_exit_hook = intern ("minibuffer-exit-hook");
+  Qminibuffer_exit_hook = intern_c_string ("minibuffer-exit-hook");
   staticpro (&Qminibuffer_exit_hook);
 
-  Qhistory_length = intern ("history-length");
+  Qhistory_length = intern_c_string ("history-length");
   staticpro (&Qhistory_length);
 
-  Qcurrent_input_method = intern ("current-input-method");
+  Qcurrent_input_method = intern_c_string ("current-input-method");
   staticpro (&Qcurrent_input_method);
 
-  Qactivate_input_method = intern ("activate-input-method");
+  Qactivate_input_method = intern_c_string ("activate-input-method");
   staticpro (&Qactivate_input_method);
 
-  Qcase_fold_search = intern ("case-fold-search");
+  Qcase_fold_search = intern_c_string ("case-fold-search");
   staticpro (&Qcase_fold_search);
 
-  Qread_expression_history = intern ("read-expression-history");
+  Qread_expression_history = intern_c_string ("read-expression-history");
   staticpro (&Qread_expression_history);
 
   DEFVAR_LISP ("read-buffer-function", &Vread_buffer_function,
               doc: /* If this is non-nil, `read-buffer' does its work by calling this function.  */);
   Vread_buffer_function = Qnil;
 
+  DEFVAR_BOOL ("read-buffer-completion-ignore-case",
+              &read_buffer_completion_ignore_case,
+              doc: /* *Non-nil means completion ignores case when reading a buffer name.  */);
+  read_buffer_completion_ignore_case = 0;
+
   DEFVAR_LISP ("minibuffer-setup-hook", &Vminibuffer_setup_hook,
               doc: /* Normal hook run just after entry to minibuffer.  */);
   Vminibuffer_setup_hook = Qnil;
@@ -2926,16 +2164,11 @@ history list, so it is possible to do this afterwards by calling
 `add-to-history' explicitly.  */);
   Vhistory_add_new_input = Qt;
 
-  DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help,
-              doc: /* *Non-nil means automatically provide help for invalid completion input.
-Under Partial Completion mode, a non-nil, non-t value has a special meaning;
-see the doc string of `partial-completion-mode' for more details.  */);
-  Vcompletion_auto_help = Qt;
-
   DEFVAR_BOOL ("completion-ignore-case", &completion_ignore_case,
               doc: /* Non-nil means don't consider case significant in completion.
-
-For file-name completion, the variable `read-file-name-completion-ignore-case'
+For file-name completion, `read-file-name-completion-ignore-case'
+controls the behavior, rather than this variable.
+For buffer name completion, `read-buffer-completion-ignore-case'
 controls the behavior, rather than this variable.  */);
   completion_ignore_case = 0;
 
@@ -2964,12 +2197,19 @@ CODE can be nil, t or `lambda':
   Vminibuffer_completion_predicate = Qnil;
 
   DEFVAR_LISP ("minibuffer-completion-confirm", &Vminibuffer_completion_confirm,
-              doc: /* Non-nil means to demand confirmation of completion before exiting minibuffer.  */);
+              doc: /* Whether to demand confirmation of completion before exiting minibuffer.
+If nil, confirmation is not required.
+If the value is `confirm', the user may exit with an input that is not
+ a valid completion alternative, but Emacs asks for confirmation.
+If the value is `confirm-after-completion', the user may exit with an
+ input that is not a valid completion alternative, but Emacs asks for
+ confirmation if the user submitted the input right after any of the
+ completion commands listed in `minibuffer-confirm-exit-commands'.  */);
   Vminibuffer_completion_confirm = Qnil;
 
   DEFVAR_LISP ("minibuffer-completing-file-name",
               &Vminibuffer_completing_file_name,
-              doc: /* Non-nil and non-`lambda' means completing file names.  */);
+              doc: /* Non-nil means completing file names.  */);
   Vminibuffer_completing_file_name = Qnil;
 
   DEFVAR_LISP ("minibuffer-help-form", &Vminibuffer_help_form,
@@ -3017,7 +2257,7 @@ properties.  */);
   /* We use `intern' here instead of Qread_only to avoid
      initialization-order problems.  */
   Vminibuffer_prompt_properties
-    = Fcons (intern ("read-only"), Fcons (Qt, Qnil));
+    = Fcons (intern_c_string ("read-only"), Fcons (Qt, Qnil));
 
   DEFVAR_LISP ("read-expression-map", &Vread_expression_map,
               doc: /* Minibuffer keymap used for reading Lisp expressions.  */);
@@ -3041,59 +2281,12 @@ properties.  */);
   defsubr (&Sminibuffer_contents);
   defsubr (&Sminibuffer_contents_no_properties);
   defsubr (&Sminibuffer_completion_contents);
-  defsubr (&Sdelete_minibuffer_contents);
 
   defsubr (&Stry_completion);
   defsubr (&Sall_completions);
   defsubr (&Stest_completion);
   defsubr (&Sassoc_string);
   defsubr (&Scompleting_read);
-  defsubr (&Sminibuffer_complete);
-  defsubr (&Sminibuffer_complete_word);
-  defsubr (&Sminibuffer_complete_and_exit);
-  defsubr (&Sdisplay_completion_list);
-  defsubr (&Sminibuffer_completion_help);
-
-  defsubr (&Sself_insert_and_exit);
-  defsubr (&Sexit_minibuffer);
-
-  defsubr (&Sminibuffer_message);
-}
-
-void
-keys_of_minibuf ()
-{
-  initial_define_key (Vminibuffer_local_map, Ctl ('g'),
-                     "abort-recursive-edit");
-  initial_define_key (Vminibuffer_local_map, Ctl ('m'),
-                     "exit-minibuffer");
-  initial_define_key (Vminibuffer_local_map, Ctl ('j'),
-                     "exit-minibuffer");
-
-  initial_define_key (Vminibuffer_local_ns_map, ' ',
-                     "exit-minibuffer");
-  initial_define_key (Vminibuffer_local_ns_map, '\t',
-                     "exit-minibuffer");
-  initial_define_key (Vminibuffer_local_ns_map, '?',
-                     "self-insert-and-exit");
-
-  initial_define_key (Vminibuffer_local_completion_map, '\t',
-                     "minibuffer-complete");
-  initial_define_key (Vminibuffer_local_completion_map, ' ',
-                     "minibuffer-complete-word");
-  initial_define_key (Vminibuffer_local_completion_map, '?',
-                     "minibuffer-completion-help");
-
-  Fdefine_key (Vminibuffer_local_filename_completion_map,
-              build_string (" "), Qnil);
-
-  initial_define_key (Vminibuffer_local_must_match_map, Ctl ('m'),
-                     "minibuffer-complete-and-exit");
-  initial_define_key (Vminibuffer_local_must_match_map, Ctl ('j'),
-                     "minibuffer-complete-and-exit");
-
-  Fdefine_key (Vminibuffer_local_must_match_filename_map,
-              build_string (" "), Qnil);
 }
 
 /* arch-tag: 8f69b601-fba3-484c-a6dd-ceaee54a7a73