/[emacs]/emacs/src/minibuf.c
ViewVC logotype

Diff of /emacs/src/minibuf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.285 by kfstorm, Mon Sep 12 10:26:48 2005 UTC revision 1.286 by rfrancoise, Fri Sep 30 18:30:10 2005 UTC
# Line 1132  DEFUN ("read-buffer", Fread_buffer, Srea Line 1132  DEFUN ("read-buffer", Fread_buffer, Srea
1132  Prompt with PROMPT.  Prompt with PROMPT.
1133  Optional second arg DEF is value to return if user enters an empty line.  Optional second arg DEF is value to return if user enters an empty line.
1134  If optional third arg REQUIRE-MATCH is non-nil,  If optional third arg REQUIRE-MATCH is non-nil,
1135   only existing buffer names are allowed.  */)   only existing buffer names are allowed.
1136    The argument PROMPT should be a string ending with a colon and a space.  */)
1137       (prompt, def, require_match)       (prompt, def, require_match)
1138       Lisp_Object prompt, def, require_match;       Lisp_Object prompt, def, require_match;
1139  {  {
1140    Lisp_Object args[4];    Lisp_Object args[4];
1141      unsigned char *s;
1142      int len;
1143    
1144    if (BUFFERP (def))    if (BUFFERP (def))
1145      def = XBUFFER (def)->name;      def = XBUFFER (def)->name;
# Line 1145  If optional third arg REQUIRE-MATCH is n Line 1148  If optional third arg REQUIRE-MATCH is n
1148      {      {
1149        if (!NILP (def))        if (!NILP (def))
1150          {          {
1151            args[0] = build_string ("%s(default %s) ");            /* A default value was provided: we must change PROMPT,
1152                 editing the default value in before the colon.  To achieve
1153                 this, we replace PROMPT with a substring that doesn't
1154                 contain the terminal space and colon (if present).  They
1155                 are then added back using Fformat.  */
1156    
1157              if (STRINGP (prompt))
1158                {
1159                  s = SDATA (prompt);
1160                  len = strlen (s);
1161                  if (len >= 2 && s[len - 2] == ':' && s[len - 1] == ' ')
1162                    len = len - 2;
1163                  else if (len >= 1 && (s[len - 1] == ':' || s[len - 1] == ' '))
1164                    len--;
1165    
1166                  prompt = make_specified_string (s, -1, len,
1167                                                  STRING_MULTIBYTE (prompt));
1168                }
1169    
1170              args[0] = build_string ("%s (default %s): ");
1171            args[1] = prompt;            args[1] = prompt;
1172            args[2] = def;            args[2] = def;
1173            prompt = Fformat (3, args);            prompt = Fformat (3, args);

Legend:
Removed from v.1.285  
changed lines
  Added in v.1.286

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26