zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] zsh x font family completion
@ 2016-05-09 12:54 Marko Myllynen
  2016-05-09 13:04 ` Mikael Magnusson
  2016-05-11 15:01 ` Oliver Kiddle
  0 siblings, 2 replies; 5+ messages in thread
From: Marko Myllynen @ 2016-05-09 12:54 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zsh x font family completion
  2016-05-09 12:54 [PATCH] zsh x font family completion Marko Myllynen
@ 2016-05-09 13:04 ` Mikael Magnusson
  2016-05-11 11:53   ` Marko Myllynen
  2016-05-11 15:01 ` Oliver Kiddle
  1 sibling, 1 reply; 5+ messages in thread
From: Mikael Magnusson @ 2016-05-09 13:04 UTC (permalink / raw)
  To: Marko Myllynen; +Cc: zsh workers

On Mon, May 9, 2016 at 2:54 PM, Marko Myllynen <myllynen@redhat.com> wrote:
> 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,

It would probably be less confusing if this was called
_fc_font_family, since X fonts are something else. This one should
probably not even be in the X/ directory.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zsh x font family completion
  2016-05-09 13:04 ` Mikael Magnusson
@ 2016-05-11 11:53   ` Marko Myllynen
  0 siblings, 0 replies; 5+ messages in thread
From: Marko Myllynen @ 2016-05-11 11:53 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh workers

Hi,

On 2016-05-09 16:04, Mikael Magnusson wrote:
> On Mon, May 9, 2016 at 2:54 PM, Marko Myllynen <myllynen@redhat.com> wrote:
>>
>> 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.
>>
>> +_wanted font-families expl 'font family' compadd "$@" \
>> +  ${(f)"$(fc-list : -f "%{family|downcase|delete( )|translate(\,,\n)}\n")"}
>>
> 
> It would probably be less confusing if this was called
> _fc_font_family, since X fonts are something else. This one should
> probably not even be in the X/ directory.

Fair enough - would you happen to have any suggestions on the new name
and location, I could send an updated patch then?

Thanks,

-- 
Marko Myllynen


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zsh x font family completion
  2016-05-09 12:54 [PATCH] zsh x font family completion Marko Myllynen
  2016-05-09 13:04 ` Mikael Magnusson
@ 2016-05-11 15:01 ` Oliver Kiddle
  2016-05-12 13:02   ` Marko Myllynen
  1 sibling, 1 reply; 5+ messages in thread
From: Oliver Kiddle @ 2016-05-11 15:01 UTC (permalink / raw)
  To: Marko Myllynen; +Cc: zsh-workers

Marko Myllynen wrote:
>
> 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?

Note that there is an existing _xft_fonts function which does something
close to this. Would it work with the command you're writing a
completion for. It might be better to give it an option to limit it to
completing font families. Or does the command actually allow a size to
be specified.

Unlike for old style X fonts, the method of describing the newer fonts
is not as precisely defined.

Oliver


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] zsh x font family completion
  2016-05-11 15:01 ` Oliver Kiddle
@ 2016-05-12 13:02   ` Marko Myllynen
  0 siblings, 0 replies; 5+ messages in thread
From: Marko Myllynen @ 2016-05-12 13:02 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

Hi,

On 2016-05-11 18:01, Oliver Kiddle wrote:
> Marko Myllynen wrote:
>>
>> 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?
> 
> Note that there is an existing _xft_fonts function which does something
> close to this. Would it work with the command you're writing a
> completion for. It might be better to give it an option to limit it to
> completing font families. Or does the command actually allow a size to
> be specified.

Hmm, not sure I managed to miss _xft_fonts but it does what I want,
let's forget this patch. (Although, FWIW, I must say I prefer the format
I had chosen over xft_fonts, i.e., lower-cased without spaces,
applications seem to accept both.)

Thanks,

-- 
Marko Myllynen


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-12 13:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 12:54 [PATCH] zsh x font family completion Marko Myllynen
2016-05-09 13:04 ` Mikael Magnusson
2016-05-11 11:53   ` Marko Myllynen
2016-05-11 15:01 ` Oliver Kiddle
2016-05-12 13:02   ` Marko Myllynen

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).