From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23287 invoked by alias); 9 May 2011 22:09:50 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29207 Received: (qmail 8921 invoked from network); 9 May 2011 22:09:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.220.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=YeiBqdkLmSwfL4u50WTWR6vt4DhTXHq1IMqU2LnkMiU=; b=RekA01xYM5rIDr8ICuhficHSVjEF680TjV9TdZaUeAol+Sq6/8rpUX+zUjHcET+m/w zmwc0Eb1eGzDxClxNjZD8Cd84sqL7c0pspxmy4pVUFQhSyRMfzVf6xl3jeiyquz2ZE9k nEfhBe+fkJi4WkmvJvx7OM40sbm8RZYO+lQew= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=SA9+LF30Dj6j3BcXN/Sp9GOjckAzgjjHhoFjKqWXVT7n7xVSpPtFJZdJylnoCUnYnh bw11dQqK7Ry6YIKgy0xSpRQFlD/eJI+ksXHKvyUd4RPs5cvKDOlOvGX3zvo8ivbVSAsf Q7kMxPTqtqyaIPxsWYJ68VyXq9jBgub2NONKo= MIME-Version: 1.0 Date: Tue, 10 May 2011 00:09:31 +0200 Message-ID: Subject: PATCH: (rfc) HIST_FIND_DUPS option From: Mikael Magnusson To: zsh workers Content-Type: text/plain; charset=UTF-8 Add HIST_FIND_DUPS option so ctrl-r finds identical lines, useful when you want to ctrl-o through some and it found the wrong sequence. For example if you have this history: command you remember command you want to run 5000 other commands command you remember useless command I am currently unsure why unsetting HIST_FIND_NO_DUPS doesn't have this behaviour already. Possibly it only finds the same line after finding another line in between that also matches the search, this seems like a weird distinction to make to me (if this is the case). patch if someone wants to try it, not for committing of course since i didn't add docs: http://cgit.mika.l3ib.org/cgit/zsh-cvs/commit/?id=034f471caa87 corrupted patch to look at: diff --git a/Src/Zle/zle_hist.c b/Src/Zle/zle_hist.c index ed524d3..51d8667 100644 --- a/Src/Zle/zle_hist.c +++ b/Src/Zle/zle_hist.c @@ -1415,7 +1415,9 @@ doisearch(char **args, int dir, int pattern) else skip_line = isset(HISTFINDNODUPS) ? !!(he->node.flags & HIST_DUP) - : !strcmp(zt, last_line); + : isset(HISTFINDDUPS) + ? 0 + : !strcmp(zt, last_line); } dup_ok = 0; /* diff --git a/Src/options.c b/Src/options.c index 1ce9f41..2b88c7a 100644 --- a/Src/options.c +++ b/Src/options.c @@ -146,6 +146,7 @@ static struct optname optns[] = { {{NULL, "histbeep", OPT_ALL}, HISTBEEP}, {{NULL, "histexpiredupsfirst",0}, HISTEXPIREDUPSFIRST}, {{NULL, "histfcntllock", 0}, HISTFCNTLLOCK}, +{{NULL, "histfinddups", 0}, HISTFINDDUPS}, {{NULL, "histfindnodups", 0}, HISTFINDNODUPS}, {{NULL, "histignorealldups", 0}, HISTIGNOREALLDUPS}, {{NULL, "histignoredups", 0}, HISTIGNOREDUPS}, diff --git a/Src/zsh.h b/Src/zsh.h index 7f28f69..ba324ac 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -1988,6 +1988,7 @@ enum { HISTBEEP, HISTEXPIREDUPSFIRST, HISTFCNTLLOCK, + HISTFINDDUPS, HISTFINDNODUPS, HISTIGNOREALLDUPS, HISTIGNOREDUPS, -- Mikael Magnusson