[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] configurable part separator lines

From: Paul Fox
Subject: Re: [Nmh-workers] configurable part separator lines
Date: Tue, 29 Apr 2014 12:34:02 -0400

in the absence of any more comments, i've pushed this change (which
makes all part separator lines configurable) to master.  i've been
using it for a week now, and it seems solid -- i've been testing quite
a bit with various kinds of messages while writing some new wrapper
scripts, so it's gotten some exercise.

(i actually think it would be safe for 1.6, but it's late in that
game, and i'm about to go away for a week, so i'm not going to push
for that.  if someone else thinks it would be okay, then by all means
pull it in.)

in case anyone's interested, i use this marker format:

    address@hidden part %{part} - %{content-type} - %<{description}\
    %{description}%?{cdispo-filename}%{cdispo-filename}%|%{ctype-name}%> \
    %<(unseen)\(suppressed\)%> address@hidden

the ugly extra punctuation at either end makes it fairly reliable to
post-process to either add color or remove the markers entirely.  here
are some snippets of what i've been using:

        if [ -t 1 ]
            RED="$(printf \\033[31m)"
            GREEN="$(printf \\033[32m)"
            YELLOW="$(printf \\033[33m)"
            BLUE="$(printf \\033[34m)"
            NORMAL="$(printf \\033[m)"

        sed -e "1,/^$/s/^Subject:\(.*\)/Subject:${RED}\1${NORMAL}/"  \
            -e "1,/^$/s/^From:\(.*\)/From:${BLUE}\1${NORMAL}/" 

        # 1: removes default top-level non-mime text/plain separator
        # 2: colorize all other part separator lines
        # 2a: and add an extra newline, for readablility
        sed -e "/address@hidden(\[ part  - text\/plain -   \]\)@\*\]/d" \
            -e "s/address@hidden(\[ part .*\]\)@\*\]/${GREEN}\1${NORMAL}\n/"

        hilite_headers | hilite_part_markers

        MHSHOW=$Mail/mhn.block_html \
            mhshow -type text/plain "$@" | hilite | less

        # delete part markers entirely if they're the whole line,
        # otherwise just remove that part of the line.
        sed -e '/address@hidden(\[ part .* \]\)@\*\]$/d' \
            -e 's/address@hidden(\[ part .* \]\)@\*\]//'


i wrote:
 > ken wrote:
 >  > I'm not fond of the idea of the new pseudo-component you created called
 >  > "hidden".  I know you can use it as a boolean, but defining it to a fixed
 >  > string seems wrong to me.
 >  > 
 >  > There is an existing function called %(unseen); I think it would be 
 > perfect
 >  > for this.  The way you pass in values to unseen is via the "dat" array
 > and right you were.  this seems cleaner, and the name works nicely.  new
 > draft patch attached.

 paul fox, address@hidden (arlington, ma, where it's 38.3 degrees)

 paul fox, address@hidden (arlington, ma, where it's 39.4 degrees)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]