[Top][All Lists]

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

Re: should search ring contain duplicates?

From: Stuart D. Herring
Subject: Re: should search ring contain duplicates?
Date: Thu, 4 May 2006 09:36:32 -0700 (PDT)
User-agent: SquirrelMail/1.4.3a-11.EL3

>>> Sure, you need to quote history in the call then, but it seems like
>>> the trouble for a macro is not really warranted.
>> Evaluating the history argument is a feature, not a bug.  It lets you do
>> something like this:
>> (defun isearch-update-ring (string &optional regexp)
>>   "Add STRING to the beginning of the search ring.
>> REGEXP says which ring to use."
>>   (history-push string
>>                 (if regexp 'regexp-search-ring 'search-ring)
>>                 (if regexp regexp-search-ring-max search-ring-max)))
> No, it doesn't.  Thanks for making my point that "the trouble for a
> macro is not really warranted".

No, what doesn't do what?  If you're saying that using the macro does not
let you do what I suggested that `isearch-update-ring' could do, you're of
course right.  However, that's not what I was saying.

I was agreeing with your suggestion that it should be a function.  I was
discussing your noted drawback that "you need to quote history in the call
then".  I was pointing out a case where the evaluation of the history
argument (which often necessitates the quoting you noted) is a good thing,
by using that evaluation to combine the code for the two search rings in
`isearch-update-ring'.  Of course, with the macro one could do

(if regexp (history-push string regexp-search-ring regexp-search-ring-max)
           (history-push string search-ring search-ring-max))

...which isn't any longer.  But for the case of using the default for
maxlen, being able to stick an (if) in the ring argument would be the
convenient option.

Hopefully my previous message is clearer now.

> (get '(if regexp 'regexp-search-ring 'search-ring) 'history-length)
> is going to throw an error at execution time.
> Are you sure you know what a macro does?  It compiles the form
> resulting from executing the macro on the quoted arguments at compile
> time.

I do believe I understand them, but if my previous mail exposes some
misunderstanding even given that it was discussing the use of the function
and not the macro, please do enlighten me.


This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during

reply via email to

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