On Fri, 25 Aug 2000, David T-G wrote:

> For some reason, though, I don't see any of my aliases.  When I
> comment out the (final)
> 
>           | grep -v '^alias[  ][      ]*[^,][^,]*[    ][      ]*[^,]*$'
> 
> line in m_muttalias, I get
> 
>   alias me-hushmail <[EMAIL PROTECTED]> (DavidTG @ hushmail)
>   alias me-bulbs-bigfoot <[EMAIL PROTECTED]> (DavidTG bulbs @ bigfoot)
>   alias me-bigfoot <[EMAIL PROTECTED]> (David @ BigFoot)
>   ...

As you can see, this is a simple grep output but sed didn't convert it
to the mutt query format, that's why the above (second) grep wipes
these lines out.

m_muttalias only understands the following formats of aliases:

alias foo User Name <foo@bar>
alias foo foo@bar (User Name)

and converts them both to 

foo@bar User Name       alias foo

Other alias syntax (like your combination of <...> and (...)) isn't
supported yet, because they don't make much sense to me and I don't
see a canonical way to realize this (if you have patches against
m_muttalias to work around the problem, let me know).

> but the grep -v seems to throw away these results.

Yes, that's intended, because the syntax of these lines isn't
recognized.

> SOOOOO...  As far as I can read the grep regexp, grep is going to
> filter out anything like
>
>   beginning of line
>   string "alias"
>   one or more space-or-tab
>   one or more not-a-comma
>   one or more space-or-tab
>   zero or more not-a-comma
>   end of line
> 
> which, I must admit, looks like it would fit my list of aliases.

The trick here is the combination of grep, grep, sed, sed, grep -v:

- I first grep selects all lines, which match the search string.
- The second grep tries to detect alias lines
- The first sed converts lines with <...> syntax to mutt query format
- The second sed converts lines with (...) syntax to mutt query format
- The grep -v wipes out all lines, which are still in the alias
  format.  This is necessary, because we need the lines in mutt query
  format and if this conversion isn't possible, wiping out all lines,
  which couldn't be converted, is the only chance.

If you provide a sed expression which converts aliases in your unusual
format (without changing other aliases!), I could add it above.

> My question is "why is m_muttalias doing this?" so that I can figure
> out if I just want to junk that last grep

This isn't a good idea, because converting these lines to mutt query
format before is necessary.

> or rewrite it to fit my alias format

Adding a line for your alias format would do the job.

Tschoeeee

        Roland

-- 
 * [EMAIL PROTECTED] * http://www.spinnaker.de/ *

PGP signature

Reply via email to