Re: no MUTTRC environment variable?

2016-07-04 Thread Xu Wang
On Mon, Jul 4, 2016 at 12:35 AM,   wrote:
> On 03Jul2016 00:50, Xu Wang  wrote:
>>
>> Thank you very much for the replies, Will and Cameron.
>>
>> Yes, these workarounds work fine for my personal setup. However, I am
>> working on scripts that I would like to release for other users to
>> use. I do not want to require other users to refactor their .muttrcs
>> just to use the scripts. Creating user-friendsly scripts is what
>> motivates me.
>
>
> And fair enough too. I suspect then that you must explicitly invoke mutt as
> needed. This:
>
>  mutt -F /dev/null -e 'source muttrc1' -e 'source muttrc2' ...
>
> is probably the cleanest way to invoke mutt without reliance on the user's
> .muttrc, and to source whatever config you intend. You can add the "-n"
> option to also bypass and system muttrc file.
>
> Does this help?
>
> Cheers,
> Cameron Simpson 

Thank you Cameron. I will think about this option and test it. I
highly appreciate your time and thoughts.

Kind regards,

Xu


Re: no MUTTRC environment variable?

2016-07-04 Thread cs

On 03Jul2016 00:50, Xu Wang  wrote:

Thank you very much for the replies, Will and Cameron.

Yes, these workarounds work fine for my personal setup. However, I am
working on scripts that I would like to release for other users to
use. I do not want to require other users to refactor their .muttrcs
just to use the scripts. Creating user-friendsly scripts is what
motivates me.


And fair enough too. I suspect then that you must explicitly invoke mutt as 
needed. This:


 mutt -F /dev/null -e 'source muttrc1' -e 'source muttrc2' ...

is probably the cleanest way to invoke mutt without reliance on the user's 
.muttrc, and to source whatever config you intend. You can add the "-n" option 
to also bypass and system muttrc file.


Does this help?

Cheers,
Cameron Simpson 


Re: [SPAM?] Re: [SPAM?] Re: no MUTTRC environment variable?

2016-07-03 Thread Xu Wang
On Sat, Jul 2, 2016 at 8:44 PM, Will Yardley
<mutt-us...@veggiechinese.net> wrote:
> On Sat, Jul 02, 2016 at 08:13:55PM -0400, Xu Wang wrote:
>> On Thu, Jun 30, 2016 at 9:10 PM, Will Yardley
>> <mutt-us...@veggiechinese.net> wrote:
>> > On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:
>
>> >> I have read the environment variables section in 'man mutt' and there
>> >> does not seem to be a MUTTRC environment variable. One can set using
>> >> -F option but sometime environment variable is nice.
>> >
>> > What kind of uses did you have in mind?
>> >
>> > You can use environment variables in config files, so you can always
>> > work around this for most of the use cases I can think of by having
>> >
>> > source ~/.muttrc-$FOO
>> > in ~/.muttrc, and then define $FOO.
>
>> For me it is not ideal because when I execute
>> source ~/.muttrc-$FOO
>> then the rest of the .muttrc is still processed. I would like to
>> process only ~/.muttrc-$FOO.
>> I hope that has sense.
>
> I get what you're saying. But if I'm understanding what you're trying to
> do, you should be able to have .muttrc *only* contain:
>
> source ~/.muttrc-$FOO
>
> that is, it would be a meta-muttrc. You can still source other files
> from .muttrc-$FOO.
>
> w
>

Thank you very much for the replies, Will and Cameron.

Yes, these workarounds work fine for my personal setup. However, I am
working on scripts that I would like to release for other users to
use. I do not want to require other users to refactor their .muttrcs
just to use the scripts. Creating user-friendsly scripts is what
motivates me.

Kind regards,

Xu


Re: [SPAM?] Re: no MUTTRC environment variable?

2016-07-02 Thread Xu Wang
On Sun, Jul 3, 2016 at 12:43 AM, Jon LaBadie <mut...@jgcomp.com> wrote:
>> > On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:
>> >>
>> >> I have read the environment variables section in 'man mutt' and there
>> >> does not seem to be a MUTTRC environment variable. One can set using
>> >> -F option but sometime environment variable is nice.
>> >>
>> >> Can someone confirm this is correct? Is there a reason for this?
>> >
>
> How about implementing your own with a mutt alias?
>
>
>   alias mutt='mutt ${MUTTRC:+-F ${MUTTRC}}'
>
> If MUTTRC is not set, or is the empty string, this becomes
> just "mutt" and ~/.muttrc will be used as normal.  But if
> MUTTRC is set it becomes "mutt -F ${MUTTRC}" and uses the
> rc file specified in the variable.
>
> Jon
> --
> Jon H. LaBadie j...@jgcomp.com
>  11226 South Shore Rd.  (703) 787-0688 (H)
>  Reston, VA  20190  (703) 935-6720 (C)

Interesting idea, Jon! I will consider this for my personal setup.

Kind regards,

Xu


Re: [SPAM?] Re: no MUTTRC environment variable?

2016-07-02 Thread Jon LaBadie
> > On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:
> >>
> >> I have read the environment variables section in 'man mutt' and there
> >> does not seem to be a MUTTRC environment variable. One can set using
> >> -F option but sometime environment variable is nice.
> >>
> >> Can someone confirm this is correct? Is there a reason for this?
> >

How about implementing your own with a mutt alias?


  alias mutt='mutt ${MUTTRC:+-F ${MUTTRC}}'

If MUTTRC is not set, or is the empty string, this becomes
just "mutt" and ~/.muttrc will be used as normal.  But if
MUTTRC is set it becomes "mutt -F ${MUTTRC}" and uses the
rc file specified in the variable.

Jon
-- 
Jon H. LaBadie j...@jgcomp.com
 11226 South Shore Rd.  (703) 787-0688 (H)
 Reston, VA  20190  (703) 935-6720 (C)


[SPAM?] Re: [SPAM?] Re: no MUTTRC environment variable?

2016-07-02 Thread Will Yardley
On Sat, Jul 02, 2016 at 08:13:55PM -0400, Xu Wang wrote:
> On Thu, Jun 30, 2016 at 9:10 PM, Will Yardley
> <mutt-us...@veggiechinese.net> wrote:
> > On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:

> >> I have read the environment variables section in 'man mutt' and there
> >> does not seem to be a MUTTRC environment variable. One can set using
> >> -F option but sometime environment variable is nice.
> >
> > What kind of uses did you have in mind?
> >
> > You can use environment variables in config files, so you can always
> > work around this for most of the use cases I can think of by having
> >
> > source ~/.muttrc-$FOO
> > in ~/.muttrc, and then define $FOO.

> For me it is not ideal because when I execute
> source ~/.muttrc-$FOO
> then the rest of the .muttrc is still processed. I would like to
> process only ~/.muttrc-$FOO.
> I hope that has sense.

I get what you're saying. But if I'm understanding what you're trying to
do, you should be able to have .muttrc *only* contain:

source ~/.muttrc-$FOO

that is, it would be a meta-muttrc. You can still source other files
from .muttrc-$FOO.

w



Re: [SPAM?] Re: no MUTTRC environment variable?

2016-07-02 Thread cs

On 02Jul2016 20:13, Xu Wang <xuwang...@gmail.com> wrote:

On Thu, Jun 30, 2016 at 9:10 PM, Will Yardley
<mutt-us...@veggiechinese.net> wrote:

On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:

I have read the environment variables section in 'man mutt' and there
does not seem to be a MUTTRC environment variable. One can set using
-F option but sometime environment variable is nice.

Can someone confirm this is correct? Is there a reason for this?


What kind of uses did you have in mind?
You can use environment variables in config files, so you can always
work around this for most of the use cases I can think of by having

source ~/.muttrc-$FOO
in ~/.muttrc, and then define $FOO.


Thank you for responding. That is good tricky to know. You said "for
most of the use cases I can think of". What is the use case you can
think of where the tricky above will not function?

For me it is not ideal because when I execute
source ~/.muttrc-$FOO
then the rest of the .muttrc is still processed. I would like to
process only ~/.muttrc-$FOO.
I hope that has sense.


What about this:

 .muttrc
   source .muttrc-$FOO

 .muttrc-default
   all your normal settings

and set $FOO (well, probably something like $MUTT_PROFILE_NAME) to 'default' in 
your .profile.


That way your .muttrc runs only the .muttrc-whatever you ask for, and by 
default runs your normal settings.


Cheers,
Cameron Simpson <c...@zip.com.au>


[SPAM?] Re: no MUTTRC environment variable?

2016-06-30 Thread Will Yardley
On Thu, Jun 30, 2016 at 08:02:38PM -0400, Xu Wang wrote:
> 
> I have read the environment variables section in 'man mutt' and there
> does not seem to be a MUTTRC environment variable. One can set using
> -F option but sometime environment variable is nice.
> 
> Can someone confirm this is correct? Is there a reason for this?

What kind of uses did you have in mind?

You can use environment variables in config files, so you can always
work around this for most of the use cases I can think of by having

source ~/.muttrc-$FOO
in ~/.muttrc, and then define $FOO.

w



no MUTTRC environment variable?

2016-06-30 Thread Xu Wang
Hello,

I have read the environment variables section in 'man mutt' and there
does not seem to be a MUTTRC environment variable. One can set using
-F option but sometime environment variable is nice.

Can someone confirm this is correct? Is there a reason for this?

Kind regards,

Xu