Re: navigation

2009-07-20 Thread lee
On Sun, Jul 19, 2009 at 10:44:07AM -0700, Robert Holtzman wrote:
 Running mutt and mutt-patched 1.5.17 with the side panel listing  
 mailboxes on Ubuntu Hardy. I can't find a way to navigate in this list  
 other than by using c and ?. Is the side panel functional or just  
 informative? I run mutt and mutt-patched 1.5.18 in Debian Lenny and it  
 exhibits the same behavior.

http://www.lunar-linux.org/index.php?option=com_contenttask=viewid=44

Did you get sidebar-scroll-up and sidebar-scroll-down to work? I can
bind them to keys, but mutt says the key isn't bound when I press it.


Re: xemacs qyestion

2009-07-20 Thread Joost Kremers
On Thu, Jul 16, 2009 at 09:23:54PM -0600, lee wrote:
 Oh? The post-mode worked just fine once I installed the package. If
 there was something added to the configuration, the package management
 must have done that for me.

probably. gnu emacs doesn't have such package management...

  furthermore, if you use mutt, it is not necessary to add anything to
  auto-mode-alist, because post.el takes care of that itself. (unless
  you customize it do not do that.)
 
 Well, it didn't turn on flyspell-mode for me.

no, i meant that it just adds an entry to auto-mode-alist to turn on post-mode
for mail and news messages (actually, just for mutt and slrn).

  so if you have anything else about flyspell-mode in your .emacs, you
  may want to take a look at that. (or send it to me, off-list, if
  you're not sure, then I can take a look at it.)
 
 Thanks for the offer! It's working now --- if flyspell-mode only turns
 on after the first mail I'm editing, well, I can live with that :)

that's still weird, though... but i'm not sure what might be going on there...


-- 
Joost Kremers
Life has its moments


Re: xemacs qyestion

2009-07-20 Thread Joost Kremers
On Thu, Jul 16, 2009 at 09:14:22PM -0600, lee wrote:
 On Thu, Jul 16, 2009 at 11:05:00AM +0200, Joost Kremers wrote:
  Which is not going to work, because only the first matching mode in
  auto-mode-alist is activated. That's why auto-mode-alist should only be 
  used for
  major modes, not for minor modes. Minor modes (like flyspell-mode) should be
  turned on via mode hooks.
 
 That's what I mean: How do you know all that?

years of using emacs... ;-) i follow two emacs-related newsgroups, i regularly
consult emacs documentation, i read the wiki http://www.emacswiki.org/, i
experiment, that sort of thing.

emacs has a lot of built-in documentation. just check out the help function by
typing 'C-h ?'.

HTH


-- 
Joost Kremers
Life has its moments


Extract whole thread

2009-07-20 Thread steve
Hi list,

I would like to extract a whole thread from within mutt and save it
elsewhere for further processing. Is this possible?

Thanks,
steve



Re: split display?

2009-07-20 Thread Tim Gray

On Sun 19, Jul'09 at 10:03 PM -0600, lee wrote:

mailboxes `/path/to/script/listbox.py /path/to/mail/folders`


Thanks! Doesn't that need to produce some output, or does mutt have a
way to assign the content of dirs from the script to mailboxes?


The command in your muttrc ends up looking like mailboxes +mailbox1 
+mailbox2, which is the syntax mutt wants.  Look up the 'mailboxes' 
command.  All the script does is generate the +mailbox1 +mailbox2 command. 
Of course, if you don't have to have the + part in front of the mailbox, but 
then you'd need the absolute path.



And it would require that there are exclusively maildirs in the
directory you supply as parameter to the script because it doesn't
distinguish between maildirs and directories. That's a distinction a
script needs to make.


Well, it was a quick script I wrote for *my* purposes.  If you run mboxes 
instead of maildirs, you'd want to look for files and ignore directories, 
instead of vice-versa. Actually, I didn't even do that since I'm following 
the maildir standard (I think) of not having extraneous stuff in my top 
level mail folder.


Furthermore, I believe for a technically correct maildir structure, you 
shouldn't have subdirectories in that top level folder.  See:

http://wiki.mutt.org/?MuttFaq/Maildir
I wanted to keep my mail compatible with an IMAP server if I so chose, so I 
am using the #1 suggestion in the link.  So I have 'subfolders' named like 
so:

work.misc
work.proj1
work.proj2
personal.home
personal.friends
etc.


A script to automatically set up the mailboxes would have to check all
directories under ~/Mail and create mailbox statements for only those
that are maildirs.


See above.  Not an issue in my case.  Feel free to modify the code to suit 
your purposes.  If you have a limited number of folders, you could always 
just call the code multiple times:

mailboxes `listbox.py /path/to/lists`
mailboxes `listbox.py /path/to/Per`
mailboxes `listbox.py /path/to/Gov`


Export whole thread

2009-07-20 Thread steve
Hi,

Sorry for the new post, but I tried someone's solution on the one I
opened, and I lost it I don't know why. I tried on another one and that
time it work. The only problem is that I wanted to save the thread in a
special folder and I coulnd't, mutt asked if I wanted to create a new
mailbox in ~/mail/. But anyway, my problem is now solved.

Many thanks,
Steve


Re: split display?

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 09:55:42AM -0400, Tim Gray wrote:
 On Sun 19, Jul'09 at 10:03 PM -0600, lee wrote:
 mailboxes `/path/to/script/listbox.py /path/to/mail/folders`

 Thanks! Doesn't that need to produce some output, or does mutt have a
 way to assign the content of dirs from the script to mailboxes?

 The command in your muttrc ends up looking like mailboxes +mailbox1  
 +mailbox2, which is the syntax mutt wants.

Oh. I was trying the script from the command line just to see what it
would do, and it didn't produce any output. It seems the script fills
a variable it uses. I'm wondering how mutt knows that it needs to take
its information from this variable.

BTW, I ended up making a list for the MUA I was trying out. I cleaned
things up and found I got 173 maildirs. I converted the list so that
mutt can use it. Now things would be a lot easier to find if mutt had
a hierarchical display for the mailfolders. I hope I can at least turn
off the sorting, but I haven't looked into that yet.

 And it would require that there are exclusively maildirs in the
 directory you supply as parameter to the script because it doesn't
 distinguish between maildirs and directories. That's a distinction a
 script needs to make.

 Well, it was a quick script I wrote for *my* purposes.

Sorry, I didn't mean to complain. Don't get me wrong, I was only
trying to explain what a script would need to do.

Maybe I should try to write one, could be fun.

 If you run mboxes instead of maildirs, you'd want to look for files
 and ignore directories, instead of vice-versa.

Yeah --- but it's only that I have an old mbox file or two around from
before I switched to maildir. The first MUA I tried on Linux was pine
... I think I also tried elm, but I wasn't happy with them. Then I
found out that there's mutt. That must have been around 1993--1995.

Thanks to mutt, I've never lost a mail. It has always been
reliable. That's awesome work the developers are doing. Thanks!

 Furthermore, I believe for a technically correct maildir structure, you  
 shouldn't have subdirectories in that top level folder.  See:
 http://wiki.mutt.org/?MuttFaq/Maildir

Ah, I have what they show under point 2. custom layout of separate
Maildirs, the bottom version. When cleaning up, I found a directory
that was a maildir but contained other maildirs instead of mails, so I
changed that. Having maildirs that also contain other maildirs or
directories isn't a good idea.

 I wanted to keep my mail compatible with an IMAP server if I so chose, so 
 I am using the #1 suggestion in the link.  So I have 'subfolders' named 
 like so:
 work.misc
 work.proj1

Hm. Does it really matter? When you transfer the mail to IMAP, how do
you create the folders on the IMAP server?

 A script to automatically set up the mailboxes would have to check all
 directories under ~/Mail and create mailbox statements for only those
 that are maildirs.

 See above.  Not an issue in my case.  Feel free to modify the code to 
 suit your purposes.  If you have a limited number of folders, you could 
 always just call the code multiple times:

Thanks! But I don't know python --- I might try where I get to with a
bash script, maybe using find ... But now that I have the list, I
could try to keep them up to date.


Re: xemacs qyestion

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 01:33:23PM +0200, Joost Kremers wrote:
 On Thu, Jul 16, 2009 at 09:14:22PM -0600, lee wrote:
  That's what I mean: How do you know all that?
 
 years of using emacs... ;-) i follow two emacs-related newsgroups, i regularly
 consult emacs documentation, i read the wiki http://www.emacswiki.org/, i
 experiment, that sort of thing.

Ha, it can be very frustrating. When you want to do a simple thing,
you don't want to spend years on following newsgroups and reading
documentation and testing. I've been using emacs for a very long time,
but never got to using it for more than an editor ... The good thing
is that if I want it to do something, there's usually a solution that
can do it better than I would have thought of --- but the problem is
to find out how to get it to do what I want.

 emacs has a lot of built-in documentation. just check out the help function by
 typing 'C-h ?'.

There's something wrong with the documentation I have. I seem to be
missing at least some info packages, and I haven't found out yet which
package I need to install to get all the documentation. I'm sure it's
somewhere there, just not installed.


Re: split display?

2009-07-20 Thread Tim Gray

On Mon 20, Jul'09 at  1:02 PM -0600, lee wrote:

Oh. I was trying the script from the command line just to see what it
would do, and it didn't produce any output. It seems the script fills
a variable it uses. I'm wondering how mutt knows that it needs to take
its information from this variable.


Hmm, when I call the script here from the command line, I get an output like 
+mailbox1 +mailbox2 +mailbox3.



Sorry, I didn't mean to complain. Don't get me wrong, I was only
trying to explain what a script would need to do.

Maybe I should try to write one, could be fun.


Didn't think you were complaining.  I was just saying that ultimately it was 
for my purposes.  Your purposes are obviously different, so go at it. 
Python is not hard.  And all you are ultimately doing in this script, or a 
bash script, etc., is doing a directory listing and filtering it for the 
kinds of results you want.



Yeah --- but it's only that I have an old mbox file or two around from
before I switched to maildir. The first MUA I tried on Linux was pine
... I think I also tried elm, but I wasn't happy with them. Then I
found out that there's mutt. That must have been around 1993--1995.


A script could be modified to look for both.  Or you could convert your mbox 
files to maildir.



Hm. Does it really matter? When you transfer the mail to IMAP, how do
you create the folders on the IMAP server?


If I wanted to run an IMAP server on my computer, so my maildirs were 
accessible to other mail clients (say a GUI client that couldn't read 
maildir), then I need to make sure my mail folder can be used directly with 
the IMAP server, serving those files directly.



Thanks! But I don't know python --- I might try where I get to with a
bash script, maybe using find ... But now that I have the list, I
could try to keep them up to date.


Yes I think a bash + find and a couple other embellishments would work.  I'm 
comfortable with Python so that's what I did it with.


Re: xemacs qyestion

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 01:29:24PM +0200, Joost Kremers wrote:
 On Thu, Jul 16, 2009 at 09:23:54PM -0600, lee wrote:
  Oh? The post-mode worked just fine once I installed the package. If
  there was something added to the configuration, the package management
  must have done that for me.
 
 probably. gnu emacs doesn't have such package management...

But Debian does :)

  Thanks for the offer! It's working now --- if flyspell-mode only turns
  on after the first mail I'm editing, well, I can live with that :)
 
 that's still weird, though... but i'm not sure what might be going on there...

I guess it was just me. It doesn't seem to wait for the second message
to edit now :)


Re: split display?

2009-07-20 Thread Christian Ebert
* lee on Monday, July 20, 2009 at 13:02:29 -0600
 Thanks! But I don't know python --- I might try where I get to with a
 bash script, maybe using find ... But now that I have the list, I
 could try to keep them up to date.

The following could be a start, it came up in comp.mail.mutt:

mailboxes `find ~/Mail -type d \( \( -name cur -o -name new -o -name tmp \) 
-prune -o -print \) \
   | tr '\n' ' '`

(if your find has -printf you can get rid of the tr call)

It still lists directories that contain Maildirs, haven't found
an elegant way to get rid of those. Personally I just use printf.

To update your mailboxes you could put that command in a file and
then have a macro that does something like

unmailboxes * ; source mailboxes.muttrc

c
-- 
  Was heißt hier Dogma, ich bin Underdogma!
[ What the hell do you mean dogma, I am underdogma. ]
_F R E E_  _V I D E O S_  http://www.blacktrash.org/underdogma/
  http://www.blacktrash.org/underdogma/index-en.html


Re: split display?

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 03:16:25PM -0400, Tim Gray wrote:
 On Mon 20, Jul'09 at  1:02 PM -0600, lee wrote:
 Oh. I was trying the script from the command line just to see what it
 would do, and it didn't produce any output.

 Hmm, when I call the script here from the command line, I get an output 
 like +mailbox1 +mailbox2 +mailbox3.

Maybe some sort of print statement was missing (cut off).

 If I wanted to run an IMAP server on my computer, so my maildirs were  
 accessible to other mail clients (say a GUI client that couldn't read  
 maildir), then I need to make sure my mail folder can be used directly 
 with the IMAP server, serving those files directly.

Is there an IMAP server that can handle maildir? I'd use Cyrus, it
uses a storage format similar to maildir, and it's fast and
reliable. But you'd have to move/copy the mails to the IMAP server
unless you'd write a script to convert them to Cyrus' storage format.


Re: split display?

2009-07-20 Thread Tim Gray

On Mon 20, Jul'09 at  4:54 PM -0600, lee wrote:

Maybe some sort of print statement was missing (cut off).


Yeah I probably left it off or something.  It should look something like 
this:


for i in dirs:
print '+l/%s' % i,


Is there an IMAP server that can handle maildir? I'd use Cyrus, it
uses a storage format similar to maildir, and it's fast and
reliable. But you'd have to move/copy the mails to the IMAP server
unless you'd write a script to convert them to Cyrus' storage format.


I've not done it yet, but it was my understanding that UW-IMAP and Dovecot 
at least both serve from maildir.  I think Courier might as well.


Re: split display?

2009-07-20 Thread Patrick Shanahan
* Tim Gray lists+m...@protozoic.com [07-20-09 19:26]:
 
 I've not done it yet, but it was my understanding that UW-IMAP and
 Dovecot at least both serve from maildir.  I think Courier might as
 well.

Dovecot may be configured for mbox...
-- 
Patrick Shanahan Plainfield, Indiana, USAHOG # US1244711
http://wahoo.no-ip.org Photo Album:  http://wahoo.no-ip.org/gallery2
Registered Linux User #207535@ http://counter.li.org


Re: Inline text attachments

2009-07-20 Thread Noah Slater
On Fri, Jul 17, 2009 at 11:43:41AM -0500, Kyle Wheeler wrote:
 note in his attachment, he has:

 text/html; view %s; edit=emacs22 %s; compose=emacs22 ... %s; needsterminal

Thanks, I got this working now.

-- 
Noah Slater, http://tumbolia.org/nslater


Re: Conditionally removing signature

2009-07-20 Thread Noah Slater
On Tue, Jul 07, 2009 at 02:06:23PM +0200, Rocco Rutte wrote:
 Please see if this example and text above it helps you:

http://dev.mutt.org/doc/manual.html#ex-recips

 If I understand you right (mail _only_ to you: no sig, mail you and
 other in the recips: sig), then this may work (untested):

send-hook .*  source ~/.mutt/include/tumbolia
 send-hook '^~C nsla...@...' 'unset signature'
send-hook apache  source ~/.mutt/include/apache
send-hook debian  source ~/.mutt/include/debian
send-hook gnu source ~/.mutt/include/gnu

 Does that help?

Worked like a charm!

Thanks,

-- 
Noah Slater, http://tumbolia.org/nslater


Automatic thread collapsing

2009-07-20 Thread Noah Slater
Hey,

Is there any way to get mutt to continually and automatically collapse threads
as you move around in the pager? So, if I select a collapsed thread, it should
be un-collapsed, but as I move out of it, it is re-collapsed.

Thanks,

-- 
Noah Slater, http://tumbolia.org/nslater


Re: split display?

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 07:24:48PM -0400, Tim Gray wrote:
 On Mon 20, Jul'09 at  4:54 PM -0600, lee wrote:
 Maybe some sort of print statement was missing (cut off).

 Yeah I probably left it off or something.  It should look something like  
 this:

 for i in dirs:
   print '+l/%s' % i,

Thanks! But see below ...

 Is there an IMAP server that can handle maildir?

 I've not done it yet, but it was my understanding that UW-IMAP and 
 Dovecot at least both serve from maildir.  I think Courier might as well.

Now that would be cool! It's been a few years since I looked for one,
and I didn't find any that were able to use maildir.


Ok, I wrote a program to generate mailboxes lines for mutt. It will
print out those lines on stdout; errors and warnings go to
stdout.

Considered as maildirs are directories that have the subdirectories
cur, new and tmp. If the program finds such a directory, it prints a
mailbox line. In case it finds other directories and that directory,
it prints a warning to stdout. It looks like this:


l...@cat:~/src/c/systools/mutt-mailboxes$ ./mutt-mb .
mailboxes = /home/lee/src/c/systools/mutt-mailboxes/rel/tmaildir
warning: 1 strange directory/-ies found in 
/home/lee/src/c/systools/mutt-mailboxes/rel/tmaildir
l...@cat:~/src/c/systools/mutt-mailboxes$ 


If you have an extremely deep directory hierarchy and a low ulimit -s,
the program can run into a stack overflow because it operates recursively.


Here's the program. Let me know how you like it :)


// check a directory hierachy for maildir directories recursively; print
// mailbox commands that can be used for mutt
// error messages are printed to stdout
// print a warning to stderr when there are other directories
//   than cur, new, tmp found in a maildir
//
// (c) H. Wilmer, Mon Jul 20 17:17:45 MDT 2009
// l...@yun.yagibdah.de
// licensed under the GNU GENERAL PUBLIC LICENSE
// use at your own risk
//
// to compile: # gcc mutt-mb.c -o mutt-mb -O2
//
// version 0.1
//
// mutt-mb.c
//   returns !0 on error


#include stddef.h
#include stdlib.h
#include stdio.h
#include dirent.h
#include string.h
#include unistd.h
#include errno.h


// proto
int main(int argc, char *argv[] );
extern void usage();
int weed_out_nondirectories(const struct dirent *);
int scan_directory(char *dirp);



void usage() {
  fputs(usage: mutt-mb [directory]\n, stderr);
  fflush(stderr);
}


// filter function, see man 3 scandir
int weed_out_nondirectories(const struct dirent *de) {
  // weed out non-directories
  if(de-d_type != DT_DIR) {
return 0;
  }
  // weed out directory pointers
  if( !strcmp(de-d_name, .) ) {
return 0;
  }
  if( !strcmp(de-d_name, ..) ) {
return 0;
  }
  // it's a directory
  return 1;
}


int scan_directory(char *dirp) {
  static int recursion_level = 0;
  struct dirent **namelist;
  int scan = -1, check = 0;
  int ret = 0;
  int cwd = -1;
  char *this;
  int found_cur;
  int found_new;
  int found_tmp;
  int found_other;

  // change into the directory
  cwd = chdir(dirp);
  if(cwd  0) {
fputs(dirp, stderr);
perror(chdir);
return 2;
  }
  // and find out where we are
  this = getcwd(NULL, 0);
  if(this == NULL) {
perror(getcwd);
// this shouldn't happen, so rather exit
return -1;
  }

  // scan this directory
  check = scan = scandir(this, namelist, weed_out_nondirectories, alphasort);
  if(scan  0) {
perror(scandir);
free(this);
return 1;
  }

  // check if this is a maildir
  found_cur = 1;
  found_new = 1;
  found_tmp = 1;
  found_other = 0;
  while(check--) {
//printf(check %s/%s\n, this, namelist[check]-d_name);

if(found_cur) {
  found_cur = strcmp(cur, namelist[check]-d_name);
} else {
  found_other++;
}
if(found_new) {
  found_new = strcmp(new, namelist[check]-d_name);
} else {
  found_other++;
}
if(found_tmp) {
  found_tmp = strcmp(tmp, namelist[check]-d_name);
} else {
  found_other++;
}

if( !found_cur  !found_new  !found_tmp) {
  // it's a maildir
  printf(mailboxes = %s\n, this);
  found_other -= 3;
  if(found_other) {
fprintf(stderr, warning: %5d strange directory/-ies found in %s\n, \
found_other, this);
  }
}
  }

  free(this);

  // for each directory in this, look for subdirectories
  while(scan--) {
recursion_level++;
ret = scan_directory(namelist[scan]-d_name);
switch(ret) {
case 0:
  // means ok
  // there shouldn't be any errors ...
  break;
case 2:
  fputs(couldn't change into subdirectory\n, stderr);
  fflush(stderr);
  return 2;
  break;
case -1:
  fputs(coulnd't find out what the current directory is\n, stderr);
  fflush(stderr);
  return -1;
  break;
case 1:
  fputs(couldn't scan a directory\n, stderr);
  fflush(stderr);
  return 1;
  break;
case -2:
  fputs(couldn't change back to directory above\n, stderr);
  fflush(stderr);
  

program to generate mailboxes lines (Re: split display?)

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 10:11:15PM -0600, lee wrote:
 
 Here's the program. Let me know how you like it :)

Hn, one small adjustment: The recursion level is irrelevant, but I
forgot to remove the counter.



// check a directory hierachy for maildir directories recursively; print
// mailbox commands that can be used for mutt
// error messages are printed to stdout
// print a warning to stderr when there are other directories
//   than cur, new, tmp found in a maildir
//
// (c) H. Wilmer, Mon Jul 20 17:17:45 MDT 2009
// l...@yun.yagibdah.de
// licensed under the GNU GENERAL PUBLIC LICENSE
// use at your own risk
//
// to compile: # gcc mutt-mb.c -o mutt-mb -O2
//
// version 0.2
//
// mutt-mb.c
//   returns !0 on error


#include stddef.h
#include stdlib.h
#include stdio.h
#include dirent.h
#include string.h
#include unistd.h
#include errno.h


// proto
int main(int argc, char *argv[] );
extern void usage();
int weed_out_nondirectories(const struct dirent *);
int scan_directory(char *dirp);



void usage() {
  fputs(usage: mutt-mb [directory]\n, stderr);
  fflush(stderr);
}


// filter function, see man 3 scandir
int weed_out_nondirectories(const struct dirent *de) {
  // weed out non-directories
  if(de-d_type != DT_DIR) {
return 0;
  }
  // weed out directory pointers
  if( !strcmp(de-d_name, .) ) {
return 0;
  }
  if( !strcmp(de-d_name, ..) ) {
return 0;
  }
  // it's a directory
  return 1;
}


int scan_directory(char *dirp) {
  struct dirent **namelist;
  int scan = -1, check = 0;
  int ret = 0;
  int cwd = -1;
  char *this;
  int found_cur;
  int found_new;
  int found_tmp;
  int found_other;

  // change into the directory
  cwd = chdir(dirp);
  if(cwd  0) {
fputs(dirp, stderr);
perror(chdir);
return 2;
  }
  // and find out where we are
  this = getcwd(NULL, 0);
  if(this == NULL) {
perror(getcwd);
// this shouldn't happen, so rather exit
return -1;
  }

  // scan this directory
  check = scan = scandir(this, namelist, weed_out_nondirectories, alphasort);
  if(scan  0) {
perror(scandir);
free(this);
return 1;
  }

  // check if this is a maildir
  found_cur = 1;
  found_new = 1;
  found_tmp = 1;
  found_other = 0;
  while(check--) {
//printf(check %s/%s\n, this, namelist[check]-d_name);

if(found_cur) {
  found_cur = strcmp(cur, namelist[check]-d_name);
} else {
  found_other++;
}
if(found_new) {
  found_new = strcmp(new, namelist[check]-d_name);
} else {
  found_other++;
}
if(found_tmp) {
  found_tmp = strcmp(tmp, namelist[check]-d_name);
} else {
  found_other++;
}

if( !found_cur  !found_new  !found_tmp) {
  // it's a maildir
  printf(mailboxes = %s\n, this);
  found_other -= 3;
  if(found_other) {
fprintf(stderr, warning: %5d strange directory/-ies found in %s\n, \
found_other, this);
  }
}
  }

  free(this);

  // for each directory in this, look for subdirectories
  while(scan--) {
ret = scan_directory(namelist[scan]-d_name);
switch(ret) {
case 0:
  // means ok
  // there shouldn't be any errors ...
  break;
case 2:
  fputs(couldn't change into subdirectory\n, stderr);
  fflush(stderr);
  return 2;
  break;
case -1:
  fputs(coulnd't find out what the current directory is\n, stderr);
  fflush(stderr);
  return -1;
  break;
case 1:
  fputs(couldn't scan a directory\n, stderr);
  fflush(stderr);
  return 1;
  break;
case -2:
  fputs(couldn't change back to directory above\n, stderr);
  fflush(stderr);
  return -2;
  break;
}
free(namelist[scan]);
  }
  free(namelist);

  cwd = chdir(..);
  if(cwd  0) {
perror(chdir);
// shouldn't happen
return -2;
  }

  return 0;
}


int main(int argc, char *argv[] ) {
  int ret = 0;
  // check args
  if(argc != 2) {
usage();
exit(1);
  }

  // scan the directory

  ret = scan_directory(argv[1]);
  if(ret) {
fprintf(stderr, error: %d\n, ret);
exit(ret);
  }

  exit(0);
}


Re: split display?

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 09:39:27PM +0100, Christian Ebert wrote:
 
 The following could be a start, it came up in comp.mail.mutt:
 
 mailboxes `find ~/Mail -type d \( \( -name cur -o -name new -o -name tmp \) 
 -prune -o -print \) \
| tr '\n' ' '`
 
 (if your find has -printf you can get rid of the tr call)
 
 It still lists directories that contain Maildirs, haven't found
 an elegant way to get rid of those. Personally I just use printf.

The find I have does have printf ... I took a look at that, but it's
easier for me to write a program in C for this than to figure out how
to do it with find :) I've posted it in this thread; maybe you have
use for it. It's non-trivial, but pretty elegant --- I love C
...

(BTW, the counter for strange directories in the program dosn't
count right; I've changed it so that the number doesn't get printed
anymore. It would be somewhat tricky to get it to count right. But it
doesn't matter much, it's working.)

 To update your mailboxes you could put that command in a file and
 then have a macro that does something like
 
 unmailboxes * ; source mailboxes.muttrc

Maybe it's possible to somehow pipe the output of the program into
mutt so that a file with mailboxes lines isn't even needed. I'll see
if I can find that out ...


setting mailboxes from the output of a command

2009-07-20 Thread lee
Hi,

how do you set mailboxes from the output of a command? The
documentation says:


 my_hdr X-Operating-System: `uname -a`

   The output of the Unix command ``uname -a'' will be substituted before the
   line is parsed. Note that since initialization files are line oriented,
   only the first line of output from the Unix command will be substituted.


Now I tried:


mailboxes = `/src/c/systools/mutt-mailboxes/mutt-mb /home/lee/Mail`


But that doesn't work. Is there a limit on how long the output can be?
It's 5418 characters.

I can modify the output of the program, like to generate many complete
mailboxes lines, or to generate a long line listing all the
mailboxes. Generating mailboxes lines probably won't work because
mailboxes is already specified in the .muttrc.

How do I set the mailboxes from the command output? I don't want to
use a file with mailboxes lines and source that.


Re: setting mailboxes from the output of a command

2009-07-20 Thread lee
On Mon, Jul 20, 2009 at 11:22:03PM -0600, lee wrote:

 How do I set the mailboxes from the command output? I don't want to
 use a file with mailboxes lines and source that.

Never mind, I found that the program to run must be in the path. It's
working now:

mailboxes = `mutt-mb /home/lee/Mail`