Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

not quoting signatures on reply

4 views
Skip to first unread message

Leonid Mamtchenkov

unread,
Aug 9, 2000, 3:00:00 AM8/9/00
to

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello All,

Finally, I have the problem solved. What I wanted to do is to skip
signatures in quoted message while replying. For those who are
interested, here is how I did it ;-)

First, I have wrote the perl script (find attached) that removes
signatures from the passed file and saves the resulting file in the same
place.

Then, I have wrote a shell script, which basically is just a call to my
script, and then a call to my editor.

Then I have changed "set editor" line in my .muttrc to the path to the
shell script.

Ok, both scripts are attached, and I hope that the whole thing will work
for you as well, although it works only if you have your indent_str="> "
and reply has a normal signature, which begins with "-- " ;-)

--
Best regards,
Leonid Mamtchenkov
System administrator
J.F.Services Ltd. (Limassol, Cyprus)
E-mail: leo...@jfs-cy.com

--FCuugMFkClbJLl1L
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="remsig.pl"

#!/usr/bin/perl

# This script removes signatures when quoting e-mail replies.
$filename=shift; # Mutt will pass it ;-)

# Read all the lines from the file.
open (IN, "<$filename") || die "Could not read from $filename.\n";
@lines=<IN>;
close (IN);

open (OUT, ">$filename") || die "Could not write to $filename.\n";
$sigstarted=0;
foreach $_ (@lines) {
# chomp $_;
if (!(/^\>/)) { # My indent_str is "> "...
$sigstarted=0;
}
elsif ((/^\>/) && (!(/^\>\ -- $/)) && ($sigstarted eq 0)) {
$sigstarted=0;
}
elsif (/^\>\ -- $/) {
$sigstarted=1;
}
if ($sigstarted eq 0) {
print OUT $_;
}
}
close (OUT);

--FCuugMFkClbJLl1L
Content-Type: application/x-sh
Content-Disposition: attachment; filename="mypico.sh"

#!/bin/bash

~~/bin/remsig.pl $1
pico -t $1

--FCuugMFkClbJLl1L--


Ronny Haryanto

unread,
Aug 9, 2000, 3:00:00 AM8/9/00
to
On 09-Aug-2000, Leonid Mamtchenkov wrote:
> First, I have wrote the perl script (find attached) that removes
> signatures from the passed file and saves the resulting file in the same
> place.

If you use vim, you can do either:

- put this in your muttrc:
set editor = "vi +'/^[ ,\t]*> -- /,/^-- /-2d'"
or,
- muttrc:
set editor = "vi -u ~/.vimrc-mutt"
and in ~/.vimrc-mutt:
source ~/.vimrc
set ft=mail
au BufRead * normal :g/^> -- $/,/^$/-1d<CR><C-L>gg

> Then, I have wrote a shell script, which basically is just a call to my
> script, and then a call to my editor.

Your perl script can be simplified to a one-liner:

#!/usr/bin/perl -i -pe 'exit(0) if(/^> -- $/)'

Cheers,

Ronny

David T-G

unread,
Aug 10, 2000, 3:00:00 AM8/10/00
to

--HC0F8i/BfMshQzR8

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Ronny, et al --

=2E..and then Ronny Haryanto said...
% On 09-Aug-2000, Leonid Mamtchenkov wrote:
% > First, I have wrote the perl script (find attached) that removes
% > signatures from the passed file and saves the resulting file in the same
% > place.
%=20
% If you use vim, you can do either:

That was part of his problem; he uses pico :-)


=2E..
%=20
% Your perl script can be simplified to a one-liner:
%=20
% #!/usr/bin/perl -i -pe 'exit(0) if(/^> -- $/)'

Um, that gets rid of his sig, too. I just tried it on a fake reply of my
own... Of course, it would work for those who don't have sigs (like your
case).


%=20
% Cheers,
%=20
% Ronny


:-D
--=20
David T-G * It's easier to fight for one's principles
(play) dav...@bigfoot.com * than to live up to them. -- fortune cookie
(work) david...@bigfoot.com
http://www.bigfoot.com/~davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001. There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


--HC0F8i/BfMshQzR8
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5kZtCUScpmrZtnuoRAoyfAJ47i4wY0jc+oASkfbBKjMqehzSZmwCgypQs
lV932Icn3mm0rBwbVJ7tcjQ=
=0r7M
-----END PGP SIGNATURE-----

--HC0F8i/BfMshQzR8--

Caster

unread,
Aug 10, 2000, 3:00:00 AM8/10/00
to
Hello Mutt Users!

On śro 09 sie 2000 16:30:24 GMT Leonid Mamtchenkov wrote:

> Then I have changed "set editor" line in my .muttrc to the path to the
> shell script.

Well, I found that %s in $editor expands to the filename containing the
message, so you can use just something like:
set editor="some_script %s; vim %s"
I think this escape sequence is not documented? Or maybe it's only a bug
;).
BTW: I think that there should me one more escape sequence meaning the
number of line when the editor should place the cursor (line after the
first blank line in the message). There is such feature in tin.

--
Tomasz Olszewski
cas...@from.pl

Ronny Haryanto

unread,
Aug 10, 2000, 3:00:00 AM8/10/00
to
[Oops! Cc'd to the wrong list.. Heh.. Sorry.]

On 09-Aug-2000, Timothy Ball wrote:


> On Wed, Aug 09, 2000 at 10:46:56AM -0500, Ronny Haryanto wrote:
> > - muttrc:
> > set editor = "vi -u ~/.vimrc-mutt"
> > and in ~/.vimrc-mutt:
> > source ~/.vimrc
> > set ft=mail
> > au BufRead * normal :g/^> -- $/,/^$/-1d<CR><C-L>gg
>

> When I do this vim complains of "trailing characters. What's the C-L
> supposed to do?

Ugh, sorry about that. The <C-L> was meant to be Ctrl-L which clears
the screen after vim complains if it cannot find quoted signature.
Apparently the <...> construct doesn't work in this case (any vimmers
here willing to explain?), try inserting a literal CR (press Ctrl-V
followed by Enter) and a literal Ctrl-L (press Ctrl-V followed by
Ctrl-L).

The above method assumes that you use $signature and $sig_dashes so
that there's a blank line after the quoted mail and your own
signature. I should have mentioned this earlier.

Ronny

David T-G

unread,
Aug 10, 2000, 3:00:00 AM8/10/00
to

--zmbF4WfaG2f6E7cU

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Tomasz --

=2E..and then Caster said...
% Hello Mutt Users!

Hi there!


% On sro 09 sie 2000 16:30:24 GMT Leonid Mamtchenkov wrote:
%=20
% > Then I have changed "set editor" line in my .muttrc to the path to the
% > shell script.
%=20
% Well, I found that %s in $editor expands to the filename containing the
% message, so you can use just something like:
% set editor=3D"some_script %s; vim %s"
% I think this escape sequence is not documented? Or maybe it's only a bug
% ;).

It's a valid escape sequence, and I think I've heard of it before. It
might not, however, be fully documented :-)


% BTW: I think that there should me one more escape sequence meaning the
% number of line when the editor should place the cursor (line after the
% first blank line in the message). There is such feature in tin.

You can usually do this in your editor; if it were vim, for instance, you
could say something like

set editor=3D"vim +/^$"

to jump to the first blank line. In fact, that's exactly how my $editor
is set :-)


%=20
% --=20
% Tomasz Olszewski
% cas...@from.pl


:-D
--=20
David T-G * It's easier to fight for one's principles
(play) dav...@bigfoot.com * than to live up to them. -- fortune cookie
(work) david...@bigfoot.com
http://www.bigfoot.com/~davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001. There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


--zmbF4WfaG2f6E7cU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE5kpOcUScpmrZtnuoRAkEDAKCv9gn8zvY8EzTfkYO0HGUcYHoi9gCfe1in
kKhFNHPFw2GMFGnGJo2O40s=
=Q45K
-----END PGP SIGNATURE-----

--zmbF4WfaG2f6E7cU--

Caster

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to

--CE+1k2dSO48ffgeK

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Mutt Users!


On czw 10 sie 2000 07:35:56 GMT David T-G wrote:

> It's a valid escape sequence, and I think I've heard of it before. It
> might not, however, be fully documented :-)

In fact I don't see any mention of it in the docs (I mean in refer to
the name of the edited file).

> You can usually do this in your editor; if it were vim

What else can it be ;)

> for instance, you could say something like
> set editor=3D"vim +/^$"

Thanks to you :) now I'm using:
set editor=3D"vim +/^$ +/^$ +nohlsearch"
It places the cursor in the beginning of the second blank line and turns
highlighting of search results to off.
However not everyone is using vim, so such option inside mutt could be
useful.

--=20
Tomasz Olszewski
cas...@from.pl

--CE+1k2dSO48ffgeK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjmS+CQACgkQNe5lvQ9vy7GMnwCfV++as6tgAO14YA9M4CbgNIru
U/wAn245i9wgCS32+ngq11qUy0CwEGiL
=25mf
-----END PGP SIGNATURE-----

--CE+1k2dSO48ffgeK--

Peter Palfrader

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
On Thu, 10 Aug 2000, Caster wrote:

> > for instance, you could say something like

> > set editor="vim +/^$"


>
> Thanks to you :) now I'm using:

> set editor="vim +/^$ +/^$ +nohlsearch"


> It places the cursor in the beginning of the second blank line and turns
> highlighting of search results to off.
> However not everyone is using vim, so such option inside mutt could be
> useful.

Well, now I feel quite dump for not thinking of the very simple thing
with vim, but this should work for all editors (that support +<lineno>):

set editor="vim +\`awk '/^$/ {print i+2; exit} {i++}' %s\` %s"

It is stolen from Roland Rosenfeld's <rol...@spinnaker.de> great
muttrcs.

HTH
yours,
peter

--
PGP encrypted messages preferred.
http://www.cosy.sbg.ac.at/~ppalfrad/
[please CC me on lists]

Ronny Haryanto

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
On 09-Aug-2000, Ronny Haryanto wrote:
> > > au BufRead * normal :g/^> -- $/,/^$/-1d<CR><C-L>gg
>
> Ugh, sorry about that. The <C-L> was meant to be Ctrl-L which clears
> the screen after vim complains if it cannot find quoted signature.
> Apparently the <...> construct doesn't work in this case (any vimmers
> here willing to explain?), try inserting a literal CR (press Ctrl-V
> followed by Enter) and a literal Ctrl-L (press Ctrl-V followed by
> Ctrl-L).

Michael Geddes from the vim list corrected the above (Thanks!):
au BufRead * exe "normal :g/^> -- $/,/^$/-1d\<CR>\<C-L>gg"

> The above method assumes that you use $signature and $sig_dashes so
> that there's a blank line after the quoted mail and your own
> signature. I should have mentioned this earlier.

If you don't use sig and sig_dashes (like me), you can use:
au BufRead * exe "normal :g/^> -- $/,$d\<CR>\<C-L>gg"

Ronny

Michael Tatge

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to

--liOOAslEiF7prFVr

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Caster muttered:


> > It's a valid escape sequence, and I think I've heard of it before. It
> > might not, however, be fully documented :-)

>=20


> In fact I don't see any mention of it in the docs (I mean in refer to
> the name of the edited file).

It's there:

5.3.3.3. Command Expansion

The various commands defined in the mailcap files are passed to the
/bin/sh shell using the system() function. Before the command is =20
passed to /bin/sh -c, it is parsed to expand various special =20
parameters with information from Mutt. The keywords Mutt expands
are:

%s As seen in the basic mailcap section, this variable is expanded=20
to a filename specified by the calling program. This file
contains the body of the message to view/print/edit or where
the composing program should place the results of composition.=20
In addition, the use of this keyword causes Mutt to not pass
the body of the message to the view/print/edit program on
stdin.
=20
HTH,

Michael
--=20
The program isn't debugged until the last user is dead.

PGP-fingerprint: DECA E9D2 EBDD 0FE0 0A65 40FA 5967 ACA1 0B57 7C13

--liOOAslEiF7prFVr
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)


Comment: For info see http://www.gnupg.org

iD8DBQE5k0tyWWesoQtXfBMRApc7AJ4/ZYSZMNGJPXEdmHXjftFwQ1Mr+QCglf8H
XjRm9xWNzhqACdED+CLsnSg=
=WPDJ
-----END PGP SIGNATURE-----

--liOOAslEiF7prFVr--

Marius Gedminas

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
On Fri, Aug 11, 2000 at 02:40:18AM +0200, Michael Tatge wrote:
> Caster muttered:
> > > It's a valid escape sequence, and I think I've heard of it before. It
> > > might not, however, be fully documented :-)
> >
> > In fact I don't see any mention of it in the docs (I mean in refer to
> > the name of the edited file).
>
> It's there:
>
> 5.3.3.3. Command Expansion
>
> The various commands defined in the mailcap files are passed to the
> /bin/sh shell using the system() function. Before the command is
> passed to /bin/sh -c, it is parsed to expand various special
> parameters with information from Mutt.

It would be nice to mention that $editor also passes through this
expansion stage (and add a reference to this section in 6.3.35. which
talks about $editor).

Are there more places other than mailcap and $editor that accept these
keywords?

Marius Gedminas
--
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler. You've seen what food processors do to food, right?

Kai Blin

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
Sitting at the campfire, Caster told:

> However not everyone is using vim, so such option inside mutt could be
> useful.

I still don't see why this is a Mutt issue. UN*X/Linux philosophy is to have
one program working on one field and using other programs for other work.
Mutt is one of those. that's why you use lynx or whatever webbrowser to view
html, your $editor to edit mails..

We don't want Mutt to become something like StarOffice (can do anything, but
poorly), do we?

Greetings

Kai

--
x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x
Kai Blin(mailto:kai....@uni-tuebingen.de) Webmaster
Inst. of Human Genetics Dept. of Molecular Genetics
Wilhelmstr 27 phone (49)7071-2974890
D 72074 Tuebingen, Germany fax (49)7071-295233
http://www.uni-tuebingen.de/uni/thm/molgen/molgen.html
----
Do molecular biologists wear designer genes?
x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x-x


David T-G

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to

--fUYQa+Pmc3FrFX/N

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Tomasz --

=2E..and then Caster said...
% Hello Mutt Users!

% On czw 10 sie 2000 07:35:56 GMT David T-G wrote:
%=20
% > You can usually do this in your editor; if it were vim
%=20
% What else can it be ;)

That's what I think, too, but the original requester is using (gasp) pico.


%=20
% > for instance, you could say something like
% > set editor=3D"vim +/^$"
%=20
% Thanks to you :) now I'm using:
% set editor=3D"vim +/^$ +/^$ +nohlsearch"
% It places the cursor in the beginning of the second blank line and turns
% highlighting of search results to off.

Most excellent! In fact, I'll go you one better (since this was, after
all, about cropping the quoted signature); I didn't realize that you
could chain +commands on the vim command line, but something like

set editor=3D"vim +/^'> -- '$ +?^$ +nohlsearch"

should find the quoted (assuming you use >_ for your quoting, unlike
me) sigdashes line, delete from there to the end of the paragraph,
and then go back to the first blank line. I'd even bet that you could,
when faced with a correspondent like Ronny who uses no signature, press
'u' to undo the deletion if it goes bad!


% However not everyone is using vim, so such option inside mutt could be
% useful.

Nah; I still like finding a way to let your editor, perhaps with help
from other tools, do it for you. Let mutt decide whether or not to
attach your signature and leave it at that.


%=20
% --=20
% Tomasz Olszewski
% cas...@from.pl


:-D
--=20
David T-G * It's easier to fight for one's principles
(play) dav...@bigfoot.com * than to live up to them. -- fortune cookie
(work) david...@bigfoot.com
http://www.bigfoot.com/~davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
The "new millennium" starts at the beginning of 2001. There was no year 0.
Note: If bigfoot.com gives you fits, try sector13.org in its place. *sigh*


--fUYQa+Pmc3FrFX/N
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)


Comment: For info see http://www.gnupg.org

iD8DBQE5k+VFUScpmrZtnuoRAte2AJwIA5Eo1Nvg/S/7zfl9SPVCvu7mfwCgsEx7
jsTZ0/0j7zAkprPiFgRyDV0=
=6ij2
-----END PGP SIGNATURE-----

--fUYQa+Pmc3FrFX/N--

Stan Ryckman

unread,
Aug 11, 2000, 3:00:00 AM8/11/00
to
Peter Palfrader wrote:
...

> but this should work for all editors (that support +<lineno>):
>
> set editor="vim +\`awk '/^$/ {print i+2; exit} {i++}' %s\` %s"
>
> It is stolen from Roland Rosenfeld's <rol...@spinnaker.de> great
> muttrcs.

Or even better, use the builtin awk variable NR:
set editor="vim +\`awk '/^$/ {print NR+1; exit}' %s\` %s"

Cheers,
Stan

Caster

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
Hello Mutt Users!

On pią 11 sie 2000 11:30:03 GMT Kai Blin wrote:

> We don't want Mutt to become something like StarOffice (can do anything, but
> poorly), do we?

I agree but it's just a very little thingie :) This isn't a html viewer.
Look at tin -- is it like Star Office?

--
Tomasz Olszewski
cas...@from.pl

Caster

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to

--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Mutt Users!
On pi=B1 11 sie 2000 02:40:18 GMT Michael Tatge wrote:

> It's there:
>=20
> 5.3.3.3. Command Expansion

Well, I missed it. Maybe because I always look for such things in the
"Configuration variables" section :)

--=20
Tomasz Olszewski
cas...@from.pl

--82I3+IH0IqGh5yIs
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjmT4WgACgkQNe5lvQ9vy7EmNwCfXoyEEb1wjh8Wgq0oX5eXScnU
cBkAn0SGKGyRmElaay2s0u0OpFwJnUwU
=CHVg
-----END PGP SIGNATURE-----

--82I3+IH0IqGh5yIs--

Caster

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
Hello Mutt Users!

On pią 11 sie 2000 00:19:09 GMT Peter Palfrader wrote:

> set editor="vim +\`awk '/^$/ {print i+2; exit} {i++}' %s\` %s"

Even more clever :)

--
Tomasz Olszewski
cas...@from.pl

iain truskett

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to
* Caster (cas...@from.pl) [12 Aug 2000 05:50]:
> Hello Mutt Users!

> On pia 11 sie 2000 00:19:09 GMT Peter Palfrader wrote:

> > set editor="vim +\`awk '/^$/ {print i+2; exit} {i++}' %s\` %s"

> Even more clever :)

Clever, but only useful if your vi clone doesn't support something like:
set editor="vim +/^$/+1"

And I've found that even the vi on the solaris machine I use (:version
gives "Version SVR4.0, Solaris 2.5.0") recognises "vi +/^$/+1".


cheers,
--
iain truskett, aka Koschei. <http://eh.org/~koschei/>
Emacs is a nice OS - but it lacks a good text editor.
That's why I am using Vim. -- Anonymous.

Caster

unread,
Aug 12, 2000, 3:00:00 AM8/12/00
to

--7AUc2qLy4jB3hD7Z

Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello Mutt Users!


On pi=B1 11 sie 2000 07:36:37 GMT David T-G wrote:

> Nah; I still like finding a way to let your editor, perhaps with help
> from other tools, do it for you. Let mutt decide whether or not to
> attach your signature and leave it at that.

Well, maybe you're right. Altough such feature [looking for the offset]
wouldn't dramatically slow things down, there is no *really* need for
it. External programs can always [unless one doesn't have any ;)] be
used (like the awk example).

--=20
Tomasz Olszewski
cas...@from.pl

--7AUc2qLy4jB3hD7Z
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjmUXGUACgkQNe5lvQ9vy7Fn6wCeN8k4N935PigSWB2VklMx7k3w
d8UAni1+6HOcaGTMDJXzgJ4Ng88UTkjg
=QQAP
-----END PGP SIGNATURE-----

--7AUc2qLy4jB3hD7Z--

0 new messages