Wednesday, August 19, 2009

Re: screenpastePlugin.vim -> extract filenames from mailbody and attach

Just a thought apropos this script of Christian and getting
greedier still.

Something that would be seriously cool IMHO is a function
that parses the mail body and extracts all filename like strings.
Almost all my filenames have a 3 (or4) char suffix.
And then to attach these to the mail automatically, using the
header Attach:.

I would love something like that.

--
Vriendelijke groeten, / Best regards,
Eric Smith
Tel Wageningen: +31 317 728888
Mobile: 00 31 6 455 09313


Christian Brabandt wrote on Fri-14-Aug 09 1:26PM
>
> Hi Eric!
>
> On Do, 13 Aug 2009, Eric Smith wrote:
>
> > I am using this mapping (to attach files with mutt)
>
> I once pasted this script to the mutt-users mailinglinst. It might be
> helpful:
>
> " This function checks your mail for the words specified in
> " check, and if it find them, you'll be asked to attach
> " a file.
> function! CheckAttach()
> let check='attach,angehängt,attachment,Anhang'
> let oldPos=getpos('.')
> let ans=1
> let val = join(split(escape(check,' \.+*'), ','),'\|')
> 1
> if search('\%('.val.'\)','W')
> let ans=input("Attach file: (leave empty to abbort): ", "", "file")
> while (ans != '')
> normal magg}-
> call append(line('.'), 'Attach: '.ans)
> redraw
> let ans=input("Attach another file?: (leave empty to abbort): ", "", "file")
> endwhile
> endif
> exe ":write ". expand("<amatch>")
> call setpos('.', oldPos)
> endfu
>
> augroup script
> au!
> au BufWriteCmd,FileWriteCmd mutt* :call CheckAttach()
> augroup END
>
> command! -nargs=1 -complete=file AttachFile exe "normal magg}-" | call
> append(line('.'), 'Attach: '.escape("<args>", " ")) | normal `a
>
> regards,
> Christian
> --
> If an elephant is left tied to a parking meter, the parking fee has to be paid
> just as it would for a vehicle.
> [real standing law in Florida, United States of America]
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment