From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Vincent Lefevre <vincent@vinc17.net>
Cc: Bart Schaefer <schaefer@brasslantern.com>,
"zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: Re: completion for compilers (cc, gcc...) and -o
Date: Thu, 30 Apr 2020 22:34:26 +0000 [thread overview]
Message-ID: <20200430223426.2be58968@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <20200430205409.GC818727@zira.vinc17.org>
Vincent Lefevre wrote on Thu, 30 Apr 2020 22:54 +0200:
> Now I'm wondering whether there is a way to automatically apply
> the zstyle to the _gcc command list (I also sometimes use clang
> and so on).
This? —
zstyle -e ":completion::complete:*:option-o-1:" file-patterns '(( ${+funcstack[_gcc]} )) && reply=( … )'
---
More generally, I think it might be nice if the code evaluated by
«zstyle -e» could be told what context it's being looked up under.
Something like this:
% zstyle -e '*' foo 'echo $CONTEXT > /dev/tty'
% zstyle -s bar foo REPLY
bar
%
(though the name $CONTEXT is already taken)
> I was also wondering whether there is a way to get the extension
> list automatically from the one in _gcc (assuming that it could
> evolve[*]).
>
I don't know how likely it is to evolve, but I suppose we could drop
the list of extensions in a variable, «cc_extensions=( c h cc C cxx cpp
hpp )», then you'll be able to use «zstyle -e» to build on top of it?
> [*] On this subject, I'm quite sure I've already used the .cpp
> extension. I do not program in C++, but sometimes have to do
> some tests of small examples... I think that it should be added
> to the standard list, but C++ programmers may tell you more.
Sure. This? —
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 9ec09200e..20b3abe59 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -390,7 +390,7 @@ languages=(
# generic options (from --help)
args+=(
'-###[print commands to run this compilation]'
- '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"'
+ '-o:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
'-x[Specify the language of the following input files]:input file language:('"$languages"')'
'+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
'-d-:dump:->dump'
@@ -1004,7 +1004,7 @@ args+=(
'--help[Display this information]'
'--no-warnings[Same as -w]'
'--optimize[Same as -O]'
- '--output[Same as -o]'
+ '--output:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
'--param[Set parameter <param> to value. See manpage for a complete list of parameters]:name=value'
'--verbose[Same as -v]'
'--version[Display version information]'
Cheers,
next prev parent reply other threads:[~2020-04-30 22:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 8:51 Vincent Lefevre
2020-04-30 17:57 ` Bart Schaefer
2020-04-30 18:14 ` Daniel Shahaf
2020-04-30 20:17 ` Vincent Lefevre
2020-04-30 20:32 ` Bart Schaefer
2020-04-30 20:54 ` Vincent Lefevre
2020-04-30 22:34 ` Daniel Shahaf [this message]
2020-04-30 22:36 ` Daniel Shahaf
2020-04-30 23:07 ` Bart Schaefer
2020-04-30 22:05 ` Daniel Shahaf
2020-05-01 1:11 ` Vincent Lefevre
2020-05-02 0:43 ` Daniel Shahaf
2020-05-02 1:26 ` Bart Schaefer
2020-05-03 23:17 ` Vincent Lefevre
2020-05-04 23:58 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200430223426.2be58968@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=schaefer@brasslantern.com \
--cc=vincent@vinc17.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).