From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stuart D. Herring" Newsgroups: gmane.emacs.devel Subject: Re: should search ring contain duplicates? Date: Thu, 4 May 2006 09:36:32 -0700 (PDT) Message-ID: <36965.128.165.123.132.1146760592.squirrel@webmail.lanl.gov> References: <200605030727.k437R2Wx009975@amrm2.ics.uci.edu> <87bqufwbls.fsf@jurta.org> <85iromw09n.fsf@lola.goethe.zz><36938.128.165.123.132.1146758757.squirrel@webmail.lanl.gov> <85slnpu5bg.fsf@lola.goethe.zz> Reply-To: herring@lanl.gov NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1146760648 21241 80.91.229.2 (4 May 2006 16:37:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 4 May 2006 16:37:28 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 04 18:37:23 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Fbgp7-0003N3-5y for ged-emacs-devel@m.gmane.org; Thu, 04 May 2006 18:37:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fbgp6-0007SL-J6 for ged-emacs-devel@m.gmane.org; Thu, 04 May 2006 12:37:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fbgok-0007O9-37 for emacs-devel@gnu.org; Thu, 04 May 2006 12:36:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fbgoi-0007MS-4k for emacs-devel@gnu.org; Thu, 04 May 2006 12:36:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fbgoh-0007MP-VX for emacs-devel@gnu.org; Thu, 04 May 2006 12:36:40 -0400 Original-Received: from [192.65.95.54] (helo=mailwasher-b.lanl.gov) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FbgpK-0004fb-78; Thu, 04 May 2006 12:37:18 -0400 Original-Received: from mailrelay3.lanl.gov (mailrelay3.lanl.gov [128.165.4.104]) by mailwasher-b.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k44GaYAY007821; Thu, 4 May 2006 10:36:34 -0600 Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay3.lanl.gov (8.12.11.20060308/8.12.11/(ccn-5)) with ESMTP id k44GaW31027341; Thu, 4 May 2006 10:36:33 -0600 Original-Received: from webmail1.lanl.gov (localhost.localdomain [127.0.0.1]) by webmail1.lanl.gov (8.12.11.20060308/8.12.11) with ESMTP id k44GaW32010589; Thu, 4 May 2006 10:36:32 -0600 Original-Received: (from apache@localhost) by webmail1.lanl.gov (8.12.11.20060308/8.12.11/Submit) id k44GaW2h010587; Thu, 4 May 2006 09:36:32 -0700 X-Authentication-Warning: webmail1.lanl.gov: apache set sender to herring@lanl.gov using -f Original-Received: from 128.165.123.132 (SquirrelMail authenticated user 196434); by webmail.lanl.gov with HTTP; Thu, 4 May 2006 09:36:32 -0700 (PDT) In-Reply-To: <85slnpu5bg.fsf@lola.goethe.zz> Original-To: "David Kastrup" User-Agent: SquirrelMail/1.4.3a-11.EL3 X-Mailer: SquirrelMail/1.4.3a-11.EL3 X-Priority: 3 (Normal) Importance: Normal X-PMX-Version: 4.7.1.128075 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53919 Archived-At: >>> 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. Davis -- 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 shipping.