Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
On Thu, Jan 27, 2022 at 10:46:53PM +0300, Oleg A. Mamontov wrote:
> I successfully use the below approach for syncing current folder with
> the same on IMAP:
> ---
> folder-hook . "source ~/.mutt/on-folder-change.muttrc"
> ---
> 
> where on-folder-change.muttrc is:
> ---
> set record = ^
> set my_folder = `echo $record | sed 's#.*/##'`
> macro index,pager o ":unset wait_keyclear; printf 
> '# syncing =$my_folder\\n\\n'; mbsync $my_folder:set wait_key" 
> "sync current folder" 
> ---
> 
> Hope this helps.
> 
Yes, thank you.  I have another possible approach now but the above
could well be a better way.

-- 
Chris Green


Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Oleg A. Mamontov

I successfully use the below approach for syncing current folder with
the same on IMAP:
---
folder-hook . "source ~/.mutt/on-folder-change.muttrc"
---

where on-folder-change.muttrc is:
---
set record = ^
set my_folder = `echo $record | sed 's#.*/##'`
macro index,pager o ":unset wait_keyclear; printf '# syncing =$my_folder\\n\\n'; 
mbsync $my_folder:set wait_key" "sync current folder"
---

Hope this helps.

On Thu, Jan 27, 2022 at 06:58:57PM +, Chris Green wrote:

On Thu, Jan 27, 2022 at 06:07:39PM +, Sam Kuper wrote:

On Thu, Jan 27, 2022 at 05:31:01PM +, Chris Green wrote:
> Is there a way of accessing the current mailbox name (i.e. for maildir
> the directory name) in mutt?

IIRC, the caret symbol (^) can be used as a shortcut for the current
mailbox.

Possibly relevant sections of the manual:

http://www.mutt.org/doc/manual/#shortcuts

http://www.mutt.org/doc/manual/#folder-hook

http://www.mutt.org/doc/manual/#mailbox-hook


> This is so I can put it in things like a 'set editor='
> command to pass to the 'editor'.

Haven't tried using a caret in such a command myself.  Let us know how
you get on.


I tried 'set my_xxx=^' and it just set the variable to ^ which wasn't
very helpful!

--
Chris Green


--
Cheers,
Oleg A. Mamontov

mailto: o...@mamontov.net

skype:  lonerr11
cell:   +7 (903) 798-1352


Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
On Thu, Jan 27, 2022 at 06:07:39PM +, Sam Kuper wrote:
> On Thu, Jan 27, 2022 at 05:31:01PM +, Chris Green wrote:
> > Is there a way of accessing the current mailbox name (i.e. for maildir
> > the directory name) in mutt?
> 
> IIRC, the caret symbol (^) can be used as a shortcut for the current
> mailbox.
> 
> Possibly relevant sections of the manual:
> 
> http://www.mutt.org/doc/manual/#shortcuts
> 
> http://www.mutt.org/doc/manual/#folder-hook
> 
> http://www.mutt.org/doc/manual/#mailbox-hook
> 
> 
> > This is so I can put it in things like a 'set editor='
> > command to pass to the 'editor'.
> 
> Haven't tried using a caret in such a command myself.  Let us know how
> you get on.
> 
I tried 'set my_xxx=^' and it just set the variable to ^ which wasn't
very helpful!

-- 
Chris Green


Re: Can one get at the current mailbox name (directory)?

2022-01-27 Thread Sam Kuper
On Thu, Jan 27, 2022 at 05:31:01PM +, Chris Green wrote:
> Is there a way of accessing the current mailbox name (i.e. for maildir
> the directory name) in mutt?

IIRC, the caret symbol (^) can be used as a shortcut for the current
mailbox.

Possibly relevant sections of the manual:

http://www.mutt.org/doc/manual/#shortcuts

http://www.mutt.org/doc/manual/#folder-hook

http://www.mutt.org/doc/manual/#mailbox-hook


> This is so I can put it in things like a 'set editor='
> command to pass to the 'editor'.

Haven't tried using a caret in such a command myself.  Let us know how
you get on.


Best wishes,

Sam

-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.


Can one get at the current mailbox name (directory)?

2022-01-27 Thread Chris Green
Is there a way of accessing the current mailbox name (i.e. for maildir
the directory name) in mutt?

This is so I can put it in things like a 'set editor='
command to pass to the 'editor'.

-- 
Chris Green