emacs-devel
[Top][All Lists]
Advanced

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

avoid duplicates in history


From: Dan Nicolaescu
Subject: avoid duplicates in history
Date: Tue, 01 Jun 2004 10:00:24 -0700

One feature of tcsh that I miss in emacs is "histdup=erase". When
histdup is set that way when a command is entered in history all
previous occurrences of the same command will be erased. 
bash3 will also implement this feature, it will be called
"erasedups". 

Here is an implementation of this feature for Emacs. 

If this is acceptable, I will provide a complete patch with
documentation. 

Feedback would be appreciated. 
Is the history-erasedups name ok? 

Thanks.


*** minibuf.c   27 May 2004 23:22:35 -0700      1.266
--- minibuf.c   01 Jun 2004 09:47:22 -0700      
***************
*** 61,66 ****
--- 61,71 ----
  
  Lisp_Object Qhistory_length, Vhistory_length;
  
+ /* No duplicates in history.  */
+ 
+ int history_erasedups;
+ 
+ 
  /* Fread_minibuffer leaves the input here as a string. */
  
  Lisp_Object last_minibuf_string;
***************
*** 742,748 ****
        {
          Lisp_Object length;
  
!         histval = Fcons (histstring, histval);
          Fset (Vminibuffer_history_variable, histval);
  
          /* Truncate if requested.  */
--- 747,754 ----
        {
          Lisp_Object length;
  
!         if (history_erasedups) Fdelete (histstring, histval);
!           histval = Fcons (histstring, histval);
          Fset (Vminibuffer_history_variable, histval);
  
          /* Truncate if requested.  */
***************
*** 2631,2636 ****
--- 2637,2647 ----
  property of a history variable overrides this default.  */);
    XSETFASTINT (Vhistory_length, 30);
  
+   DEFVAR_BOOL ("history-erasedups", &history_erasedups,
+              doc: /* *Non-nil means delete duplicates in history.
+   */);
+   history_erasedups = 0;
+   
    DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help,
               doc: /* *Non-nil means automatically provide help for invalid 
completion input.  */);
    Vcompletion_auto_help = Qt;




reply via email to

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