Add 2009 to copyright years.
[bpt/emacs.git] / src / minibuf.c
index f10d602..9daffac 100644 (file)
@@ -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,
-                 2008  Free Software Foundation, Inc.
+                 2008, 2009  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -525,7 +525,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),
@@ -1177,8 +1181,9 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0,
 Prompt with PROMPT.
 Optional second arg DEF is value to return if user enters an empty line.
  If DEF is a list of default values, return its first element.
-If optional third arg REQUIRE-MATCH is non-nil,
- only existing buffer names are allowed.
+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.
@@ -1723,8 +1728,12 @@ 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.
 
@@ -2187,7 +2196,14 @@ 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
+ `minibuffer-complete'.  */);
   Vminibuffer_completion_confirm = Qnil;
 
   DEFVAR_LISP ("minibuffer-completing-file-name",