zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/3] Document _dir_list.
@ 2016-10-22 21:54 Daniel Shahaf
  2016-10-22 21:54 ` [PATCH 2/3] Document _email_addresses Daniel Shahaf
  2016-10-22 21:54 ` [PATCH 3/3] _tilde_files: Offer named directories. Document Daniel Shahaf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-10-22 21:54 UTC (permalink / raw)
  To: zsh-workers

---
 Doc/Zsh/compsys.yo | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index a56ca67..f56daa4 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -4357,6 +4357,21 @@ matches.  Almost all calls to tt(compadd) within the completion system use
 a similar format; this ensures that user-specified styles are correctly
 passed down to the builtins which implement the internals of completion.
 )
+findex(_dir_list)
+item(tt(_dir_list) [ tt(-s) var(sep) ] [ tt(-S) ])(
+Complete a list of directory names separated by colons
+(the same format as tt($PATH)).
+
+startitem()
+item(tt(-s) var(sep))(
+Use var(sep) as separator between items.
+var(sep) defaults to a colon (`tt(:)').
+)
+item(tt(-S))(
+Add var(sep) instead of slash (`tt(/)') as an autoremoveable suffix.
+)
+enditem()
+)
 findex(_dispatch)
 item(tt(_dispatch) var(context string) ...)(
 This sets the current context to var(context) and looks for completion


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

* [PATCH 2/3] Document _email_addresses.
  2016-10-22 21:54 [PATCH 1/3] Document _dir_list Daniel Shahaf
@ 2016-10-22 21:54 ` Daniel Shahaf
  2016-10-22 21:54 ` [PATCH 3/3] _tilde_files: Offer named directories. Document Daniel Shahaf
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-10-22 21:54 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Type/_email_addresses |  2 ++
 Doc/Zsh/compsys.yo                    | 42 +++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index 7d5c942..8a5877a 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -5,6 +5,8 @@
 # -s sep    - complete a list of addresses separated by specified character
 # -c        - e-mail address must be of form user@host (no comments or aliases)
 #
+# TODO: with -n, have the named plugin complete not only aliases but also addresses?
+# 
 # Plugins are written as separate functions with names starting `_email-'.
 # They should either do their own completion or return the addresses in the
 # reply array in the form 'alias:address' and return 300. The -c option is
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index f56daa4..33ba92c 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -826,6 +826,10 @@ kindex(domains, completion tag)
 item(tt(domains))(
 for network domains
 )
+kindex(email-*, completion tag)
+item(tt(email-)var(plugin))(
+for email addresses from the `tt(_email-)var(plugin)' backend of tt(_email_addresses)
+)
 kindex(expansions, completion tag)
 item(tt(expansions))(
 used by the tt(_expand) completer for individual words (as opposed to
@@ -4387,6 +4391,44 @@ tt($service) to the var(string) being tried, and sets
 the var(context/command) field (the fourth) of the tt($curcontext)
 parameter to the var(context) given as the first argument.
 )
+findex(_email_addresses)
+item(tt(_email_addresses) [ tt(-c) ] [ tt(-n) var(plugin) ])(
+Complete email addresses.  Addresses are provided by plugins.
+
+startitem()
+item(tt(-c))(
+Complete bare tt(localhost@domain.tld) addresses, without a name part or
+a comment.
+Without this option, RFC822 `var(Firstname Lastname) tt(<)var(address)tt(>)'
+strings are completed.
+)
+item(tt(-n) var(plugin))(
+Complete aliases from var(plugin).  
+)
+COMMENT(Intentionally leaving tt(-s) undocumented: new code should use
+tt(_sequence) instead.)\
+enditem()
+
+The following plugins are available by default:
+tt(_email-ldap) (see the tt(filter) style),
+tt(_email-local) (completes var(user)tt(@)var(hostname) Unix addresses),
+tt(_email-mail) (completes aliases from tt(~/.mailrc)),
+tt(_email-mush),
+tt(_email-mutt),
+and
+tt(_email-pine).
+
+Addresses from the tt(_email-)var(foo) plugin are added under the
+tag `tt(email-)var(foo)'.
+
+em(Writing plugins)
+
+Plugins are written as separate functions with names starting with `tt(_email-)'.
+They are invoked with the tt(-c) option and tt(compadd) options.
+They should either do their own completion or
+set the tt($reply) array to a list of `var(alias)tt(:)var(address)' elements and return tt(300).
+New plugins will be picked up and run automatically.
+)
 findex(_files)
 item(tt(_files))(
 The function tt(_files) calls tt(_path_files) with all the arguments it


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

* [PATCH 3/3] _tilde_files: Offer named directories. Document.
  2016-10-22 21:54 [PATCH 1/3] Document _dir_list Daniel Shahaf
  2016-10-22 21:54 ` [PATCH 2/3] Document _email_addresses Daniel Shahaf
@ 2016-10-22 21:54 ` Daniel Shahaf
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Shahaf @ 2016-10-22 21:54 UTC (permalink / raw)
  To: zsh-workers

---
It would be nice if the named-directories completion would use _describe
with the hash's keys as completions and its values as descriptions.

However, that's for another day.

Cheers,

Daniel


 Completion/Unix/Type/_tilde_files | 3 ++-
 Doc/Zsh/compsys.yo                | 6 ++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Type/_tilde_files b/Completion/Unix/Type/_tilde_files
index ee6b180..b1b3b37 100644
--- a/Completion/Unix/Type/_tilde_files
+++ b/Completion/Unix/Type/_tilde_files
@@ -30,7 +30,8 @@ case "$PREFIX" in
   ;;
 \~*)
   compset -P '?'
-  _users "$@"
+  local -a expl=( "$@" )
+  _alternative -O expl users:user:_users named-directories:'named directory':'compadd -k nameddirs'
   ;;
 *)
   _files "$@"
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 33ba92c..4248276 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -5019,6 +5019,12 @@ allows tt(_tags) to use a more
 specific context without having to change and reset the
 tt(curcontext) parameter (which has the same effect).
 )
+findex(_tilde_files)
+item(tt(_tilde_files))(
+Like tt(_files), but resolve leading tildes according to the rules of
+filename expansion, so the suggested completions don't start with
+a `tt(~)' even if the filename on the command-line does.
+)
 findex(_values)
 item(tt(_values) [ tt(-O) var(name) ] [ tt(-s) var(sep) ] [ tt(-S) var(sep) ] [ tt(-wC) ] var(desc) var(spec) ...)(
 This is used to complete arbitrary keywords (values) and their arguments,


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

end of thread, other threads:[~2016-10-22 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-22 21:54 [PATCH 1/3] Document _dir_list Daniel Shahaf
2016-10-22 21:54 ` [PATCH 2/3] Document _email_addresses Daniel Shahaf
2016-10-22 21:54 ` [PATCH 3/3] _tilde_files: Offer named directories. Document Daniel Shahaf

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).