Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:reply-to:to:from:subject:organization:message-id
         :date:user-agent:mime-version:content-transfer-encoding;
        bh=w7hbpDFK2vW9VVJXMJrgnKrZwmiB+9Lw1zTMlNh6Xk8=;
        b=mo7hGVP/F6Rndk3tm4xI0LeGPL6Hl9xogrigOHrYv/n3HFk2LPSE4CZGMaU/5y2ry+
         rmK+I614Mmg5UjMh9+i+ZBSx0+nf6mJGI/NyGSo/FFzysdYq8FYS2e5nh7H2FwqMgrML
         yynLR8aiL8wnR4Y2iQ319UHDO9Hr5xBXfAgfBVWAeDwTJz6GsE8fGJITCd59QVpSx7zS
         ZubsXECQsN8JSXymftaK92mzrxfS86YG4c4/E2Ozd5DMJgrfa68sHfhV2hoqFUJ57lWv
         2vtYrulAOGsjNlospqIhDJuibV6T3VHf+m35gdz1dFu6Qcb5HyTCgI/TxzDrhmCJjblj
         79Qw==
X-Gm-Message-State: AOPr4FW1+lFIFlh7GgHWXug9R1yvyNVL1zyIs/ttm1tPnIvBPuIhyLLExBhzZic+E1Is8gvk
X-Received: by 10.28.93.6 with SMTP id r6mr11862196wmb.93.1462798483971;
        Mon, 09 May 2016 05:54:43 -0700 (PDT)
Reply-To: Marko Myllynen <myllynen@redhat.com>
To: zsh-workers@zsh.org
From: Marko Myllynen <myllynen@redhat.com>
Subject: [PATCH] zsh x font family completion
Organization: Red Hat
Message-ID: <57308891.6070906@redhat.com>
Date: Mon, 9 May 2016 15:54:41 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.7.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 38439

Hi,

I'm working on completions for a command which has an option to select
the font family to use, I was wondering whether X font family
completions would be worthwhile to add for others to use as well?

Currently there's no any kind of caching, not sure would that be needed
on modern systems? When I looked at x_font for inspiration, it had a
big fat sign that its caching "*has* to be improved" so not sure what
would be considered elegant or optimal here.

Tested on RHEL 7.

---
 Completion/X/Type/_x_font_family | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 Completion/X/Type/_x_font_family

diff --git a/Completion/X/Type/_x_font_family b/Completion/X/Type/_x_font_family
new file mode 100644
index 0000000..48a1f23
--- /dev/null
+++ b/Completion/X/Type/_x_font_family
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_wanted font-families expl 'font family' compadd "$@" \
+  ${(f)"$(fc-list : -f "%{family|downcase|delete( )|translate(\,,\n)}\n")"}

Thanks,

-- 
Marko Myllynen

