emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/minibuf.c


From: Romain Francoise
Subject: [Emacs-diffs] Changes to emacs/src/minibuf.c
Date: Fri, 30 Sep 2005 14:30:12 -0400

Index: emacs/src/minibuf.c
diff -c emacs/src/minibuf.c:1.285 emacs/src/minibuf.c:1.286
*** emacs/src/minibuf.c:1.285   Mon Sep 12 10:26:48 2005
--- emacs/src/minibuf.c Fri Sep 30 18:30:10 2005
***************
*** 1132,1142 ****
  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.  */)
       (prompt, def, require_match)
       Lisp_Object prompt, def, require_match;
  {
    Lisp_Object args[4];
  
    if (BUFFERP (def))
      def = XBUFFER (def)->name;
--- 1132,1145 ----
  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.  */)
       (prompt, def, require_match)
       Lisp_Object prompt, def, require_match;
  {
    Lisp_Object args[4];
+   unsigned char *s;
+   int len;
  
    if (BUFFERP (def))
      def = XBUFFER (def)->name;
***************
*** 1145,1151 ****
      {
        if (!NILP (def))
        {
!         args[0] = build_string ("%s(default %s) ");
          args[1] = prompt;
          args[2] = def;
          prompt = Fformat (3, args);
--- 1148,1173 ----
      {
        if (!NILP (def))
        {
!         /* A default value was provided: we must change PROMPT,
!            editing the default value in before the colon.  To achieve
!            this, we replace PROMPT with a substring that doesn't
!            contain the terminal space and colon (if present).  They
!            are then added back using Fformat.  */
! 
!         if (STRINGP (prompt))
!           {
!             s = SDATA (prompt);
!             len = strlen (s);
!             if (len >= 2 && s[len - 2] == ':' && s[len - 1] == ' ')
!               len = len - 2;
!             else if (len >= 1 && (s[len - 1] == ':' || s[len - 1] == ' '))
!               len--;
! 
!             prompt = make_specified_string (s, -1, len,
!                                             STRING_MULTIBYTE (prompt));
!           }
! 
!         args[0] = build_string ("%s (default %s): ");
          args[1] = prompt;
          args[2] = def;
          prompt = Fformat (3, args);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]