Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread David Haguenauer
Hi,

* rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
 [...] To clarify, I only want to omit my
 /home/roger/.maildir/.roger folder and not my other folders such
 as /home/roger/.maildir/.rog...@isp.net folder(s).

I'd use grep; something like the following:

find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'

(Adapt the regexp depending on how strict you need to be.)

-- 
David Haguenauer


pgpX0rewUqfn6.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Gregor Zattler
Hi rogerx, mutt-users,
* rog...@sdf.org rog...@sdf.org [14. Jul. 2010]:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
[...]
 To clarify, I only want to omit my /home/roger/.maildir/.roger folder
 and not my other folders such as /home/roger/.maildir/.rog...@isp.net
 folder(s).

How about 
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h\n'|grep -v 
'/home/roger/.maildir/.roger$'|tr \n  `



Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
Hi,

* rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
 [...] To clarify, I only want to omit my
 /home/roger/.maildir/.roger folder and not my other folders such
 as /home/roger/.maildir/.rog...@isp.net folder(s).

I'd use grep; something like the following:

find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'

(Adapt the regexp depending on how strict you need to be.)


Great THANKS!  I think this one worked right out of the box, as is.

I spent hours looking at man find, google, etc and none worked and I thought
grep -v wouldn't work.


The other email response using ['/home/roger/.maildir/.roger$'|tr \n  ],
I don't know about -- as to why the newline char?


I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

-- 
Roger
http://rogerx.freeshell.org/


pgpeTH7PqK5i6.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread rogerx
On Thu, Jul 15, 2010 at 08:07:19AM +0200, Gregor Zattler wrote:
Hi rogerx, mutt-users,
* rog...@sdf.org rog...@sdf.org [14. Jul. 2010]:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
[...]
 To clarify, I only want to omit my /home/roger/.maildir/.roger folder
 and not my other folders such as /home/roger/.maildir/.rog...@isp.net
 folder(s).

How about 
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h\n'|grep -v 
'/home/roger/.maildir/.roger$'|tr \n  `

On second try, this one actually does work!

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Christian Ebert
* Roger on Wednesday, July 14, 2010 at 23:12:02 -0800
 On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
 I'd use grep; something like the following:
 
   find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
 
 (Adapt the regexp depending on how strict you need to be.)
 
 Great THANKS!  I think this one worked right out of the box, as is.
 
 I spent hours looking at man find, google, etc and none worked and I thought
 grep -v wouldn't work.

You can circumvent grep by find -E ! -regex, note it takes the
full path, or exclude by negating -name: ! -name. Also -printf is
not portable.

I use something like:


mailboxes `find -E ~/Mail -type d \( -name cur -o -name new -o -name tmp \
   ! -regex '.*/(_|(Archive|News)/).*' \
   -execdir pwd \; \) -prune | tr '\n' ' '`


c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org/
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


Using a remote firefox from .mailcap - how?

2010-07-15 Thread Chris G
I used to run mutt on my desktop machine at home with the following in
my .mailcap file:-

text/html; /usr/bin/firefox %s
text/html; links -dump %s -html-numbered-links 1; copiousoutput; 
nametemplate=%s.html

With auto_view text/html in my muttrc this means that by default I
got to see HTML E-Mails in my mutt pager window but I could open up the
HTML in Firefox using 'v' if I really needed do.


I now run mutt on the mail server machine on my home network rather than
on my desktop machine, it makes life easier in several ways so I don't
want to change that.

Hence it runs in a terminal window via ssh from my desktop, easy
enough to implement 'transparently' for most of the time.

However, obviously, the /usr/bin/firefox line in mailcap doesn't work
because there's no Firefox on the GUI-less mail server.  What's the
easiest way (if there is one) of feeding the HTML E-Mail from mutt
running on the mail server into a (nearly always) running firefox on
my desktop machine?

-- 
Chris Green


Re: Using a remote firefox from .mailcap - how?

2010-07-15 Thread Luciano Rocha
On Thu, Jul 15, 2010 at 03:05:32PM +0100, Chris G wrote:
 However, obviously, the /usr/bin/firefox line in mailcap doesn't work
 because there's no Firefox on the GUI-less mail server.  What's the
 easiest way (if there is one) of feeding the HTML E-Mail from mutt
 running on the mail server into a (nearly always) running firefox on
 my desktop machine?

There isn't. You'll need to copy the file to your local machine and then
run firefox on it.

And to copy it? You'd need a reverse ssh:

scp $@ host:/tmp
ssh host 'eval $(ps auxe |
grep  firefo[x] |
grep -Eo '(DISPLAY|XAUTHORITY)=[^[:space:]]*'
 );
export DISPLAY XAUTHORITY;
'firefox /tmp/$...@##*/}

And put that on a script and use that in the mailcap.

-- 
0/0


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Ed Blackman

On Wed, Jul 14, 2010 at 09:01:01PM -0800, rog...@sdf.org wrote:

@#...@# find.

... anyways.

How can I exclude one folder from my mailbox list using a find
pipe?

muttrc:
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`


find ~/.maildir/ -type d -name cur \( -regex '.*/\.roger' -prune -o -printf '%h 
' \)

Ed


signature.txt
Description: Digital signature


Re: URL not extracted from HTML by w3m in mutt autoview

2010-07-15 Thread Gary Johnson
On 2010-07-15, Erik Christiansen wrote:
 On Wed, Jul 14, 2010 at 11:29:34AM -0700, Gary Johnson wrote:
  On 2010-07-14, Erik Christiansen wrote:
   It's in an A tag: (I've munged some of the href's characters in this post)
   
   td height=3D60 colspan=3D3 align=3Dcenter valign=3Dmiddle=
   font face=3DArial color=3D#66 style=3Dfont-size:10pxa titl=
   e=3DView Email Online link href=3Dhttp://example.media.xyz.com.au:80/t=
   rack?t=3Dvmid=3D45671msgid=3D87652did=3D87641edid=3D26341sn=3D374852=
   7545eid=3df...@example.stuff.neteeid=3df...@example.stuff.netuid=3D9=
   56897rid=3D234564erid=3D234564fl=3Dmvid=3Dextra=3D2000eu=3D425=
   viewonline style=3Dcolor: #66Click here if you cannot view this =
   email properly/a/spanbr /=20
  
  If the URL is embedded within an A ... tag, as this one is, then
  w3m will not display it.  That is, in an HTML link written like
  this,
  
  A href=http://foo.com;bar/A
  
  w3m will display bar but not http://foo.com;.
 
 Ah, thank you. (And for improving my understanding of html.)
 
  In your original post you said that the URL was rendered as *.
  Did the * appear instead of Click here if you cannot view this
  email properly or was the * in front of Click here ...?
 
 The latter. It displays like this:
 
 *
  Click here if you cannot view this email properly

The * is probably a list bullet, or it may be an explicit * in
the text, possibly in the first column of the table of which the
Click here ... message is a part.

What happens if you open the attachment in the attachment menu?
That will use w3m to display the message instead of just using w3m
as a filter.  Do you see the * as a link?
 
 Wow. It opens the link in firefox.
 (Do you know, I've never before considered opening the message body in
 the attachment menu.)
 
   It's not an attachment. The message is only text/html.
   (Yes, I do dump 99% of them, just not this one. :)
  
  I guess I should have been more clear and written, What happens if
  you open the attachment or the message in the attachment menu?  I
  expect w3m to highlight the link but not display the URL.
 
 It automatically followed the link, opening it in firefox.

I think that Firefox is displaying the message, as a result of the
first text/html rule in /etc/mailcap:

text/html; /usr/bin/sensible-browser '%s'; description=HTML Text; 
nametemplate=%s.html

(I didn't look at those rules closely enough when I first read your
message.)  /usr/bin/sensible-browser is either a link to Firefox or
a program that somehow decides what a sensible browser is in this
case and opens it.

  If your w3m is configured to allow the use of an external browser,
  typing
  
  EscM
  
  on the link will open the link in the external browser.
 
 Seems like it shot right past any opportunity to do that.
 
 Many thanks for helping me understand better what's happening between
 mutt and w3m, to get to the browser.

You're very welcome.

 I might just interpose a wrapper around w3m, taking your information to
 modify the 
 
  A href=http://foo.com;bar/A
 
 to
   A href=http://foo.com; http://foo.com; bar/A
 
 Then I can copy-paste the displayed URL into an extant firefox instance,
 instead of locking up mutt until a firefox instance, opened via the
 attachment menu, is closed.

You can get around the problem of Firefox locking up mutt by using a
script that launches Firefox in the background.  There's a example
here:

http://www.spocom.com/users/gjohnson/mutt/#background

To extract the URLs from a message, you might try urlview, bound to
the Ctrl-B key in mutt by default.  You could also try using lynx
instead of w3m as your HTML-to-text converter.  It doesn't render
HTML as well as w3m, or didn't the last time I used it, but it does
gather all the URLs in a message and displays them as footnotes.

Regards,
Gary



Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Cameron Simpson
I'm sorry I'm late to this discussion - you guys seem to have a grep
obsession :-)

On 14Jul2010 23:12, Roger rog...@sdf.org wrote:
| On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
| * rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
|  How can I exclude one folder from my mailbox list using a find
|  pipe?
|  
|  muttrc:
|  mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
[...]
| 
| I'd use grep; something like the following:
| 
| find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
| 
| (Adapt the regexp depending on how strict you need to be.)
| 
| Great THANKS!  I think this one worked right out of the box, as is.
| 
| I spent hours looking at man find, google, etc and none worked and I thought
| grep -v wouldn't work.
[...]
| I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

Maybe not.

Isn't this more direct?

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
-printf '%h ' \)

It also avoids regexps, which are often annoying (escaping . to \. etc).

You can also speed it up greatly by pruning the search when you hit the
cur or new folders, otherwise find will walk all the messages as
well looking for deeper trees:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
-printf '%h ' -prune -o -name new -prune \)

which can be written:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -o -name cur -printf '%h 
' -o -name new \) -prune

And are your maildirs all at the top level, or are they deeper?
If you have a nested tree structure (I do - my old archived email is in
subtrees) you need find.
But if it is just a flat directory (.maildir/a, .maildir/b) you don't
need find at all! Just use echo!

  echo ~/.maildir/*

or 

  for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name ;; 
esac; done

Which should be faster than find (no directory tree walking at all).

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.  - Sir Arther Eddington


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Thu, Jul 15, 2010 at 11:37:33AM -0400, Ed Blackman wrote:
On Wed, Jul 14, 2010 at 09:01:01PM -0800, rog...@sdf.org wrote:
@#...@# find.

... anyways.

How can I exclude one folder from my mailbox list using a find
pipe?

muttrc:
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`

find ~/.maildir/ -type d -name cur \( -regex '.*/\.roger' -prune -o -printf 
'%h ' \)

Nope, /home/roger/.maildir/.roger still gets by this incantation as well!

Yea, tried the \( \) and !, not the regex until now, but they all allow
/home/roger/.maildir/.roger to get by except for the one post here en
stating the newline char at the end of it's incantation.

I always though find to be finicky at times. :-/

(As they say, Do one thing well... and let something else handle the other 
issues.)

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Fri, Jul 16, 2010 at 08:05:15AM +1000, Cameron Simpson wrote:
I'm sorry I'm late to this discussion - you guys seem to have a grep
obsession :-)

On 14Jul2010 23:12, Roger rog...@sdf.org wrote:
| On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
| * rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
|  How can I exclude one folder from my mailbox list using a find
|  pipe?
|  
|  muttrc:
|  mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
[...]
| 
| I'd use grep; something like the following:
| 
| find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
| 
| (Adapt the regexp depending on how strict you need to be.)
| 
| Great THANKS!  I think this one worked right out of the box, as is.
| 
| I spent hours looking at man find, google, etc and none worked and I thought
| grep -v wouldn't work.
[...]
| I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

Maybe not.

Isn't this more direct?

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
 -printf '%h ' \)

Yup.  This incantation works as well!

It also avoids regexps, which are often annoying (escaping . to \. etc).

You can also speed it up greatly by pruning the search when you hit the
cur or new folders, otherwise find will walk all the messages as
well looking for deeper trees:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
 -printf '%h ' -prune -o -name new -prune \)

which can be written:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -o -name cur -printf '%h 
 ' -o -name new \) -prune

And are your maildirs all at the top level, or are they deeper?
If you have a nested tree structure (I do - my old archived email is in
subtrees) you need find.
But if it is just a flat directory (.maildir/a, .maildir/b) you don't
need find at all! Just use echo!

  echo ~/.maildir/*

or 

  for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name ;; 
 esac; done

Which should be faster than find (no directory tree walking at all).

Cheers,

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.  - Sir Arther Eddington

The rest is interesting, yup, no subfolders here.

It's interesting how the obvious solutions stare us blankly in the face.  I
have been using echo (per wiki), but completely overlooked a for/next
incantation, grappling with find.

Cheers!

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread David Haguenauer
* rog...@sdf.org rog...@sdf.org, 2010-07-14 23:26:53 Wed:
 On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
 I'd use grep; something like the following:
 
 find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
 I just tried both of these, and they don't filter using the grep -v.
 
 If I'm not mistaken, find within the above incantation, finds every
 dir with a subfolder named cur, as such, the grep -v filter is
 simply ignored ...  because find already passed every folder on one
 line instead of multiple lines with a newline at the end of each
 folder.

Absolutely. I guess that shows how hard I tested my code before
posting it ;o). I'm sure you have found a command that actually solves
your problem by now.

-- 
David Haguenauer


pgpAPdMuZC9bo.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Cameron Simpson
On 15Jul2010 15:03, Roger rog...@sdf.org wrote:
| On Fri, Jul 16, 2010 at 08:05:15AM +1000, Cameron Simpson wrote:
|   for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name 
;; esac; done
| 
| Which should be faster than find (no directory tree walking at all).
| 
| Cheers,
| 
| Every particle continues in its state of rest or uniform motion in a straight
| line except insofar as it doesn't.  - Sir Arther Eddington
| 
| The rest is interesting, yup, no subfolders here.
| 
| It's interesting how the obvious solutions stare us blankly in the face.  I
| have been using echo (per wiki), but completely overlooked a for/next
| incantation, grappling with find.

It's worth noting that the above for loop needs to use:

  ~/.maildir/.*

because plain * won't match .roger, since it starts with a dot.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

A Guru is not one who simply knows all the answers.  Rather, a Guru is like
one who walks among the mountains, and by wandering around abit, can see the
horizon through long narrow canyons.