Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-10-01 Thread Sam Kuper
On Wed, Sep 30, 2020 at 04:39:52PM +0100, Chris Green wrote:
> On Wed, Sep 30, 2020 at 03:20:50PM +0100, Sam Kuper wrote:
>> On Wed, Sep 30, 2020 at 02:18:08PM +0100, Chris Green wrote:
>>> I've attached them here anyway.
>> 
>> Thanks :)  Would you be willing to mention a license? [..]
>
> OK, I've gone with Apache v2, attached again here.

Thank you! :)

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


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Cameron Simpson
On 30Sep2020 15:20, Sam Kuper  wrote:
>On Wed, Sep 30, 2020 at 02:18:08PM +0100, Chris Green wrote:
>> Absolutely no problem, is there a place to put them on mutt.org? [..]
>> I keep the code in mercurial [..]
>
>Best bet would probably be to:
>
>1. Upload the files to a code hosting repository: gitlab.com;
>sourcehut.org; notabug.org; or similar.  (Sourcehut.org supports
>Mercurial directly; I think the others only support Git.)

Aye. I use Mercurial too. My primary publication site is sourcehut, but 
I maintain git mirrors on github and bitbucket (I used to use bitbucket 
before they dropped Mercurial and I like their commit history view).

So: sourcehut is the easiest place: https://hg.sr.ht/

If you want to publish to a git-based site there's the hg-git extension, 
which works fine but relies on bookmarks, which must have distinct names 
from your branch names. I've got a script hg-gitup which will push your 
branch names up instead (still uses the hg-git extension for maintaining 
the git state, but pushes with git to avoid the naming issue):

  https://hg.sr.ht/~cameron-simpson/css/browse/bin/hg-gitup?rev=tip

Cheers,
Cameron Simpson 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Kevin J. McCarthy

On Wed, Sep 30, 2020 at 04:50:19PM +0100, Chris Green wrote:

On Wed, Sep 30, 2020 at 03:20:50PM +0100, Sam Kuper wrote:

2. Having done that, I guess you could (subject to Kevin McCarthy's
approval - he's the Mutt maintainer and I can't speak for him) perhaps
edit https://gitlab.com/muttmua/mutt/-/wikis/ConfigTricks to add a
sentence or two describing your tools and linking to the hosted version
of them that you created in the previous step.


What does the (mutt) world think about doing this?  I'm happy to do it
if there's a lot of interest but if only a few are interested then
I'll just leave at putting them up here as attachments (as I have done).


The wiki is for the community; it's just an unfortunate limitation of 
GitLab's wiki permissions that I can't open editing up wider for now.


If you would like to add a link and blurb, either open a ticket, or 
clone the git repos  and open a Merge 
Request.


--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Chris Green
On Wed, Sep 30, 2020 at 03:20:50PM +0100, Sam Kuper wrote:
> On Wed, Sep 30, 2020 at 02:18:08PM +0100, Chris Green wrote:
> > On Wed, Sep 30, 2020 at 12:03:41PM +0100, Sam Kuper wrote:
> >> On Tue, Sep 29, 2020 at 08:13:14AM +0100, Chris Green wrote:
> >>> On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
>  I confess to some curiosity here...  What are you doing in your
>  home-grown MDA
> >>>
> >>> It's all driven from one text file so that when I subscribe to a new
> >>> mailing list all I have to do is add an entry to that file.
> >> 
> >> Nice!  If you would be willing to publish/share the Python files
> >> (under a Free Software license), that would be great :)
> >
> > Absolutely no problem, is there a place to put them on mutt.org? [..]
> > I keep the code in mercurial [..]
> 
> Best bet would probably be to:
> 
> 1. Upload the files to a code hosting repository: gitlab.com;
> sourcehut.org; notabug.org; or similar.  (Sourcehut.org supports
> Mercurial directly; I think the others only support Git.)
> 
> 2. Having done that, I guess you could (subject to Kevin McCarthy's
> approval - he's the Mutt maintainer and I can't speak for him) perhaps
> edit https://gitlab.com/muttmua/mutt/-/wikis/ConfigTricks to add a
> sentence or two describing your tools and linking to the hosted version
> of them that you created in the previous step.
> 
What does the (mutt) world think about doing this?  I'm happy to do it
if there's a lot of interest but if only a few are interested then
I'll just leave at putting them up here as attachments (as I have done).

-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Chris Green
On Wed, Sep 30, 2020 at 03:20:50PM +0100, Sam Kuper wrote:
> On Wed, Sep 30, 2020 at 02:18:08PM +0100, Chris Green wrote:
> 
> > I've attached them here anyway.
> 
> Thanks :)  Would you be willing to mention a license?
> 
> Without a license, your scripts are technically non-free software, i.e.
> others don't have the right to distribute them, modify them, or share
> their modifications.
> 
> I'd suggest AGPLv3 as a good default Free Software license
> https://www.gnu.org/licenses/license-list.html#AGPLv3.0 ; but given that
> these are small (<300LOC) programs, you might prefer a "pushover"
> license like Apache v2:
> https://www.gnu.org/licenses/license-recommendations.html#small
> https://www.gnu.org/licenses/license-list.html#apache2 .
> 
OK, I've gone with Apache v2, attached again here.

-- 
Chris Green
#!/usr/bin/python3
#
#
# licenseApache v2 (http://www.apache.org/licenses/LICENSE-2.0) 
# author Chris Green - ch...@isbd.co.uk
# 
#
#
# Mail filtering script
#
import mailbox
import os
import sys
import time
import mailLib
import shlex
#
#
# Redirect any exceptions to a file
#
sys.stderr = open("/home/chris/tmp/mail.err", 'a')
#
#
# Some constants (i.e. configuration)
#
home = "/home/chris"
logfile = home + "/tmp/mail.log"
filtfile = home + "/.mutt/filter"
mldir = home + "/mail/"
indir = mldir + "In/"
judir = mldir + "Ju/"
#
#
# Set to log to mail.log in ~/tmp with name 'filter' and the envelope/from
#
log = mailLib.initLog("filter")
#
#
# Initialise destination mailbox name to empty
#
dest = ""
#
#
# Read the message from standard input and make a message object from it
#
msg = mailbox.MaildirMessage(sys.stdin.buffer.read())
#
#
# Extract the To:, Cc: and Subject: headers and the envelope/from
#
msgcc = msg.get("Cc", "unknown").lower()
msgto = msg.get("To", "unknown").lower()
msgsb = msg.get("Subject", "unknown")
msgfm = msg.get("From", "unknown").lower()
#
#
# See if it's in our filter file
#
f = open(filtfile, 'r')
for ln in f:# for each line in filter
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields, shlex.split() does quoted strings, add a field
# to create a dummy fourth field if there isn't one in the filter file
#
fld = shlex.split(ln)
fld.append("")
#
#
# copy the fields into better named variables
#
nm = fld[0] # name/alias
dd = fld[1] + "/"   # destination directory
tocc = fld[2].lower()   # list address
sbstrip = '[' + fld[3] + ']'# string to match in and/or strip out of subject
#
#
# see if the filter To/CC column matches the message To: or Cc: or if sbstrip is in Subject:
#
if (tocc in msgcc or tocc in msgto or sbstrip in msgsb):
#
#
# set the destination directory
#
dest = mldir + dd + nm
#
#
# Strip out list name (4th field) from subject if it's there
#
if sbstrip in msgsb:
msg.replace_header("Subject", msgsb.replace(sbstrip, ''))
#
#
# we've found a match so assume we won't get another
#
break
#
#
# if destination mb name hasn't been set yet then set to In/default
# (mail with 'chris' in destination will get to 'inbox')
#
if dest == "":
dest = indir + "default"

mailLib.deliverMdMsg(dest, msg, log)
#!/usr/bin/python
#
#
# licenseApache v2 (http://www.apache.org/licenses/LICENSE-2.0) 
# author Chris Green - ch...@isbd.co.uk
# 
import sys
#
#
#
#
home = "/home/chris"
filtfile = home + "/.mutt/filter"
#
#
# Get mailing lists from filter file
#
f = open(filtfile, 'r')
for ln in f:
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields
#
fld = ln.split()
tocc = fld[2]

if (":x" in fld[1]):
continue
sys.stdout.write("alias ")
sys.stdout.write(fld[0] + " ")
sys.stdout.write(tocc + "\n")
#!/usr/bin/python
#
#
# licenseApache v2 (http://www.apache.org/licenses/LICENSE-2.0) 
# author Chris Green - ch...@isbd.co.uk
# 
import sys
#
#
#
#
home = "/home/chris"
filtfile = home + "/.mutt/filter"

#
#
# Get mailing lists from filter file
#
f = open(filtfile, 'r')
for ln in f:
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields
#
fld = ln.split()
if (fld[1][0:4] == "Li:x"):
continue# don't output if there's an x flag
if (fld[1][0:2] == "Li"):
sys.stdout.write(fld[2] + " ")# output the list address
#
#
# licenseApache v2 (http://www.apache.org/licenses/LICENSE-2.0) 
# author Chris Green - ch...@isbd.co.uk
# 
import mailbox
import logging
import logging.handlers
import os
import time
#
#
# log a message
#
def initLog(name):
log = logging.getLogger(name)
log.setLevel(logging.DEBUG)
f = 

Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Sam Kuper
On Wed, Sep 30, 2020 at 02:18:08PM +0100, Chris Green wrote:
> On Wed, Sep 30, 2020 at 12:03:41PM +0100, Sam Kuper wrote:
>> On Tue, Sep 29, 2020 at 08:13:14AM +0100, Chris Green wrote:
>>> On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
 I confess to some curiosity here...  What are you doing in your
 home-grown MDA
>>>
>>> It's all driven from one text file so that when I subscribe to a new
>>> mailing list all I have to do is add an entry to that file.
>> 
>> Nice!  If you would be willing to publish/share the Python files
>> (under a Free Software license), that would be great :)
>
> Absolutely no problem, is there a place to put them on mutt.org? [..]
> I keep the code in mercurial [..]

Best bet would probably be to:

1. Upload the files to a code hosting repository: gitlab.com;
sourcehut.org; notabug.org; or similar.  (Sourcehut.org supports
Mercurial directly; I think the others only support Git.)

2. Having done that, I guess you could (subject to Kevin McCarthy's
approval - he's the Mutt maintainer and I can't speak for him) perhaps
edit https://gitlab.com/muttmua/mutt/-/wikis/ConfigTricks to add a
sentence or two describing your tools and linking to the hosted version
of them that you created in the previous step.


> I've attached them here anyway.

Thanks :)  Would you be willing to mention a license?

Without a license, your scripts are technically non-free software, i.e.
others don't have the right to distribute them, modify them, or share
their modifications.

I'd suggest AGPLv3 as a good default Free Software license
https://www.gnu.org/licenses/license-list.html#AGPLv3.0 ; but given that
these are small (<300LOC) programs, you might prefer a "pushover"
license like Apache v2:
https://www.gnu.org/licenses/license-recommendations.html#small
https://www.gnu.org/licenses/license-list.html#apache2 .

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


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Patrick Shanahan
* Chris Green  [09-30-20 09:18]:
> On Wed, Sep 30, 2020 at 12:03:41PM +0100, Sam Kuper wrote:
> > On Tue, Sep 29, 2020 at 08:13:14AM +0100, Chris Green wrote:
> > > On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
> > >> I confess to some curiosity here...  What are you doing in your
> > >> home-grown MDA, that you could not already do with procmail, which
> > >> (if you're on a Linux system at least) your mail system is most
> > >> likely already using to deliver your mail?
> > >
> > > It's all driven from one text file so that when I subscribe to a new
> > > mailing list all I have to do is add an entry to that file.  No
> > > changing of procmail rules, no additions to muttrc.  I have attached
> > > the filter file to this message, the comments explain it at least as
> > > well as I can here. [..]
> > >
> > > # Mail filterfile, used to generate Mutt aliases and for filtering
> > > # mail into mailboxes, it's used by:-
> > > #   getAliases.py - generates mutt aliases for the mailing lists
> > > #   getLists.py - generates list names for mutt 'subscribe' and
> > > #   'lists' commands
> > > #   filter.py - called by .forward, delivers mail to appropriate
> > > #   mail box
> > 
> > Nice!  If you would be willing to publish/share the Python files (under
> > a Free Software license), that would be great :)
> > 
> Absolutely no problem, is there a place to put them on mutt.org?  I've
> attached them here anyway.  I've recently upgraded them to Python 3
> and, of course, to maildir.  If anyone wants the mbox versions I could
> probably provide them as I keep the code in mercurial.

I would appreciate seeing the mbox version(s).

tks

-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  @ptilopteri
http://en.opensuse.orgopenSUSE Community Memberfacebook/ptilopteri
Photos: http://wahoo.no-ip.org/piwigo   paka @ IRCnet freenode


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Chris Green
On Wed, Sep 30, 2020 at 12:03:41PM +0100, Sam Kuper wrote:
> On Tue, Sep 29, 2020 at 08:13:14AM +0100, Chris Green wrote:
> > On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
> >> I confess to some curiosity here...  What are you doing in your
> >> home-grown MDA, that you could not already do with procmail, which
> >> (if you're on a Linux system at least) your mail system is most
> >> likely already using to deliver your mail?
> >
> > It's all driven from one text file so that when I subscribe to a new
> > mailing list all I have to do is add an entry to that file.  No
> > changing of procmail rules, no additions to muttrc.  I have attached
> > the filter file to this message, the comments explain it at least as
> > well as I can here. [..]
> >
> > # Mail filterfile, used to generate Mutt aliases and for filtering
> > # mail into mailboxes, it's used by:-
> > #   getAliases.py - generates mutt aliases for the mailing lists
> > #   getLists.py - generates list names for mutt 'subscribe' and
> > #   'lists' commands
> > #   filter.py - called by .forward, delivers mail to appropriate
> > #   mail box
> 
> Nice!  If you would be willing to publish/share the Python files (under
> a Free Software license), that would be great :)
> 
Absolutely no problem, is there a place to put them on mutt.org?  I've
attached them here anyway.  I've recently upgraded them to Python 3
and, of course, to maildir.  If anyone wants the mbox versions I could
probably provide them as I keep the code in mercurial.



-- 
Chris Green
#!/usr/bin/python3
#
#
# Mail filtering script
#
import mailbox
import os
import sys
import time
import mailLib
import shlex
#
#
# Redirect any exceptions to a file
#
sys.stderr = open("/home/chris/tmp/mail.err", 'a')
#
#
# Some constants (i.e. configuration)
#
home = "/home/chris"
logfile = home + "/tmp/mail.log"
filtfile = home + "/.mutt/filter"
mldir = home + "/mail/"
indir = mldir + "In/"
judir = mldir + "Ju/"
#
#
# Set to log to mail.log in ~/tmp with name 'filter' and the envelope/from
#
log = mailLib.initLog("filter")
#
#
# Initialise destination mailbox name to empty
#
dest = ""
#
#
# Read the message from standard input and make a message object from it
#
msg = mailbox.MaildirMessage(sys.stdin.buffer.read())
#
#
# Extract the To:, Cc: and Subject: headers and the envelope/from
#
msgcc = msg.get("Cc", "unknown").lower()
msgto = msg.get("To", "unknown").lower()
msgsb = msg.get("Subject", "unknown")
msgfm = msg.get("From", "unknown").lower()
#
#
# See if it's in our filter file
#
f = open(filtfile, 'r')
for ln in f:# for each line in filter
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields, shlex.split() does quoted strings, add a field
# to create a dummy fourth field if there isn't one in the filter file
#
fld = shlex.split(ln)
fld.append("")
#
#
# copy the fields into better named variables
#
nm = fld[0] # name/alias
dd = fld[1] + "/"   # destination directory
tocc = fld[2].lower()   # list address
sbstrip = '[' + fld[3] + ']'# string to match in and/or strip out of subject
#
#
# see if the filter To/CC column matches the message To: or Cc: or if sbstrip is in Subject:
#
if (tocc in msgcc or tocc in msgto or sbstrip in msgsb):
#
#
# set the destination directory
#
dest = mldir + dd + nm
#
#
# Strip out list name (4th field) from subject if it's there
#
if sbstrip in msgsb:
msg.replace_header("Subject", msgsb.replace(sbstrip, ''))
#
#
# we've found a match so assume we won't get another
#
break
#
#
# if destination mb name hasn't been set yet then set to In/default
# (mail with 'chris' in destination will get to 'inbox')
#
if dest == "":
dest = indir + "default"

mailLib.deliverMdMsg(dest, msg, log)
#!/usr/bin/python
import sys
#
#
#
#
home = "/home/chris"
filtfile = home + "/.mutt/filter"
#
#
# Get mailing lists from filter file
#
f = open(filtfile, 'r')
for ln in f:
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields
#
fld = ln.split()
tocc = fld[2]

if (":x" in fld[1]):
continue
sys.stdout.write("alias ")
sys.stdout.write(fld[0] + " ")
sys.stdout.write(tocc + "\n")
#!/usr/bin/python
import sys
#
#
#
#
home = "/home/chris"
filtfile = home + "/.mutt/filter"

#
#
# Get mailing lists from filter file
#
f = open(filtfile, 'r')
for ln in f:
if ln[0] == '#':# ignore comments
continue
#
#
# split the line into fields
#
fld = ln.split()
if (fld[1][0:4] == "Li:x"):
continue# don't output if there's an x flag
if (fld[1][0:2] == "Li"):
sys.stdout.write(fld[2] + " ")# 

Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Sam Kuper
On Tue, Sep 29, 2020 at 08:13:14AM +0100, Chris Green wrote:
> On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
>> I confess to some curiosity here...  What are you doing in your
>> home-grown MDA, that you could not already do with procmail, which
>> (if you're on a Linux system at least) your mail system is most
>> likely already using to deliver your mail?
>
> It's all driven from one text file so that when I subscribe to a new
> mailing list all I have to do is add an entry to that file.  No
> changing of procmail rules, no additions to muttrc.  I have attached
> the filter file to this message, the comments explain it at least as
> well as I can here. [..]
>
> # Mail filterfile, used to generate Mutt aliases and for filtering
> # mail into mailboxes, it's used by:-
> #   getAliases.py - generates mutt aliases for the mailing lists
> #   getLists.py - generates list names for mutt 'subscribe' and
> #   'lists' commands
> #   filter.py - called by .forward, delivers mail to appropriate
> #   mail box

Nice!  If you would be willing to publish/share the Python files (under
a Free Software license), that would be great :)

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


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-30 Thread Sam Kuper
On Wed, Sep 23, 2020 at 09:04:11AM +0100, Chris Green wrote:
> On Wed, Sep 23, 2020 at 09:44:22AM +1000, raf wrote:
>> On Tue, Sep 22, 2020 at 06:30:52PM +0100, Chris Green wrote:
>>> On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
 Is there some way I can get to use real directories to represent my
 hierarchy of mail?

>From more recent emails in this thread, I see that you answered (in the
affirmative) your question above.

Still, for sake of completeness/posterity.


 I manually rearrange my mail sometimes and to
 deal with very long directory names isn't really practical. For
 example I might decide to move mail as follows:-
 
 ~/Mail/folder/travel/zelmaFrance 
 
 to
 
 ~/Mail/folder/travel/france/zelma
 
 With real directories such a move isn't too difficult but with the
 default maildir naming it becomes painful.

Painful how?


 Some software I believe does work the way I want with maildir but
 the dotted hierarchy seems to be becoming the standard.  Is there
 no way round this?  I'd really like to move to maildir but I really
 can't see it being practical for me as it is.
 
>>> I just run mb2md on my existing mail folders, I ended up with a
>>> single directory (~/Maildir) containing 2354 files mostly with
>>> ridiculously long names!  This just isn't a sensible way to organise
>>> my mail.
>> 
>> I might be talking nonsense, but that maildir hierarchy probably is
>> the correct thing, as defined by whoever came up with it, and is what
>> is needed for all(?) mail software that deals with maildir to work.

IIRC:

- Maildir was invented by Daniel J. Bernstein, author of the Qmail MTA.

- Maildir++, which extends Maildir, was invented by Sam Varshavchik,
  author of the Courier MTA.

I may be wrong, but I believe that with Mutt you can use either Maildir
or Maildir++ as you prefer.


>> But if you want to manipulate the hierarchy separately from mail
>> software, and still have all mail software work correctly, you might
>> be able to implement (or convince someone to implement) a userspace
>> fuse file system that provides an alternative view of the real
>> maildir file system, that can be mounted alongside the real maildir
>> directory. Then, whatever mail software you want to use can work with
>> the real maildir hierarchy, and you can manipulate it in the way you
>> want outside of mail software. I have no idea how much effort would
>> be involved in such a fuse file system, though.

Creating a FUSE overlay is probably substantially more effort than using
an existing tool designed for the task, e.g. an MDA such as:

- Procmail

- Maildrop (part of Sam Varshavchik's suite of Courier-related software)

- Sieve (there are various implementations, of which Dovecot's is
  perhaps the most widely used; but installing Dovecot is probably
  overkill for a client machine rather than a server, so Procmail or
  Maildrop might be better choices)



> The only things dealing with the maildirs are my own mail filter
> written in Python and mutt, nothing else.

Python should be able to handle Maildir and Maildir++ equally well:

Maildir is a directory-based mailbox format invented for the qmail
mail transfer agent and now widely supported by other programs.
Messages in a Maildir mailbox are stored in separate files within a
common directory structure. This design allows Maildir mailboxes to
be accessed and modified by multiple unrelated programs without data
corruption, so file locking is unnecessary. [..]

Folders of the style introduced by the Courier mail transfer agent
are also supported. Any subdirectory of the main mailbox is
considered a folder if '.' is the first character in its name.
Folder names are represented by Maildir without the leading '.'.
Each folder is itself a Maildir mailbox but should not contain other
folders. Instead, a logical nesting is indicated using '.' to
delimit levels, e.g., "Archived.2005.07".

Source: https://docs.python.org/3.8/library/mailbox.html#mailbox.Maildir


> Way back when maildir first appeared and I used qmail the way I want
> things to work was the way it *did* work.  It's the maildir++ thing
> that's broken it.

I don't think anyone in the Mutt camp is forcing anyone else to use
Maildir++.  So, if someone wants to use Qmail-style Maildir with Mutt,
the thing for them to do is probably to give it a try and maybe post on
the mailing list (or file a bug report) in case of specific problems.

Glad you got it working to your satisfaction in the end :)

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


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-29 Thread Cameron Simpson
On 30Sep2020 12:44, raf  wrote:
>On Wed, Sep 30, 2020 at 11:38:06AM +1000, Cameron Simpson  
>wrote:
>> I dropped procmail years ago too, [...]
>
>I didn't drop procmail. I wrote a program to
>generate procmail code from a set of prettier
>config files. :-)

Oh, so did I. Look up cats2procmailrc, which takes rules much like what 
I showed above:

https://hg.sr.ht/~cameron-simpson/css/browse/bin/cats2procmailrc?rev=tip

but procmail is slow, too, and I didn't like its model. So later I wrote 
a filer of my own, as also has Chris Green.

Re procmail, aside from my misgivings about its model, I was also not 
happy with the fact that it just applies regexps to headers, which is 
very error prone (yes, my paranoia levels are higher than yours:-) Also, 
it reads the rules afresh for every delivery.

These days I use my own filer which runs as a daemon: it reads the rules 
just once (including compiling any regexps), and rereads them if I edit 
them. The main script is here:

https://hg.sr.ht/~cameron-simpson/css/browse/bin/mailfiler?rev=tip

which invokes this Python module:


https://hg.sr.ht/~cameron-simpson/css/browse/lib/python/cs/app/mailfiler.py?rev=tip

It just watches a Maildir for new messages and applies rules.

Cheers,
Cameron Simpson 

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself.  Therefore all progress
depends on the unreasonable man.- George Bernard Shaw


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-29 Thread raf
On Wed, Sep 30, 2020 at 11:38:06AM +1000, Cameron Simpson  
wrote:

> On 29Sep2020 08:13, Chris Green  wrote:
> >On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
> >> I confess to some curiosity here...  What are you doing in your
> >> home-grown MDA, that you could not already do with procmail, which (if
> >> you're on a Linux system at least) your mail system is most likely
> >> already using to deliver your mail?
> >>
> >It's all driven from one text file so that when I subscribe to a new
> >mailing list all I have to do is add an entry to that file.  No
> >changing of procmail rules, no additions to muttrc.  I have attached
> >the filter file to this message, the comments explain it at least as
> >well as I can here.
> 
> Nice. That is very compact.
> 
> I dropped procmail years ago too, and my filer rules for eg the mutt 
> lists look like this:
> 
> muttMutt-Devsender:owner-mutt-...@mutt.org
> muttMutt-Devsender:mutt-dev-boun...@mutt.org
> muttMutt-Users  mutt-users@mutt.org
> muttMutt-Users  mutt-users@mutt.org@korn.aiss.de
> muttMutt-Users  mutt-us...@gbnet.net
> muttMutt-Users  sender:owner-mutt-us...@mutt.org
> muttoffline-imapofflineimap-proj...@lists.alioth.debian.org
> muttoffline-imapofflineimap-proj...@alioth-lists.debian.net
> muttoffline-imap
> sender:offlineimap-project-bounces+cs=cskk.id...@lists.alioth.debian.org
> 
> Column 1 is the mail folder name. Column 2 is for the X-Label ('.' to 
> not apply one). Column 3 is the rule. Absent a header name it matches 
> the to/cc/bcc on the "address" part (the bit between the <> after a 
> parse).
> 
> Cheers,
> Cameron Simpson 

I didn't drop procmail. I wrote a program to
generate procmail code from a set of prettier
config files. :-)

cheers,
raf



Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-29 Thread Cameron Simpson
On 29Sep2020 08:13, Chris Green  wrote:
>On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
>> I confess to some curiosity here...  What are you doing in your
>> home-grown MDA, that you could not already do with procmail, which (if
>> you're on a Linux system at least) your mail system is most likely
>> already using to deliver your mail?
>>
>It's all driven from one text file so that when I subscribe to a new
>mailing list all I have to do is add an entry to that file.  No
>changing of procmail rules, no additions to muttrc.  I have attached
>the filter file to this message, the comments explain it at least as
>well as I can here.

Nice. That is very compact.

I dropped procmail years ago too, and my filer rules for eg the mutt 
lists look like this:

muttMutt-Devsender:owner-mutt-...@mutt.org
muttMutt-Devsender:mutt-dev-boun...@mutt.org
muttMutt-Users  mutt-users@mutt.org
muttMutt-Users  mutt-users@mutt.org@korn.aiss.de
muttMutt-Users  mutt-us...@gbnet.net
muttMutt-Users  sender:owner-mutt-us...@mutt.org
muttoffline-imapofflineimap-proj...@lists.alioth.debian.org
muttoffline-imapofflineimap-proj...@alioth-lists.debian.net
muttoffline-imap
sender:offlineimap-project-bounces+cs=cskk.id...@lists.alioth.debian.org

Column 1 is the mail folder name. Column 2 is for the X-Label ('.' to 
not apply one). Column 3 is the rule. Absent a header name it matches 
the to/cc/bcc on the "address" part (the bit between the <> after a 
parse).

Cheers,
Cameron Simpson 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-29 Thread Nemo Thorx
Quoting Chris Green from 29 Sep (a Tuesday in 2020) at 0813 hours...

> It's all driven from one text file so that when I subscribe to a new
> mailing list all I have to do is add an entry to that file.  No
> changing of procmail rules, no additions to muttrc.  I have attached
> the filter file to this message, the comments explain it at least as
> well as I can here.


I found some procmail magic years ago which drops mail into a new
mailbox matching the list name (assuming it has sane headers) with zero
updates to any files needed! That said, I don't use the mutt
aliases/subscribe/list functions at all... 

Anyway, in the spirit of sharing... 

"""
 GENERAL MAILING LIST MAGIC
:0D
* ^(X-list: |Sender: owner-|X-BeenThere: |Delivered-To: mailing list 
|X-(Mailing-)?List: <|X-Loop: |List-I[dD]: <)\/[-A-Za-z0-9_+]+
.lists.$MATCH/
"""

There are some downsides to this though:

* Some lists don't have the right headers to work
* Your on-disk list name is whatever the list sets itself to be. 
* If you have multiple subscriptions which result in the same $MATCH...
* If you want multiple lists to be delivered to the same folder
  regardless of $MATCH...
* Some dodgy list software will set headers so every message has
  a unique $MATCH!

I've encountered all of those, but all are rare and easily worked
around, and the benefit of "subscribe to a list and have it just show up
as a new mailbox" is worth it for my use! :) 

(and yeah, it uses the .folder.layout paths. Conceptually I prefer
/folder/paths but in practice I don't delve into the on-disk names
often enough to care anyway!)


.../Nemo

-- 
  - -
earth native


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-29 Thread Chris Green
On Mon, Sep 28, 2020 at 05:48:38PM -0500, Derek Martin wrote:
> On Fri, Sep 25, 2020 at 01:33:24PM +0100, Chris Green wrote:
> > Just to report success.  It all appears to be working as I want with
> > 'real' directories for my mail hierarchy.
> 
> Glad to hear it.
> 
> > It was basically quite simple to do, mostly using 'find', first to
> > create a copy of my old mbox directory hierarchy and then to run mb2md
> > against each mbox to the required destination in the new hierarchy.
> > 
> > Obviously there were a few changes to my muttrc to tell mutt to create
> > maildir rather than mbox and the delivery/filter program run by
> > .forward has to create maildir mails rather than mbox ones (which
> > makes it a lot simpler of course).
> 
> I confess to some curiosity here...  What are you doing in your
> home-grown MDA, that you could not already do with procmail, which (if
> you're on a Linux system at least) your mail system is most likely
> already using to deliver your mail?
> 
It's all driven from one text file so that when I subscribe to a new
mailing list all I have to do is add an entry to that file.  No
changing of procmail rules, no additions to muttrc.  I have attached
the filter file to this message, the comments explain it at least as
well as I can here.

-- 
Chris Green
#
#
# Mail filterfile, used to generate Mutt aliases and for filtering mail into 
mailboxes,
# it's used by:-
#   getAliases.py - generates mutt aliases for the mailing lists
#   getLists.py - generates list names for mutt 'subscribe' and 'lists' 
commands
#   filter.py - called by .forward, delivers mail to appropriate mail box
#
# The mutt aliases are the 'Name' in the first column, mail to the 'Name' will 
# be sent to the "To/CC matching string". Where there is more than one entry
# with the same name then mutt will send to the last one so the preferred E-Mail
# address should always be the last entry (see alug and ixion for examples).
#
# Any mail received which has a To: or Cc: which matches the "To/CC matching 
string"
# will be put in a mailbox 'Name' in directory 'Dir' under ~/Mail.  There can 
(as
# noted above) be more than one entry with the same name in the first column, 
this 
# allows E-Mail from different addresses to be delivered to the same mbox.  
Note also
# that xubuntu-us...@lists.ubuntu.com has to precede 
ubuntu-us...@lists.ubuntu.com as
# otherwise the xubuntu mails get caught by ubuntu.
#
# The fourth column (if present) is a string to be stripped from the Subject: 
line
# of messages to the corresponding list.  The string is expected to be 
surrounded
# by [].  It's also used as a 'list' match in some cases where the To: and Cc:
# fields aren't related to the list.
#
# The fifth column (if present) is an additional matching parameter to be 
matched
# as well as the To/CC destination address.  This allows Ipswich Freegle 
messages
# to be split into separate mbox destinations.  The ifc destination mbox is 
where
# a message without offer, received, taken or wanted in the Subject: will go.
#
# The c...@isbd.net entry means that replies to subscription requests etc. will 
end up
# in a 'list' folder so that my confirmation does come from c...@isbd.net.  
(I'm not
# sure that this actually works)
#
# Name  Dir To/CC matching string   Strip from 
subject
alugLi  annou...@lists.alug.org.uk  ALUG
alugLi  m...@lists.alug.org.uk  ALUG
audacityLi  audacity-us...@lists.sourceforge.netAudacity-users
baa-rag Li  baa-...@yahoogroups.com bba-rag
bbb Li  beagleb...@googlegroups.com
BHS Li  bhs-suff...@yahoogroups.co.uk   BHS-Suffolk
cheddar Li  cheddar-us...@lists.halon.org.uk
digikam Li  digikam-us...@kde.org   Digikam-users
digitempLi  digit...@googlegroups.com
dnsmasq Li  dnsmasq-disc...@lists.thekelleys.org.uk Dnsmasq-discuss
dnsmasq Li  dnsmasq-disc...@thekelleys.org.uk   Dnsmasq-discuss
docutilsLi  docutils-us...@lists.sourceforge.netDocutils-users
dokuwikiLi  dokuw...@freelists.org  dokuwiki
EKS Li  e...@yahoogroups.com
ex-vidusLi  ex-vi...@googlegroups.com
fail2banLi  fail2ban-us...@lists.sourceforge.net
gedaLi  geda-u...@delorie.com 
glabels Li  glabels-de...@lists.sourceforge.net
gnome-dbLi  gnome-db-l...@gnome.org
gnucash Li  gnucash-u...@lists.gnucash.org  GNC
gnucash Li  gnucash-u...@gnucash.org
grubLi  help-g...@gnu.org
ixion   Li  ix...@ixiemaster.ixion.org.uk
ixion   Li  ix...@ixion.org.uk
kurvigerLi  kurvi...@googlegroups.com
leafnodeLi  leafnode-l...@dt.e-technik.tu-dortmund.de leafnode-list
mercurial   Li  

Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-28 Thread Derek Martin
On Fri, Sep 25, 2020 at 01:33:24PM +0100, Chris Green wrote:
> Just to report success.  It all appears to be working as I want with
> 'real' directories for my mail hierarchy.

Glad to hear it.

> It was basically quite simple to do, mostly using 'find', first to
> create a copy of my old mbox directory hierarchy and then to run mb2md
> against each mbox to the required destination in the new hierarchy.
> 
> Obviously there were a few changes to my muttrc to tell mutt to create
> maildir rather than mbox and the delivery/filter program run by
> .forward has to create maildir mails rather than mbox ones (which
> makes it a lot simpler of course).

I confess to some curiosity here...  What are you doing in your
home-grown MDA, that you could not already do with procmail, which (if
you're on a Linux system at least) your mail system is most likely
already using to deliver your mail?

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-25 Thread Chris Green
On Thu, Sep 24, 2020 at 09:02:29AM +0100, Chris Green wrote:
> On Wed, Sep 23, 2020 at 10:11:24PM -0500, Derek Martin wrote:
> > On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> > > Does mutt still use the (IMHO silly) maildir hierarchy where mail
> > > 'folders' are simply represented by another '.' and name in the
> > > maildir directory name?
> > 
> > I'm not sure why you think Mutt is doing this...  I have my maildir
> > folders set up in exactly the way you say you want and they work fine.
> > But Mutt, by and large, isn't what created that mailbox structure--it
> > was procmail.  Presumably it's also true for you that whatever is
> > delivering your mail is creating the directory structure, and mutt is
> > just consuming it.
> > 
> Yes, true enough, and your reply encourages me to try again.
> "Whatever is delivering your mail" in my case is my own Python filter
> script that receives mail via ~/.forward so that's easy enough to make
> do the right thing (I think!).
> 
> I think I may previously have tried with other delivery agents which
> use the maildir++ format.
> 
> Thanks!
> 
Just to report success.  It all appears to be working as I want with
'real' directories for my mail hierarchy.

It was basically quite simple to do, mostly using 'find', first to
create a copy of my old mbox directory hierarchy and then to run mb2md
against each mbox to the required destination in the new hierarchy.

Obviously there were a few changes to my muttrc to tell mutt to create
maildir rather than mbox and the delivery/filter program run by
.forward has to create maildir mails rather than mbox ones (which
makes it a lot simpler of course).

I use mairix for searches so that was pretty trivial to change over to
the new format too.

I think my previous encounters with maildir had forced me to use
maildir++ because I was using 'ready made' MDAs.  Now I have my own
MDA written in Python that is no longer an issue.

-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-24 Thread Chris Green
On Wed, Sep 23, 2020 at 10:11:24PM -0500, Derek Martin wrote:
> On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> > Does mutt still use the (IMHO silly) maildir hierarchy where mail
> > 'folders' are simply represented by another '.' and name in the
> > maildir directory name?
> 
> I'm not sure why you think Mutt is doing this...  I have my maildir
> folders set up in exactly the way you say you want and they work fine.
> But Mutt, by and large, isn't what created that mailbox structure--it
> was procmail.  Presumably it's also true for you that whatever is
> delivering your mail is creating the directory structure, and mutt is
> just consuming it.
> 
Yes, true enough, and your reply encourages me to try again.
"Whatever is delivering your mail" in my case is my own Python filter
script that receives mail via ~/.forward so that's easy enough to make
do the right thing (I think!).

I think I may previously have tried with other delivery agents which
use the maildir++ format.

Thanks!

-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Derek Martin
On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> Does mutt still use the (IMHO silly) maildir hierarchy where mail
> 'folders' are simply represented by another '.' and name in the
> maildir directory name?

I'm not sure why you think Mutt is doing this...  I have my maildir
folders set up in exactly the way you say you want and they work fine.
But Mutt, by and large, isn't what created that mailbox structure--it
was procmail.  Presumably it's also true for you that whatever is
delivering your mail is creating the directory structure, and mutt is
just consuming it.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



signature.asc
Description: PGP signature


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Cameron Simpson
On 23Sep2020 14:58, Kurt Hackenberg  wrote:
>On 2020-09-23 04:07, Chris Green wrote:
>
>>I think I might try that second idea, I can run mb2md (as you say)
>>2354 times and get the layout I want.  Then I can try mutt on it and
>>see if it's practical.
>
>
>Does mb2md convert message attributes? (Message has been read, message 
>has been replied to, etc.)

Easy to test though. And easy to patch mb2md if lacking.

>In mbox files, I believe Mutt stores that stuff in the common but 
>non-standard headers Status:, X-Status:, and X-Label:. Maildir instead 
>encodes much of that in message pathnames. Basic maildir has no way to 
>encode labels/keywords, but Dovecot has added its own mechanism for 
>that. I don't know how Mutt stores labels in maildir.

The label %Y displays comes from X-Label. I use it extensively.

One can also remember that you can convert mailboxes using mutt, in 
which case you're assures that the results will be mutt compatible :-)

Here's a line from the guts of my mboxify script, which I use to bulk 
convert Maildir to mbox (I keep my archive folders as mbox, more 
compact):

mutt -n -F /dev/null -f "$mailbox" -e "set sort=mailbox-order; set 
confirmappend=no; set delete=yes; push 
'.$mailboxtmp'"

where $mailbox is the source mail folder and $mailboxtmp is a scratch 
mbox folder (intially just an empty file of course), which gets renamed 
if the mutt succeeds.

Cheers,
Cameron Simpson 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Kurt Hackenberg

On 2020-09-23 04:07, Chris Green wrote:


I think I might try that second idea, I can run mb2md (as you say)
2354 times and get the layout I want.  Then I can try mutt on it and
see if it's practical.



Does mb2md convert message attributes? (Message has been read, message 
has been replied to, etc.)


In mbox files, I believe Mutt stores that stuff in the common but 
non-standard headers Status:, X-Status:, and X-Label:. Maildir instead 
encodes much of that in message pathnames. Basic maildir has no way to 
encode labels/keywords, but Dovecot has added its own mechanism for 
that. I don't know how Mutt stores labels in maildir.


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Cameron Simpson
On 23Sep2020 09:11, Chris Green  wrote:
>> I don't browse from within mutt (but see Kevin's reply) but I do have 
>> a
>> directory hierarchy. Admittedly it is shallow and does not have Maildirs
>> inside Maildirs, but my own folders are like this:
>>
>> ~/mail/foldername   # top level "current" folders
>> ~/mail/OLD//foldername  # archived folders
>> ~/mail/O/foldername # this year's archived folders
>>
>> I've just got (d)elete bound to move messages into
>> "O/current-folder-name", and "O" is just a symlink to
>> "OLD/the-current-year".
>>
>> So no Maildirs inside Maildirs, but several subdirectories.
>>
>I don't think I want Maildirs inside Maildirs, mbox can't do that so I
>don't expect it.

Then you should be fine. Make whatever structure you'd like.

Cheers,
Cameron Simpson 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Chris Green
On Wed, Sep 23, 2020 at 08:20:11AM +1000, Cameron Simpson wrote:
> On 22Sep2020 17:46, Chris Green  wrote:
> >Does mutt still use the (IMHO silly) maildir hierarchy where mail
> >'folders' are simply represented by another '.' and name in the
> >maildir directory name?
> 
> Are you talking about browsing a Maildir hierarchy from mutt, or just 
> the physical structure on disc?
> 
The actual structure on disk, as I explained I often move stuff around
and/or rename things, or check on space usage directly from the
command line and the maildir++ format makes this *very* difficult.


> I don't browse from within mutt (but see Kevin's reply) but I do have a 
> directory hierarchy. Admittedly it is shallow and does not have Maildirs 
> inside Maildirs, but my own folders are like this:
> 
> ~/mail/foldername   # top level "current" folders
> ~/mail/OLD//foldername  # archived folders
> ~/mail/O/foldername # this year's archived folders
> 
> I've just got (d)elete bound to move messages into 
> "O/current-folder-name", and "O" is just a symlink to 
> "OLD/the-current-year".
> 
> So no Maildirs inside Maildirs, but several subdirectories.
> 
I don't think I want Maildirs inside Maildirs, mbox can't do that so I
don't expect it.


> Oh, don't forget: don't name any of your folders "tmp" or "cur" or 
> "new", those names are special for Maildir.
> 
Yes, easily forgotten, especially tmp. :-)

-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Chris Green
On Tue, Sep 22, 2020 at 10:40:09PM -0400, Kurt Hackenberg wrote:
> On 2020-09-22 13:30, Chris Green wrote:
> 
> > > Does mutt still use the (IMHO silly) maildir hierarchy where mail
> > > 'folders' are simply represented by another '.' and name in the
> > > maildir directory name?
> > > 
> > > Is there some way I can get to use real directories to represent my
> > > hierarchy of mail?
> 
> 
> Originally maildirs had no subfolders; the '.' names were invented by Sam
> Varshavcik, I think a long time ago.[1] What you want also exists; it may be
> more recent. The IMAP server Dovecot, at least, can be configured to name
> maildir subfolders either way.
> 
Yes, exactly, it used to work the 'right' way! :-)


> I think Mutt can read or create a maildir at any pathname you supply,
> including the pathname of either kind of subfolder. What Kevin said about
> the new function  sounds like a handy shortcut.
> 
> > I just run mb2md on my existing mail folders, I ended up with a single
> > directory (~/Maildir) containing 2354 files mostly with ridiculously
> > long names!  This just isn't a sensible way to organise my mail.
> 
> 
> Do you mean you have 2354 mbox files, and now 2354 maildir subfolders? Maybe

Yes.


> you can write a shell script that renames all those maildir subfolders to
> the pathnames you want. Or a script that runs mb2md 2354 times, with an
> input and output pathname each time, if it can be used that way. Or use a
> different conversion tool.
> 
I think I might try that second idea, I can run mb2md (as you say)
2354 times and get the layout I want.  Then I can try mutt on it and
see if it's practical.


-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-23 Thread Chris Green
On Wed, Sep 23, 2020 at 09:44:22AM +1000, raf wrote:
> On Tue, Sep 22, 2020 at 06:30:52PM +0100, Chris Green  wrote:
> 
> > On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> > > Does mutt still use the (IMHO silly) maildir hierarchy where mail
> > > 'folders' are simply represented by another '.' and name in the
> > > maildir directory name?
> > > 
> > > Is there some way I can get to use real directories to represent my
> > > hierarchy of mail?  I manually rearrange my mail sometimes and to deal
> > > with very long directory names isn't really practical. For example I
> > > might decide to move mail as follows:-
> > > 
> > > ~/Mail/folder/travel/zelmaFrance 
> > > 
> > > to
> > > 
> > > ~/Mail/folder/travel/france/zelma
> > > 
> > > With real directories such a move isn't too difficult but with the
> > > default maildir naming it becomes painful.
> > > 
> > > Some software I believe does work the way I want with maildir but the
> > > dotted hierarchy seems to be becoming the standard.  Is there no way
> > > round this?  I'd really like to move to maildir but I really can't see
> > > it being practical for me as it is.
> > > 
> > I just run mb2md on my existing mail folders, I ended up with a single
> > directory (~/Maildir) containing 2354 files mostly with ridiculously
> > long names!  This just isn't a sensible way to organise my mail.
> > 
> > -- 
> > Chris Green
> 
> I might be talking nonsense, but that maildir hierarchy
> probably is the correct thing, as defined by whoever
> came up with it, and is what is needed for all(?) mail
> software that deals with maildir to work. But if you
> want to manipulate the hierarchy separately from mail
> software, and still have all mail software work
> correctly, you might be able to implement (or convince
> someone to implement) a userspace fuse file system that
> provides an alternative view of the real maildir file
> system, that can be mounted alongside the real maildir
> directory. Then, whatever mail software you want to use
> can work with the real maildir hierarchy, and you can
> manipulate it in the way you want outside of mail
> software. I have no idea how much effort would be
> involved in such a fuse file system, though.
> 
The only things dealing with the maildirs are my own mail filter
written in Python and mutt, nothing else.

Way back when maildir first appeared and I used qmail the way I want
things to work was the way it *did* work.  It's the maildir++ thing
that's broken it.


> An alternative, if the only problem is renaming
> folders, is to write a shell script or something that
> renames maildir folders. That would be a lot less
> effort.
> 
> But I really don't know what I'm talking about. I use
> mbox.
> 
> Perhaps you can rename/move folders in a mail client
> and then you don't need to look at the guts underneath.
> That would be the easiest way. I know that GUI IMAP
> clients can do that. Can mutt do that? I found this:
> 
>   https://unix.stackexchange.com/questions/44508/mutt-rename-imap-folder
> 
No IMAP, no POP3. :-)

-- 
Chris Green


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread Kurt Hackenberg

On 2020-09-22 13:30, Chris Green wrote:


Does mutt still use the (IMHO silly) maildir hierarchy where mail
'folders' are simply represented by another '.' and name in the
maildir directory name?

Is there some way I can get to use real directories to represent my
hierarchy of mail?



Originally maildirs had no subfolders; the '.' names were invented by 
Sam Varshavcik, I think a long time ago.[1] What you want also exists; 
it may be more recent. The IMAP server Dovecot, at least, can be 
configured to name maildir subfolders either way.


I think Mutt can read or create a maildir at any pathname you supply, 
including the pathname of either kind of subfolder. What Kevin said 
about the new function  sounds like a handy shortcut.



I just run mb2md on my existing mail folders, I ended up with a single
directory (~/Maildir) containing 2354 files mostly with ridiculously
long names!  This just isn't a sensible way to organise my mail.



Do you mean you have 2354 mbox files, and now 2354 maildir subfolders? 
Maybe you can write a shell script that renames all those maildir 
subfolders to the pathnames you want. Or a script that runs mb2md 2354 
times, with an input and output pathname each time, if it can be used 
that way. Or use a different conversion tool.



[1] 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread raf
On Tue, Sep 22, 2020 at 06:30:52PM +0100, Chris Green  wrote:

> On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> > Does mutt still use the (IMHO silly) maildir hierarchy where mail
> > 'folders' are simply represented by another '.' and name in the
> > maildir directory name?
> > 
> > Is there some way I can get to use real directories to represent my
> > hierarchy of mail?  I manually rearrange my mail sometimes and to deal
> > with very long directory names isn't really practical. For example I
> > might decide to move mail as follows:-
> > 
> > ~/Mail/folder/travel/zelmaFrance 
> > 
> > to
> > 
> > ~/Mail/folder/travel/france/zelma
> > 
> > With real directories such a move isn't too difficult but with the
> > default maildir naming it becomes painful.
> > 
> > Some software I believe does work the way I want with maildir but the
> > dotted hierarchy seems to be becoming the standard.  Is there no way
> > round this?  I'd really like to move to maildir but I really can't see
> > it being practical for me as it is.
> > 
> I just run mb2md on my existing mail folders, I ended up with a single
> directory (~/Maildir) containing 2354 files mostly with ridiculously
> long names!  This just isn't a sensible way to organise my mail.
> 
> -- 
> Chris Green

I might be talking nonsense, but that maildir hierarchy
probably is the correct thing, as defined by whoever
came up with it, and is what is needed for all(?) mail
software that deals with maildir to work. But if you
want to manipulate the hierarchy separately from mail
software, and still have all mail software work
correctly, you might be able to implement (or convince
someone to implement) a userspace fuse file system that
provides an alternative view of the real maildir file
system, that can be mounted alongside the real maildir
directory. Then, whatever mail software you want to use
can work with the real maildir hierarchy, and you can
manipulate it in the way you want outside of mail
software. I have no idea how much effort would be
involved in such a fuse file system, though.

An alternative, if the only problem is renaming
folders, is to write a shell script or something that
renames maildir folders. That would be a lot less
effort.

But I really don't know what I'm talking about. I use
mbox.

Perhaps you can rename/move folders in a mail client
and then you don't need to look at the guts underneath.
That would be the easiest way. I know that GUI IMAP
clients can do that. Can mutt do that? I found this:

  https://unix.stackexchange.com/questions/44508/mutt-rename-imap-folder

cheers,
raf



Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread Cameron Simpson
On 22Sep2020 17:46, Chris Green  wrote:
>Does mutt still use the (IMHO silly) maildir hierarchy where mail
>'folders' are simply represented by another '.' and name in the
>maildir directory name?

Are you talking about browsing a Maildir hierarchy from mutt, or just 
the physical structure on disc?

I don't browse from within mutt (but see Kevin's reply) but I do have a 
directory hierarchy. Admittedly it is shallow and does not have Maildirs 
inside Maildirs, but my own folders are like this:

~/mail/foldername   # top level "current" folders
~/mail/OLD//foldername  # archived folders
~/mail/O/foldername # this year's archived folders

I've just got (d)elete bound to move messages into 
"O/current-folder-name", and "O" is just a symlink to 
"OLD/the-current-year".

So no Maildirs inside Maildirs, but several subdirectories.

Oh, don't forget: don't name any of your folders "tmp" or "cur" or 
"new", those names are special for Maildir.

Cheers,
Cameron Simpson 


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread Kevin J. McCarthy

On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:

Does mutt still use the (IMHO silly) maildir hierarchy where mail
'folders' are simply represented by another '.' and name in the
maildir directory name?


Starting in Mutt 1.12, there is a new function  in 
the browser menu.  This can be used to force Mutt to enter a directory 
that is also a maildir mailbox.


One possible usage might be to bind enter/return to descend directory 
and space to select the entry:


  bind browser  descend-directory
  bind browser  descend-directory
  bind browser  select-entry

--
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA


signature.asc
Description: PGP signature


Re: Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread Chris Green
On Tue, Sep 22, 2020 at 05:46:53PM +0100, Chris Green wrote:
> Does mutt still use the (IMHO silly) maildir hierarchy where mail
> 'folders' are simply represented by another '.' and name in the
> maildir directory name?
> 
> Is there some way I can get to use real directories to represent my
> hierarchy of mail?  I manually rearrange my mail sometimes and to deal
> with very long directory names isn't really practical. For example I
> might decide to move mail as follows:-
> 
> ~/Mail/folder/travel/zelmaFrance 
> 
> to
> 
> ~/Mail/folder/travel/france/zelma
> 
> With real directories such a move isn't too difficult but with the
> default maildir naming it becomes painful.
> 
> Some software I believe does work the way I want with maildir but the
> dotted hierarchy seems to be becoming the standard.  Is there no way
> round this?  I'd really like to move to maildir but I really can't see
> it being practical for me as it is.
> 
I just run mb2md on my existing mail folders, I ended up with a single
directory (~/Maildir) containing 2354 files mostly with ridiculously
long names!  This just isn't a sensible way to organise my mail.

-- 
Chris Green


Can mutt be persuaded to use a sensible maildir hierarchy?

2020-09-22 Thread Chris Green
Does mutt still use the (IMHO silly) maildir hierarchy where mail
'folders' are simply represented by another '.' and name in the
maildir directory name?

Is there some way I can get to use real directories to represent my
hierarchy of mail?  I manually rearrange my mail sometimes and to deal
with very long directory names isn't really practical. For example I
might decide to move mail as follows:-

~/Mail/folder/travel/zelmaFrance 

to

~/Mail/folder/travel/france/zelma

With real directories such a move isn't too difficult but with the
default maildir naming it becomes painful.

Some software I believe does work the way I want with maildir but the
dotted hierarchy seems to be becoming the standard.  Is there no way
round this?  I'd really like to move to maildir but I really can't see
it being practical for me as it is.

-- 
Chris Green