zsh-workers
 help / color / mirror / code / Atom feed
* Completion for mutt's -a command line switch
@ 2023-06-20 12:17 martin f krafft
  2023-06-20 19:28 ` Eric Cook
  2023-09-20 22:52 ` Oliver Kiddle
  0 siblings, 2 replies; 3+ messages in thread
From: martin f krafft @ 2023-06-20 12:17 UTC (permalink / raw)
  To: zsh-workers; +Cc: 941214

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

Hey,

mutt allows attaching files from the command-line:

```
mutt -a /file/one /file/two /file/three -- …
```

Basically, the rules are: `-a` takes a list of files, terminated by 
`--`.

Zsh's completion of mutt treats the argument to `-a` as optional:

```
   '*-a[attach file using MIME]::file attachment:_files' \
```

Therefore, after `-a`, mutt's completions include recipients, which 
is not correct:

```
albatross:~% mutt -a toni^D
directory
toni/
recipient
toni@…
```

Could you please help me figure out how to fix this? Basically after 
it sees `-a`, compsys should be offering `_files` until `--` is 
encountered, and also: at least one file is mandatory.

Thanks,

-- 
  .''`.   martin f. krafft <madduck@d.o> @martinkrafft
: :'  :  proud Debian developer
`. `'`   http://people.debian.org/~madduck
   `-  Debian - when you have better things to do than fixing systems
  
"he gave me his card
  he said, 'call me if they die'
  i shook his hand and said goodbye
  ran out to the street
  when a bowling ball came down the road
  and knocked me off my feet"
                                                         -- bob dylan

[-- Attachment #2: Type: text/html, Size: 2548 bytes --]

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

* Re: Completion for mutt's -a command line switch
  2023-06-20 12:17 Completion for mutt's -a command line switch martin f krafft
@ 2023-06-20 19:28 ` Eric Cook
  2023-09-20 22:52 ` Oliver Kiddle
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Cook @ 2023-06-20 19:28 UTC (permalink / raw)
  To: zsh-workers

On 6/20/23 08:17, martin f krafft wrote:
> Hey,
>
> mutt allows attaching files from the command-line:
>
> |mutt -a /file/one /file/two /file/three -- … |
>
> Basically, the rules are: |-a| takes a list of files, terminated by |--|.
>
> Zsh's completion of mutt treats the argument to |-a| as optional:
>
> |'*-a[attach file using MIME]::file attachment:_files' \ |
>
> Therefore, after |-a|, mutt's completions include recipients, which is not correct:
>
> |albatross:~% mutt -a toni^D directory toni/ recipient toni@… |
>
> Could you please help me figure out how to fix this? Basically after it sees |-a|, compsys should be offering |_files| until |--| is encountered, and also: at least one file is mandatory.
>
> Thanks,
>
> --
>
> |.''`. martin f. krafft &lt;madduck@d.o&gt; @martinkrafft : :' : proud Debian developer `. `'` http://people.debian.org/~madduck `- Debian - when you have better things to do than fixing systems "he gave me his card he said, 'call me if they die' i shook
> his hand and said goodbye ran out to the street when a bowling ball came down the road and knocked me off my feet" -- bob dylan |
>

diff --git a/Completion/Unix/Command/_mutt b/Completion/Unix/Command/_mutt
index 9686ce6f1..903389a75 100644
--- a/Completion/Unix/Command/_mutt
+++ b/Completion/Unix/Command/_mutt
@@ -3,7 +3,7 @@
  _arguments -s -S \
    '::recipient:_email_addresses -n mutt' \
    '(- :)-A[expand given alias]:alias:_email_addresses -n mutt' \
-  '*-a[attach file using MIME]::file attachment:_files' \
+  '*-a[attach file using MIME]:*:file attachment:_files' \
    '*-b[specify a BCC recipient]:BCC recipient:_email_addresses -n mutt' \
    '*-c[specify a CC recipient]:CC recipient:_email_addresses -n mutt' \
    '(- :)-D[print the value of all variables]' \



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

* Re: Completion for mutt's -a command line switch
  2023-06-20 12:17 Completion for mutt's -a command line switch martin f krafft
  2023-06-20 19:28 ` Eric Cook
@ 2023-09-20 22:52 ` Oliver Kiddle
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2023-09-20 22:52 UTC (permalink / raw)
  To: zsh-workers, 941214

On 20 Jun, martin f krafft wrote:
> mutt allows attaching files from the command-line:
>
> mutt -a /file/one /file/two /file/three -- …
>
> Basically, the rules are: -a takes a list of files, terminated by --.
>
> Zsh's completion of mutt treats the argument to -a as optional:
>
>   '*-a[attach file using MIME]::file attachment:_files' \

In theory, this should be possible with:

    '*-a[attach file using MIME]:*--:file attachment:_files' \

However, _mutt also calls _arguments with -S so if it sees -- it takes
that as the end of all options and only completes recipients
thereafter.

Oliver


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

end of thread, other threads:[~2023-09-20 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-20 12:17 Completion for mutt's -a command line switch martin f krafft
2023-06-20 19:28 ` Eric Cook
2023-09-20 22:52 ` Oliver Kiddle

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