Re: unset folder-hook

2023-07-17 Thread Ed Blackman
On Mon, Jul 17, 2023 at 07:02:34AM -0500, Ranjan Maitra wrote:
> On Sun Jul16'23 10:03:01PM, Ed Blackman wrote:
> > In my .muttrc I have:
> >
> > # Set $strict_threads in large mailboxes (which are likely to have 
> > duplicated subjects)
> > folder-hook .   set strict_threads=no
> > folder-hook =sent   set strict_threads=yes
> > folder-hook =.archive*  set strict_threads=yes
> 
> Thanks very much for this, however, I get an error, when I do the following:
> 
>  folder-hook .  'unset smtp_url'; 'set strict_threads=no'
>  folder-hook '(mutt|fedora|postfix|fetchmail|openbox)' 'set from =
> em...@address.com; set smtp_url="something"; set smtp_pass="somethingelse"; 
> set
>  envelope_from_address="em...@address.com"; set use_envelope_from=yes; set 
> from = "em...@address.com"; my_hdr Bcc:; set forward_format = "[FW frm 
> %a:%s]";set realname = "Real Name"; set ssl_force_tls = yes; set ssl_starttls 
> = yes'; 'set strict_threads=yes'

I think the syntax error you're getting is because the syntax is:
 folder-hook [!]regexp command

but you have two things after the regex.  Try:

 folder-hook .  'unset smtp_url; set strict_threads=no'

See how the command is all one quoted string?

You also have a ton of settings on that one line.  You might consider:

 folder-hook . 'source ~/.mutt/folder_defaults.rc'
 folder-hook '(mutt|fedora)'   'source ~/.mutt/folder_techlists.rc'  # or 
whatever name

Then make sure that *every* setting is set (or unset) in each RC file.  So if 
you set ssl_starttls in folder_techlists.rc, you'll need to set or unset it in 
folder_defaults.rc.  Otherwise, you will have different settings depending on 
which folders you have visited.

-- 
Ed Blackman


Re: unset folder-hook

2023-07-17 Thread Ranjan Maitra
On Sun Jul16'23 10:03:01PM, Ed Blackman wrote:
> From: Ed Blackman 
> Date: Sun, 16 Jul 2023 22:03:01 -0400
> To: mutt-users@mutt.org
> Subject: Re: unset folder-hook
>
> On Thu, Jul 13, 2023 at 09:44:30AM -0500, Ranjan Maitra wrote:
> > On Thu Jul13'23 02:10:02PM, Francesco Ariis wrote:
> > > In my .muttrc I have:
> > >
> > > folder-hook sent "set something foobar"
> > > folder-hook !sent "set something something_else"
> > >
> > > maybe you can use it too in your setup?
> >
> > What if I have three sets of folder hooks in addition to the default? Also, 
> > can I not just revert the !sent (in your case) to the default, without 
> > setting everything else? I wonder if there is be a way to do the hooks only 
> > for a specific set of folders and nothing else.
>
> In my .muttrc I have:
>
> # Set $strict_threads in large mailboxes (which are likely to have duplicated 
> subjects)
> folder-hook .   set strict_threads=no
> folder-hook =sent   set strict_threads=yes
> folder-hook =.archive*  set strict_threads=yes
>
> The "." applies to every folder, and sets a default.  The last two change the 
> setting for a specific folder, and a set of folders matching a regex.
>
> --
> Ed Blackman

Thanks very much for this, however, I get an error, when I do the following:

 folder-hook .  'unset smtp_url'; 'set strict_threads=no'
 folder-hook '(mutt|fedora|postfix|fetchmail|openbox)' 'set from =
em...@address.com; set smtp_url="something"; set smtp_pass="somethingelse"; set
 envelope_from_address="em...@address.com"; set use_envelope_from=yes; set from 
= "em...@address.com"; my_hdr Bcc:; set forward_format = "[FW frm %a:%s]";set 
realname = "Real Name"; set ssl_force_tls = yes; set ssl_starttls = yes'; 'set 
strict_threads=yes'

When I go to the mutt folder, I get:

 Error in /home/email/.muttrc, line 286: set strict_threads=no: unknown command
 Error in /home/email/.muttrc, line 288: set strict_threads=yes: unknown command
 source: errors in /home/email/.muttrc

Is my syntax incorrect here? Am I missing some other package/mutt helper?

Many thanks,
Ranjan