From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 7642 invoked from network); 5 Dec 2020 21:21:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 5 Dec 2020 21:21:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1607203293; b=D3/zTJwUc5jfvpasSHpXb2WEwkeHg/Z3lupiYa1Pgx7ErP0CTpUKhXvuBvzxMqSP1QQEqMIiWe bINYZOh/MGTWJprD2iMoaJ2Ip6BzDop5EjpWDtIg/G9NUec4DJxoiOSr8+O15eyl+5NSD7UDVm f+VawliafScEXVbm7c7QtphWm46IP/MEUiu0eZSdqMvMQhgcm07qGymM0hT+jSxrm3+xRtTNPs gNDhGjEyAx7WmmHjFbEgfpOVMucowzPS6iPBfOuw/YDV1DcX3kQRKhkjhSB+sXXYEHYkDEk6Ed vrbeHKsdu0U0sq9k30dPG5iD11oP02VYlMD5ifS1AZqNdg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f51.google.com) smtp.remote-ip=209.85.210.51; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1607203293; bh=fjfBLIPsvGsgCUPPz2ilkrP6z8Oz2lgfsGy5Mmi+0ms=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=g9BIv/r3UFtRqKQ1NdjdvgY/D3PVWxkYEzH0lGSHaA8YNkPLX+8EL+HlRP0B6yjbWzBIr5Y4nK At+Gxfqx3B1c4hcHJJFpW3dNBmaEaAMHouWZZx0LpPPMYsoZCYw7NuD/odqibuja0IEDPvlMRK pcMRRhMrRkMd3VNjgnl5ZS3hO7BhDdAQFAIVKM9OeKnZH2HIagDqDQG5H74bOHi1Nluj+ACCWd 9dT3mqrcmlX58IT8xhAhP6EjNzGoDQdmgXmKvkuIcH01rdjbbMU5+bky38IntWNd5x9ZbEONih u0/WEkSkrNiJu0cwe9eCRnKJDW5AcgZLyathl/c0Njak3Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=k261PnnXECPjppkZqbHL67urtMUd3z/G+Ku6iTKWMDs=; b=RvsuhDKRyJ7MKhqRP6QVK5o9rQ 4bCfGwEUAJkWDznQdScTIdNy42/j78OoWvA3CsGUpbkvIQG77+aHLDS13SJXBNNLgSuSFHX5gpPxz 16rnxak73DC0fGwrKIr+rKb1P93jmNmIXXfof1JNCqJvxumU21cfkY+k4164x+a9OVA9/CBH9HtVU CCXEvuMcEeis5n1TpDmVlZXl4A3x97f/EpFo9TvD+zPIXoMWLPfb4j8vBFAEdP1vDdgYdc6XzeE7Q ikV1IsXgXYjt4qKlZpCUTsu6uCz/ZLlcDdDG4RzLrvj/pyzQHHPiNoc2Je8uV5vscVfQGsjw6VtTz aI7KtebA==; Received: from authenticated user by zero.zsh.org with local id 1klezh-000CQn-L4; Sat, 05 Dec 2020 21:21:29 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f51.google.com) smtp.remote-ip=209.85.210.51; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ot1-f51.google.com ([209.85.210.51]:41812) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1klezC-000C3P-0p; Sat, 05 Dec 2020 21:20:59 +0000 Received: by mail-ot1-f51.google.com with SMTP id x13so1347911oto.8 for ; Sat, 05 Dec 2020 13:20:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k261PnnXECPjppkZqbHL67urtMUd3z/G+Ku6iTKWMDs=; b=W4Mq6/mUAD6tqWxbQblulIM62hwlKCSbC14N37OVSzNFMMVI+/YdfY3ij1AS2FDfRc 8/9UvmwCiiM2RnMqL8c5BW1a/eQRvRVFfr1xQMtrC0F7nxCdGHqaOGiTbzLOBqhnLOPl XTb3nkczYl1m4VcN22QyUB748bc1CC7ChJHZ8HkKz7C+eVx3VCX6NmB2zT8USGR7o+AL rxQRqVKuuMlNvwTF60u2h421yE5XQisq9aF/0dyO1lHYqJaSXWIlKsLL/p+dDQrmapyl hXj4vNyo8jZNN4FZDaPZxp6UFrNLhJApA8tti9ZkjYGkzsm6Ovq8mqZSphufOscfQq/u eK3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k261PnnXECPjppkZqbHL67urtMUd3z/G+Ku6iTKWMDs=; b=UfNV0SXzVssoghNnfTp7hGmPzo0uGXif+ROSp83FobLSYE1FRmXbCMH5ShU/q66ANq MTealOtcluor4FXFyCIF/2qu13AprNjqFvyquGTjNQvK+hgJp99aHU/NaSiQh9JxDDyS quDaPClM/ftMI13qmFZrXvSI/ekusez+8FGzvoawSKQXtzaHPnPZjVG5JN/RTPzjhTwM qpbjpUxi75XSIi7SlhvQ/OBKrZ0c7yG5r01Bdpq6Z05y5lkc5GMKCsCTqoAP2K+eoD/N S4Yuhw4+uyR5WoLl8iveTQ2BX+Pgtalz2PX/XnQ83/vzFfI796hAklgkHiOHPAn72TII Cm4w== X-Gm-Message-State: AOAM533fP23HFeRYglRRqhsROn6Ru9ZvcYkmeTI66ni+sHnqkbFee9Mt VeMqmrqUqe4qdYiBGY5m3Lex4INQusHrokrPF7Gjow== X-Google-Smtp-Source: ABdhPJwLaZaTvVeaAdEf7crSB/5rWX2ocU1SVztEs1g09eCr1VrTzHWhgZBBp3smGcGThg7BbWUdnIIcFQhWd59HF3I= X-Received: by 2002:a9d:7394:: with SMTP id j20mr3193389otk.229.1607203256405; Sat, 05 Dec 2020 13:20:56 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Sat, 5 Dec 2020 13:20:45 -0800 Message-ID: Subject: Re: Statistics and completions To: "A. Wik" Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 26212 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Sat, Dec 5, 2020 at 5:22 AM A. Wik wrote: > > I am wondering how hard it would be to implement the collection of > statistics [...] > to guide the priority of listed completions. I would approach that as follows: Require the zsh/db/gdbm module to be available (incidentally there is a generic API for database modules if anybody wants to work on other backends). In the database, store a mapping from zstyle contexts to group-order lists. How to populate that mapping is up to you; it could probably be updated via comppostfuncs. I don't have any good ideas how to prepopulate it from a history file (particularly if one uses histignorealldups, as that would skew the frequencies). At shell startup, evaluate a set of zstyle commands constructed from the keys of the database, using "zstyle -e" to dynamically fetch the latest value from the entry whenever the style is looked up. One generic style might be devised to create new keys for previously unused contexts.