[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: |
Thu, 04 May 2006 12:12:20 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
address@hidden (Kim F. Storm) writes:
> I definitely think we need the history-push macro!
> Here is something which works for me:
.. almost :-) Here is a better version:
(defmacro history-push (newelt history &optional maxelt)
"Add NEWELT to the history list stored in the symbol HISTORY.
If symbol MAXELT is specified, the maximum length of the history is
specified by the value of that symbol. Otherwise, the maximum history
length is 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)))
(unless maxelt
(setq maxelt `(or (get ',history 'history-length)
history-length)))
`(let ((len ,maxelt))
(if history-delete-duplicates
(setq ,history (delete ,newelt ,history)))
(setq ,history (cons ,newelt ,history))
(when (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, 2006/05/03
- Re: should search ring contain duplicates?,
Kim F. Storm <=
- 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
- Re: should search ring contain duplicates?, Stuart D. Herring, 2006/05/04