[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: removing duplicate from history by default
From: |
Dan Nicolaescu |
Subject: |
Re: removing duplicate from history by default |
Date: |
Sun, 05 Sep 2004 10:58:32 -0700 |
Juri Linkov <address@hidden> writes:
> Richard Stallman <address@hidden> writes:
>> Let's reopen the discussion started with the message here:
>>
>> http://lists.gnu.org/archive/html/emacs-devel/2004-06/msg00021.html
>>
>> No, please let's not. What we need to do now is fix the problems
>> that prevent a release. Please let's not take up other changes
>> which are not necessary now.
>
> Concentrating on making the next release is undoubtedly the top priority,
> but the proposed change is so small (but still very useful), that it's
> better to install it now than to raise the same question again in the futur\
e.
Agreed, the code changes are minimal: 1 line of code added + glue code
to declare a lisp variable. Plus the code already exists, I have used
it for a few months with no problems.
> Dan Nicolaescu <address@hidden> writes:
>
>> There was one question left, if removing duplicates from history
>> should be turned on by default.
>
> Let's not turn it on by default. Even shells don't set a variable to
> remove duplicates by default, isn't?
Right.
> And so this change will not change the current Emacs behavior.
Sure, a complete patch is attached. Please install it if it's OK.
2004-09-05 Dan Nicolaescu <address@hidden>
* minibuf.c (history_delete_duplicates): New variable.
(read_minibuf): Use it.
(syms_of_minibuf): Create the corresponding lisp variable.
Index: NEWS
===================================================================
RCS file: /cvsroot/emacs/emacs/etc/NEWS,v
retrieving revision 1.1019
diff -c -3 -p -c -r1.1019 NEWS
*** NEWS 2 Sep 2004 16:39:19 -0000 1.1019
--- NEWS 5 Sep 2004 17:54:45 -0000
*************** from the file name or buffer contents.
*** 1792,1797 ****
--- 1798,1807 ----
This option can be disabled, to avoid the normal behavior of isearch
which puts calls to `isearch-resume' in the command history.
+ ** New user option `history-delete-duplicate'.
+ If set to t when adding a new history entry, all previous identical
+ entries are deleted.
+
---
** Lisp mode now uses font-lock-doc-face for the docstrings.
Index: minibuf.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/minibuf.c,v
retrieving revision 1.271
diff -c -3 -p -c -r1.271 minibuf.c
*** minibuf.c 14 Aug 2004 12:46:46 -0000 1.271
--- minibuf.c 5 Sep 2004 17:40:26 -0000
*************** Lisp_Object Vcompletion_auto_help;
*** 61,66 ****
--- 61,71 ----
Lisp_Object Qhistory_length, Vhistory_length;
+ /* No duplicates in history. */
+
+ int history_delete_duplicates;
+
+
/* Fread_minibuffer leaves the input here as a string. */
Lisp_Object last_minibuf_string;
*************** read_minibuf (map, initial, prompt, back
*** 749,755 ****
{
Lisp_Object length;
! histval = Fcons (histstring, histval);
Fset (Vminibuffer_history_variable, histval);
/* Truncate if requested. */
--- 754,761 ----
{
Lisp_Object length;
! if (history_delete_duplicates) Fdelete (histstring, histval);
! histval = Fcons (histstring, histval);
Fset (Vminibuffer_history_variable, histval);
/* Truncate if requested. */
*************** just after a new element is inserted. S
*** 2668,2673 ****
--- 2674,2685 ----
property of a history variable overrides this default. */);
XSETFASTINT (Vhistory_length, 30);
+ DEFVAR_BOOL ("history-delete-duplicates", &history_delete_duplicates,
+ doc: /* *Non-nil means delete duplicates in history.
+ If set to t when adding a new history entry, all previous identical
+ entries are deleted. */);
+ history_delete_duplicates = 0;
+
DEFVAR_LISP ("completion-auto-help", &Vcompletion_auto_help,
doc: /* *Non-nil means automatically provide help for invalid
completion input. */);
Vcompletion_auto_help = Qt;