[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: should search ring contain duplicates?
From: |
Kim F. Storm |
Subject: |
Re: should search ring contain duplicates? |
Date: |
Wed, 03 May 2006 15:53:39 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Juri Linkov <address@hidden> writes:
> Since query-replace is the only place in Emacs that uses this new argument,
> it is better to remove it now before the release, and to use a new
> macro `history-push' in `query-replace-read-to' to treat the query-replace
> history specially.
Agree.
> Below is a tested patch that removes `keep-all' from `read-from-minibuffer',
> adds duplicate replacement strings to the query-replace history explicitly,
> and fixes more places where the value of `history-delete-duplicates'
> is not taken into account yet
Looks good to me!
> (namely, `repeat-complex-command',
> `call-interactively', and `isearch-update-ring'). This patch doesn't use
> a new macro `history-push', but it would be easy to add it later to two
> places in `isearch-update-ring' and `query-replace-read-to'.
I definitely think we need the history-push macro!
Here is something which works for me:
(defmacro history-push (newelt history &optional maxelt)
"Add NEWELT to the history list stored in the symbol HISTORY.
Truncate the history to max MAXELT elements, if specified, or
to the value of the `history-length' property on symbol HISTORY,
if set, or to the value of the `history-length' variable.
Remove duplicates of NEWELT unless `history-delete-duplicates' is nil."
(declare (debug (form sexp)))
`(let ((len ,maxelt))
(if history-delete-duplicates
(setq ,history (delete ,newelt ,history)))
(setq ,history (cons ,newelt ,history))
(if (null len)
(setq len (or (get ',history 'history-length)
history-length)))
(if (integerp len)
(if (= 0 len)
(setq ,history nil)
(if (> (length ,history) len)
(setcdr (nthcdr (1- len) ,history) nil))))))
--
Kim F. Storm <address@hidden> http://www.cua.dk
- should search ring contain duplicates?, Drew Adams, 2006/05/02
- Re: should search ring contain duplicates?, Dan Nicolaescu, 2006/05/03
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/03
- Re: should search ring contain duplicates?, Juri Linkov, 2006/05/03
- Re: should search ring contain duplicates?,
Kim F. Storm <=
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/04
- Re: should search ring contain duplicates?, David Kastrup, 2006/05/04
- Re: should search ring contain duplicates?, Stefan Monnier, 2006/05/04
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/04
- Re: should search ring contain duplicates?, David Kastrup, 2006/05/04
- Re: should search ring contain duplicates?, Richard Stallman, 2006/05/05
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/05
- Re: should search ring contain duplicates?, Eli Zaretskii, 2006/05/06
- Re: should search ring contain duplicates?, Richard Stallman, 2006/05/06
- Re: should search ring contain duplicates?, Kim F. Storm, 2006/05/07