unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
Subject: avoid duplicates in history
Date: Tue, 01 Jun 2004 10:00:24 -0700	[thread overview]
Message-ID: <200406011700.i51H0MGK001165@scanner2.ics.uci.edu> (raw)


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	other threads:[~2004-06-01 17:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-01 17:00 Dan Nicolaescu [this message]
2004-06-04  3:08 ` avoid duplicates in history Juri Linkov
2004-06-04  3:20   ` Miles Bader
2004-06-04 16:29     ` Dan Nicolaescu
2004-06-04 19:32       ` Juri Linkov
2004-06-04 21:27         ` Dan Nicolaescu
2004-06-04 22:09           ` Juri Linkov
2004-06-05 22:50         ` Richard Stallman
2004-06-07  8:53           ` Stefan Monnier
2004-09-02  0:37             ` removing duplicate from history by default [was Re: avoid duplicates in history] Dan Nicolaescu
2004-09-02 19:02               ` Richard Stallman
2004-09-03 23:05                 ` removing duplicate from history by default Juri Linkov
2004-09-05 17:58                   ` Dan Nicolaescu
2004-09-07  3:43                     ` Richard Stallman
2004-06-05 13:48       ` avoid duplicates in history Richard Stallman
2004-06-26 20:45       ` Juri Linkov
2004-06-28  2:23         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200406011700.i51H0MGK001165@scanner2.ics.uci.edu \
    --to=dann@ics.uci.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).