Sunday, August 23, 2009

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

Hi Tony

> > Something that would be seriously cool IMHO is a function
> > that parses the mail body and extracts all filename like strings.
>
> How do you define a filename-like string?
>
> > Almost all my filenames have a 3 (or4) char suffix.


I am using mutt for non-technical correspondence. So I apologise
that such a function would not be of interest to the general
technical community.

Almost every file that I originate and which to mail receive is matching
a regex like:
[\S]\{1,\}\.[\S]\{3,4\}
or a more accurate regex that someone else might come up with but YKWIM.

Of course I would prune the proposed attachments before sending
something not wanted.

PS. I am saving loads of energy and time already with the
screenpastePlugin.vim - why did it take so many years for me to
discover?

On another point, the great mapping of Christian:
nnoremap sp :1ScreenPut!<CR>:sil,0s/^/Attach: /<CR>

This places the attachments on line 1 above the headers.
I want the attachments to be appended to the headers.
In my original example, I used the normal movement command "}"
"How would I modify the above mapping with the command line equivalent of
"}"

Thanks a lot.

--
- Eric Smith
Tony Mechelynck said:
>
> On 19/08/09 23:28, Eric Smith wrote:
> >
> > Just a thought apropos this script of Christian and getting
> > greedier still.
> >
>
> This is not true on Unix-like OSes (which is where mutt is usually
> found). Most of my bash scripts, including most of those distributed
> with my Linux distro, have no extension at all; and this is not limited
> to executable scripts, see at bottom. Among the filenames that do have a
> "suffix", as you call it, I see buffer.c, run-mozilla.sh, csh.cshrc,
> csh.logout, as typical examples of well-known files or filetypes whose
> extension has 1, 2, 5 or 6 characters.
>
> > And then to attach these to the mail automatically, using the
> > header Attach:.
> >
> > I would love something like that.
> >
>
> Let's say your mail (quoted above) was used as "the mail body". Then the
> function would try to extract all the following files from the current
> directory:
>
> Just
> a
> thought
> apropos
> this
> script
> of
> Christian
> and
> getting
> greedier
> still.
> Something
> that
> would
>
> ...etc. Note that at least one of the above (apropos) is known to exist
> "somewhere in the $PATH", with no extension, on most Unix-like
> installations. (Here, /usr/bin/apropos is a softlink to whatis in the
> same directory.)
>
> Then also, there are "true" filenames -- let's say
> ~/.vim/doc/matchit.txt, cscope.out, src/eval.c, patches/001-100.gz --
> which you wouldn't want to attach to any message that mentions them,
> even if found on your system.
>
>
>
> Best regards,
> Tony.
> --
> THE LESSER-KNOWN PROGRAMMING LANGUAGES #2: RENE
>
> Named after the famous French philosopher and mathematician Rene
> DesCartes, RENE is a language used for artificial intelligence. The
> language is being developed at the Chicago Center of Machine Politics
> and Programming under a grant from the Jane Byrne Victory Fund. A
> spokesman described the language as "Just as great as dis [sic] city of
> ours."
>
> The center is very pleased with progress to date. They say they have
> almost succeeded in getting a VAX to think. However, sources inside the
> organization say that each time the machine fails to think it ceases to
> exist.
>
>

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

No comments: