> On Feb 24, 2021, at 8:24 AM, Daniel Shahaf wrote: > > Jacob Gelbman wrote on Wed, Feb 24, 2021 at 01:20:24 -0600: >> #compdef ctags > > apt-file(1) on Debian stable shows a few more names: > > arduino-ctags: /usr/bin/arduino-ctags > emacs-bin-common: /usr/bin/ctags.emacs > emacs-bin-common: /usr/bin/etags.emacs > exuberant-ctags: /usr/bin/ctags-exuberant > universal-ctags: /usr/bin/ctags-universal > xemacs21-bin: /usr/bin/etags.xemacs21 > > I assume at least some of these should be added to the #compdef line. Would > you do the honours? I added arduinio-ctags, ctags-exuberant, and ctags-universal to the #compdef line. I did not put ctags.emacs, etags.emacs, etags.xemacs21 because they probably belong at the top of the _etags script. > >> "--alias-=[add a pattern detecting a name, can be used as an alt name for lang]:pattern" > > As Oliver said, literal angle brackets in the option name to be > completed aren't especially helpful. In fact, I'll go as far as to say > I don't want users to run into it in released code. Please change them. > > You can use _call_program with --list-languages to generate the right set of > option names dynamically. > I made it so they are now shown --alias-, if they press tab again, they can complete the option name further with the language (--alias-ObjectiveC or --alias-Perl etc). So unless they enter the prefix, they won't be shown too many options. For exuberant ctags, there's one option like ---kinds, which doesn't have a unique prefix, like --alias- (--alias- is the prefix), so I added all these options to the main _aguments call. >> elif [ "$_ctags_type" = "exuberant" ]; then >> arguments=( >> "-a[append to tags file]" >> "-B[use backward searching patterns (?...?)]" >> "-e[output tag file for use with emacs]" >> "-f[write tags to specified file. - is stdout]:file:_files" > > Is the argument to the -f option allowed to be pasted to it? If so, s/-f/-f+/. It can. I changed it. > > Also, s/:file:/:output file:/. That part of the string is a user-facing > message, so the extra detail is helpful. > > Also, you can drop the "- is stdout" part. The descriptions are only > a summary of the functionality; they aren't meant to be a complete copy of > the manual. Done. > >> "-F[use forward searching patterns (/.../)]" >> "-h[specify list of file extensions to be treated as include files]:" > > Write something after the colon. > >> "-I[a list of tokens to be specifically handled is read from either the command line or the specified file]:" > > The thing in brackets doesn't describe the action of the option. Please edit. > >> "-L[a list of input file names is read from the specified file. - is stdin]:file:_files" > > Rephrase in the imperative. All done. > >> "-R[equivalent to --recurse]" > > This is normally rendered as: > > '(-r --recurse)'{-R,--recurse}'[description]' I couldn't quite combine -R and --recurse like that since --recurse takes an argument like --recurse=yes and -R doesn't. -R=yes is an error. But I gave them the same description, so they'll appear on the same line. I did the same for --verbose and -V, and --guess-language-eagerly and -G. > >> "--fields=[include selected extension fields (flags afmikKlnsStz)]:flags" > > Recommend to move the afmikKlnsStz thing to after the colon, so it'll be > shown at a more appropriate point. Also, it would be helpful to display > descriptions to the flags using, e.g., «compset» (for the leading plus > sign) followed by «_values -s ''». I moved the possible values to the argument description, but I don’t have enough time to figure out how to complete them automatically right now. > >> "--file-scope=[should tags scoped only for a single file be included in output]:bool:(yes no)" >> "--filter=[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)" >> "--filter-terminator=[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string" >> "--format=[force output of specified tag file format]:level" >> "--help[help text]" > > "help text" is just a noun phrase. Please use complete decsriptions. > > Please use exclusions if needed («'(--foo)--bar[baz]'»). Done. > >> "--language-force=[force all files to be interpreted using specified language]:language:->language" >> "--languages=[restrict files scanned to these comma-separated languages]:language:->languages" > > Can't say I'm a fan of having two states that differ by a single letter, > but so be it. > >> "--recurse=[recurse]:bool:(yes no)" > > Fix the bracketed description. It’s now “search files recursively”. > >> _arguments $arguments > > Pass any arguments to _arguments that may be needed (for > instance, -s). > Done. >> if [[ "$state" = language* ]]; then >> local -a languages >> languages=(`ctags --list-languages | cut -d" " -f1`) > > Use _call_program and $service. Done. > >> if [ "$state" = "language" ]; then >> _wanted languages expl language compadd $languages > > Don't pass unsanitized command output to a builtin. In this case, > «compadd -a languages» would do. Done. > >> elif [ "$state" = "languages" ]; then >> _values -s , languages $languages > > Don't pass unsanitized command output to a builtin. I don't know the > fix off the top of my head. > > Thanks for the patch, and especially for adding exubertant and BSD ctags > support! > > Daniel >