<<< Date Index >>>     <<< Thread Index >>>

Re: strip[p]ing attachment lines in the pager



On Mon, Dec 15, 2003 at 01:57:02PM +0200, Denis V. Lozko wrote:
> Good day!
> On Fri, 12/12/03, 16:50 -0800 Gary Johnson wrote:
> >On 2003-12-13, "Denis V. Lozko" <talmuth@xxxxxxxxxxxxx> wrote:
> >>Hi, mutters!
> >>is there the way to strip attachment lines in the pager view?
> >>I mean lines:
> >>[-- Attachment #1 --]
> >>any ideas?
> >Yes, use a 'display_filter', e.g.,
> >   set display_filter="sed '/^.*\\[-- .* --]$/d'"
> Mutt's gone crazy when i've try this option
> may be i don't understood coorectly
> but next line will be helpfull for advicers
> ed: 1: "/^^[.*^G\[-- .* --]$/d": RE error: invalid character range

Well.. if I understand my regexps correctly, sed/ed is interpreting
'[.*^G\[-- .* --]' as an attempt at a character range.. that is, any
of the characters in the midst of the []'s.  Probably it's taking
exception to the duplicated characters [.*- ].  I'm not sure what the
^G part is for, but here's my attempt at a filter that would delete
only lines which begin with '[-- ' and end with ' --]' and have some
text in between:

set display_filter="sed -e '/^\\[-- .* --\\]$/d'"

A brief test reveals that this doesn't actually delete the attachment
lines (I'm not sure why).  However, it works just fine when you get
rid of the end-of-line anchors.

set display_filter="sed -e '/\\[-- .* --\\]/d'"

You can get a pretty good description of sed regular expressions by
reading the sed documentation ('info sed' on my system.)  The double
backslashes before the brackets are there to escape them, since they
are special characters.  The backslashes need to be doubled because
mutt de-escapes backslashes within its quoted strings.  So, the
command actually ends up being "sed -e '/\[-- .* --\]/d'"

Auf wiedersehen,
 Allister

-- 
Allister MacLeod <amacleod@xxxxxxxx> | http://amacleod.is-a-geek.org/
 Elen síla lúmenn'omentielvo.