* [sup-talk] Tilde in maildir/mbox paths
@ 2007-09-07 7:37 Magnus Therning
[not found] ` <20070907092109.GB23285@die.therning.org>
2007-09-14 2:45 ` William Morgan
0 siblings, 2 replies; 8+ messages in thread
From: Magnus Therning @ 2007-09-07 7:37 UTC (permalink / raw)
I find it useful to be able to stick '~' in paths so here's an attempt
at a patch that allows a source with the URI maildir:~/mail/in.
Two comments:
1. I didn't really know where to stick expand_uri so it's duplicated in
Maildir and Mbox. This is far from ideal. Please tell me where it
belongs.
2. Parsing URIs of the form maildir://~/mail/in seems to be
problematic:
irb(main):001:0> require 'uri'
=> true
irb(main):002:0> URI('maildir://~/mail/in')
URI::InvalidURIError: the scheme maildir does not accept registry part: ~ (or bad hostname?)
from /usr/lib/ruby/1.8/uri/generic.rb:195:in `initialize'
from /usr/lib/ruby/1.8/uri/common.rb:492:in `new'
from /usr/lib/ruby/1.8/uri/common.rb:492:in `parse'
from /usr/lib/ruby/1.8/uri/common.rb:608:in `URI'
from (irb):2
from :0
I don't know how to get around this so I changed the help text for
sup-add.
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus?therning?org Jabber: magnus?therning?gmail?com
http://therning.org/magnus
As we enjoy great advantages from the inventions of others we should
be glad of an opportunity to serve others by any invention of
ours, and this we should do freely and generously.
-- Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup_514-1.diff
Type: text/x-diff
Size: 2454 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070907/6f68e559/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070907/6f68e559/attachment-0001.bin
^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20070907092109.GB23285@die.therning.org>]
* [sup-talk] Tilde in maildir/mbox paths
[not found] ` <20070907092109.GB23285@die.therning.org>
@ 2007-09-07 18:47 ` Magnus Therning
0 siblings, 0 replies; 8+ messages in thread
From: Magnus Therning @ 2007-09-07 18:47 UTC (permalink / raw)
Excerpts from Magnus Therning's message of Fri Sep 07 10:21:09 +0100 2007:
> On Fri, Sep 07, 2007 at 08:37:21 +0100, Magnus Therning wrote:
> >I find it useful to be able to stick '~' in paths so here's an attempt
> >at a patch that allows a source with the URI maildir:~/mail/in.
> >
> >Two comments:
> >
> > 1. I didn't really know where to stick expand_uri so it's duplicated in
> > Maildir and Mbox. This is far from ideal. Please tell me where it
> > belongs.
>
> An obvious place would of course be the parent class Source. For some
> strange reason that didn't enter my mind while I was hacking on this.
A modified patch is attached.
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus?therning?org Jabber: magnus?therning?gmail?com
http://therning.org/magnus
What if I don't want to obey the laws? Do they throw me in jail with
the other bad monads?
-- Daveman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup_514-2.diff
Type: application/octet-stream
Size: 2273 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070907/4d16512d/attachment.obj
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] Tilde in maildir/mbox paths
2007-09-07 7:37 [sup-talk] Tilde in maildir/mbox paths Magnus Therning
[not found] ` <20070907092109.GB23285@die.therning.org>
@ 2007-09-14 2:45 ` William Morgan
2007-09-14 21:38 ` Magnus Therning
1 sibling, 1 reply; 8+ messages in thread
From: William Morgan @ 2007-09-14 2:45 UTC (permalink / raw)
Hi Magnus,
Excerpts from Magnus Therning's message of Fri Sep 07 00:37:21 -0700 2007:
> I find it useful to be able to stick '~' in paths so here's an attempt
> at a patch that allows a source with the URI maildir:~/mail/in.
Thanks for the patch! What about modifying this slightly so that the
~-expansion is done at the string level instead of the URI level, in a
method called Source#expand_filesystem_uri or something. Then Maildir
and MBox::Loader sticks the output of that method into URI.
I think that change will solve two problems: it will make clear that the
expansion method is filesystem-specific (i.e. even though the method is
in Source, only filesystem sources want to call it), and it will allow
us to support URIs the "right way", without the weird #opaque stuff and
without dropping all mbox:// and maildir:// URLs. What do you think?
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] Tilde in maildir/mbox paths
2007-09-14 2:45 ` William Morgan
@ 2007-09-14 21:38 ` Magnus Therning
2007-09-14 22:44 ` Magnus Therning
0 siblings, 1 reply; 8+ messages in thread
From: Magnus Therning @ 2007-09-14 21:38 UTC (permalink / raw)
On Thu, Sep 13, 2007 at 19:45:56 -0700, William Morgan wrote:
>Hi Magnus,
>
>Excerpts from Magnus Therning's message of Fri Sep 07 00:37:21 -0700 2007:
>> I find it useful to be able to stick '~' in paths so here's an attempt
>> at a patch that allows a source with the URI maildir:~/mail/in.
>
>Thanks for the patch! What about modifying this slightly so that the
>~-expansion is done at the string level instead of the URI level, in a
>method called Source#expand_filesystem_uri or something. Then Maildir
>and MBox::Loader sticks the output of that method into URI.
>
>I think that change will solve two problems: it will make clear that
>the expansion method is filesystem-specific (i.e. even though the
>method is in Source, only filesystem sources want to call it), and it
>will allow us to support URIs the "right way", without the weird
>#opaque stuff and without dropping all mbox:// and maildir:// URLs.
>What do you think?
File.expand_path requires the tilde to be at the start of its argument,
so that prompted the strange #opaque stuff. I made some changes and
stuck a modified patch in the attachment. Let me know what you think.
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus?therning?org Jabber: magnus?therning?gmail?com
http://therning.org/magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070914/f67d4866/attachment.bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] Tilde in maildir/mbox paths
2007-09-14 21:38 ` Magnus Therning
@ 2007-09-14 22:44 ` Magnus Therning
2007-09-15 3:41 ` William Morgan
0 siblings, 1 reply; 8+ messages in thread
From: Magnus Therning @ 2007-09-14 22:44 UTC (permalink / raw)
On Fri, Sep 14, 2007 at 22:38:23 +0100, Magnus Therning wrote:
>On Thu, Sep 13, 2007 at 19:45:56 -0700, William Morgan wrote:
>>Hi Magnus,
>>
>>Excerpts from Magnus Therning's message of Fri Sep 07 00:37:21 -0700 2007:
>>> I find it useful to be able to stick '~' in paths so here's an attempt
>>> at a patch that allows a source with the URI maildir:~/mail/in.
>>
>>Thanks for the patch! What about modifying this slightly so that the
>>~-expansion is done at the string level instead of the URI level, in a
>>method called Source#expand_filesystem_uri or something. Then Maildir
>>and MBox::Loader sticks the output of that method into URI.
>>
>>I think that change will solve two problems: it will make clear that
>>the expansion method is filesystem-specific (i.e. even though the
>>method is in Source, only filesystem sources want to call it), and it
>>will allow us to support URIs the "right way", without the weird
>>#opaque stuff and without dropping all mbox:// and maildir:// URLs.
>>What do you think?
>
>File.expand_path requires the tilde to be at the start of its argument,
>so that prompted the strange #opaque stuff. I made some changes and
>stuck a modified patch in the attachment. Let me know what you think.
This time with the attachment...
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus?therning?org Jabber: magnus?therning?gmail?com
http://therning.org/magnus
Of course I laugh at my own jokes. You can't trust strangers.
-- Phyllis Diller
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup_529-1.diff
Type: text/x-diff
Size: 1444 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070914/79e8f0e8/attachment-0002.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070914/79e8f0e8/attachment-0003.bin
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] Tilde in maildir/mbox paths
2007-09-14 22:44 ` Magnus Therning
@ 2007-09-15 3:41 ` William Morgan
2007-09-15 10:19 ` Magnus Therning
0 siblings, 1 reply; 8+ messages in thread
From: William Morgan @ 2007-09-15 3:41 UTC (permalink / raw)
Excerpts from Magnus Therning's message of Fri Sep 14 15:44:26 -0700 2007:
> This time with the attachment...
Time to turn on :confirm_no_attachments!
I've applied your patch, with a couple changes. Thanks!
--
William <wmorgan-sup at masanjin.net>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [sup-talk] Tilde in maildir/mbox paths
2007-09-15 3:41 ` William Morgan
@ 2007-09-15 10:19 ` Magnus Therning
2007-09-17 17:30 ` William Morgan
0 siblings, 1 reply; 8+ messages in thread
From: Magnus Therning @ 2007-09-15 10:19 UTC (permalink / raw)
On Fri, Sep 14, 2007 at 20:41:28 -0700, William Morgan wrote:
>Excerpts from Magnus Therning's message of Fri Sep 14 15:44:26 -0700 2007:
>> This time with the attachment...
>
>Time to turn on :confirm_no_attachments!
>
>I've applied your patch, with a couple changes. Thanks!
I really should have found String::gsub myself. I was just so confused
by the existence of String::replace and what it does...
One thing though. You've moved the expansion of tilde so that the
expanded URI is passed to Source and it ends up in .sup/sources.yaml.
My intention was to have the tilde unexpanded in .sup/sources.yaml.
This would allow sharing of sup configuration between different
accounts, as long as the locations of mail boxes are the same relative
to the home directory.
The reason is again my own mail set-up. Mutt takes paths to mail boxes
and expands tilde. This allows me to have identical Mutt configurations
on machines where I have different login names (at some places I don't
have the luxury of getting to choose my own login, e.g. at work).
I've attached a patch that moves the expansion back to the sub-classes
again.
/M
--
Magnus Therning (OpenPGP: 0xAB4DFBA4)
magnus?therning?org Jabber: magnus?therning?gmail?com
http://therning.org/magnus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sup_537-1.patch
Type: text/x-diff
Size: 1595 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070915/ea163096/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://rubyforge.org/pipermail/sup-talk/attachments/20070915/ea163096/attachment-0001.bin
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-09-17 17:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07 7:37 [sup-talk] Tilde in maildir/mbox paths Magnus Therning
[not found] ` <20070907092109.GB23285@die.therning.org>
2007-09-07 18:47 ` Magnus Therning
2007-09-14 2:45 ` William Morgan
2007-09-14 21:38 ` Magnus Therning
2007-09-14 22:44 ` Magnus Therning
2007-09-15 3:41 ` William Morgan
2007-09-15 10:19 ` Magnus Therning
2007-09-17 17:30 ` William Morgan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox