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 [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/minibuf.c [lexbind]
Date: Wed, 08 Dec 2004 18:56:48 -0500

Index: emacs/src/minibuf.c
diff -c emacs/src/minibuf.c:1.240.2.12 emacs/src/minibuf.c:1.240.2.13
*** emacs/src/minibuf.c:1.240.2.12      Wed Dec  8 23:31:37 2004
--- emacs/src/minibuf.c Wed Dec  8 23:36:22 2004
***************
*** 218,224 ****
                                     Lisp_Object, Lisp_Object,
                                     int, Lisp_Object,
                                     Lisp_Object, Lisp_Object,
!                                    int, int));
  static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object,
                                                    Lisp_Object, Lisp_Object,
                                                    int, Lisp_Object,
--- 218,224 ----
                                     Lisp_Object, Lisp_Object,
                                     int, Lisp_Object,
                                     Lisp_Object, Lisp_Object,
!                                    int, int, int));
  static Lisp_Object read_minibuf_noninteractive P_ ((Lisp_Object, Lisp_Object,
                                                    Lisp_Object, Lisp_Object,
                                                    int, Lisp_Object,
***************
*** 437,443 ****
  
  static Lisp_Object
  read_minibuf (map, initial, prompt, backup_n, expflag,
!             histvar, histpos, defalt, allow_props, inherit_input_method)
       Lisp_Object map;
       Lisp_Object initial;
       Lisp_Object prompt;
--- 437,444 ----
  
  static Lisp_Object
  read_minibuf (map, initial, prompt, backup_n, expflag,
!             histvar, histpos, defalt, allow_props, inherit_input_method,
!             keep_all)
       Lisp_Object map;
       Lisp_Object initial;
       Lisp_Object prompt;
***************
*** 448,453 ****
--- 449,455 ----
       Lisp_Object defalt;
       int allow_props;
       int inherit_input_method;
+      int keep_all;
  {
    Lisp_Object val;
    int count = SPECPDL_INDEX ();
***************
*** 722,728 ****
    last_minibuf_string = val;
  
    /* Choose the string to add to the history.  */
!   if (SCHARS (val) != 0)
      histstring = val;
    else if (STRINGP (defalt))
      histstring = defalt;
--- 724,730 ----
    last_minibuf_string = val;
  
    /* Choose the string to add to the history.  */
!   if (SCHARS (val) != 0 || keep_all)
      histstring = val;
    else if (STRINGP (defalt))
      histstring = defalt;
***************
*** 749,755 ****
        if (NILP (histval)
          || (CONSP (histval)
              /* Don't duplicate the most recent entry in the history.  */
!             && NILP (Fequal (histstring, Fcar (histval)))))
        {
          Lisp_Object length;
  
--- 751,758 ----
        if (NILP (histval)
          || (CONSP (histval)
              /* Don't duplicate the most recent entry in the history.  */
!             && (keep_all
!                 || NILP (Fequal (histstring, Fcar (histval))))))
        {
          Lisp_Object length;
  
***************
*** 911,917 ****
  }
  
  
! DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 
1, 7, 0,
         doc: /* Read a string from the minibuffer, prompting with string 
PROMPT.
  The optional second arg INITIAL-CONTENTS is an obsolete alternative to
    DEFAULT-VALUE.  It normally should be nil in new code, except when
--- 914,920 ----
  }
  
  
! DEFUN ("read-from-minibuffer", Fread_from_minibuffer, Sread_from_minibuffer, 
1, 8, 0,
         doc: /* Read a string from the minibuffer, prompting with string 
PROMPT.
  The optional second arg INITIAL-CONTENTS is an obsolete alternative to
    DEFAULT-VALUE.  It normally should be nil in new code, except when
***************
*** 935,940 ****
--- 938,945 ----
    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'.
+ Eight arg KEEP-ALL, if non-nil, says to put all inputs in the history list,
+  even empty or duplicate inputs.
  If the variable `minibuffer-allow-text-properties' is non-nil,
   then the string which is returned includes whatever text properties
   were present in the minibuffer.  Otherwise the value has no text properties.
***************
*** 950,958 ****
  one puts point at the beginning of the string.  *Note* that this
  behavior differs from the way such arguments are used in `completing-read'
  and some related functions, which use zero-indexing for POSITION.  */)
!      (prompt, initial_contents, keymap, read, hist, default_value, 
inherit_input_method)
       Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
!      Lisp_Object inherit_input_method;
  {
    Lisp_Object histvar, histpos, val;
    struct gcpro gcpro1;
--- 955,963 ----
  one puts point at the beginning of the string.  *Note* that this
  behavior differs from the way such arguments are used in `completing-read'
  and some related functions, which use zero-indexing for POSITION.  */)
!   (prompt, initial_contents, keymap, read, hist, default_value, 
inherit_input_method, keep_all)
       Lisp_Object prompt, initial_contents, keymap, read, hist, default_value;
!      Lisp_Object inherit_input_method, keep_all;
  {
    Lisp_Object histvar, histpos, val;
    struct gcpro gcpro1;
***************
*** 983,989 ****
                      Qnil, !NILP (read),
                      histvar, histpos, default_value,
                      minibuffer_allow_text_properties,
!                     !NILP (inherit_input_method));
    UNGCPRO;
    return val;
  }
--- 988,995 ----
                      Qnil, !NILP (read),
                      histvar, histpos, default_value,
                      minibuffer_allow_text_properties,
!                     !NILP (inherit_input_method),
!                     !NILP (keep_all));
    UNGCPRO;
    return val;
  }
***************
*** 1000,1006 ****
    CHECK_STRING (prompt);
    return read_minibuf (Vminibuffer_local_map, initial_contents,
                       prompt, Qnil, 1, Qminibuffer_history,
!                      make_number (0), Qnil, 0, 0);
  }
  
  DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
--- 1006,1012 ----
    CHECK_STRING (prompt);
    return read_minibuf (Vminibuffer_local_map, initial_contents,
                       prompt, Qnil, 1, Qminibuffer_history,
!                      make_number (0), Qnil, 0, 0, 0);
  }
  
  DEFUN ("eval-minibuffer", Feval_minibuffer, Seval_minibuffer, 1, 2, 0,
***************
*** 1038,1044 ****
    Lisp_Object val;
    val = Fread_from_minibuffer (prompt, initial_input, Qnil,
                               Qnil, history, default_value,
!                              inherit_input_method);
    if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
      val = default_value;
    return val;
--- 1044,1050 ----
    Lisp_Object val;
    val = Fread_from_minibuffer (prompt, initial_input, Qnil,
                               Qnil, history, default_value,
!                              inherit_input_method, Qnil);
    if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
      val = default_value;
    return val;
***************
*** 1060,1066 ****
    CHECK_STRING (prompt);
    return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil,
                       0, Qminibuffer_history, make_number (0), Qnil, 0,
!                      !NILP (inherit_input_method));
  }
  
  DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
--- 1066,1072 ----
    CHECK_STRING (prompt);
    return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil,
                       0, Qminibuffer_history, make_number (0), Qnil, 0,
!                      !NILP (inherit_input_method), 0);
  }
  
  DEFUN ("read-command", Fread_command, Sread_command, 1, 2, 0,
***************
*** 1711,1717 ****
                      : Vminibuffer_local_must_match_map,
                      init, prompt, make_number (pos), 0,
                      histvar, histpos, def, 0,
!                     !NILP (inherit_input_method));
  
    if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
      val = def;
--- 1717,1723 ----
                      : Vminibuffer_local_must_match_map,
                      init, prompt, make_number (pos), 0,
                      histvar, histpos, def, 0,
!                     !NILP (inherit_input_method), 0);
  
    if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def))
      val = def;
***************
*** 2076,2085 ****
    if (XINT (Fminibuffer_prompt_end ()) == ZV)
      goto exit;
  
!   if (!NILP (Ftest_completion (Fminibuffer_contents (),
                               Vminibuffer_completion_table,
                               Vminibuffer_completion_predicate)))
!     goto exit;
  
    /* Call do_completion, but ignore errors.  */
    SET_PT (ZV);
--- 2082,2109 ----
    if (XINT (Fminibuffer_prompt_end ()) == ZV)
      goto exit;
  
!   val = Fminibuffer_contents ();
!   if (!NILP (Ftest_completion (val,
                               Vminibuffer_completion_table,
                               Vminibuffer_completion_predicate)))
!     {
!       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;
!     }
  
    /* Call do_completion, but ignore errors.  */
    SET_PT (ZV);




reply via email to

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