2 # news - less(1) around mshow for my rss feeds
4 # use a custom mblaze env
5 mkdir -p ~/.mblaze/news
6 export MBLAZE=~/.mblaze/news
8 if [ "$1" = --filter ]; then
9 if [ "$2" = //scan ]; then
16 total=$(mscan -n -- -1)
20 $((total - 2))) mscan .-3:.+2 ;;
21 $((total - 1))) mscan .-4:.+1 ;;
22 $total) mscan .-5:.+0 ;;
27 if ! [ -f "$(mseq -r "$2")" ]; then
32 if [ $MLESS_RAW -eq 0 ]; then
33 if [ $MLESS_HTML -eq 1 ]; then
34 mshow -A text/html "$2"
46 if [ "$#" -eq 0 ] && ! [ -t 0 ]; then
55 [ "$#" -eq 1 ] && set -- ${1:-.}
57 if [ "$#" -ge 1 ]; then
65 if [ -f "$MBLAZE/mlesskey" ]; then
66 export LESSKEYIN="$MBLAZE/mlesskey"
67 elif [ -f "$HOME/.mblaze/mlesskey" ]; then
68 export LESSKEYIN="$HOME/.mblaze/mlesskey"
69 elif [ -f "$HOME/.mlesskey" ]; then
70 export LESSKEYIN="$HOME/.mlesskey"
71 elif [ -f "$MBLAZE/mless" ]; then
72 export LESSKEY="$MBLAZE/mless"
73 elif [ -f "$HOME/.mblaze/mless" ]; then
74 export LESSKEY="$HOME/.mblaze/mless"
75 elif [ -f "$HOME/.mless" ]; then
76 export LESSKEY="$HOME/.mless"
79 MAILFEEDS_DIR="${MAILFEEDS_DIR:-$HOME/Maildir/op/rss}"
80 mlist -st "$MAILFEEDS_DIR" | mthread -r | mseq -S
83 LESSOPEN="|$0 --filter %s" \
84 less -Ps"mless %f?m (message %i of %m).." -R \
85 "+:e $(mscan -n .)$nl" //scan $(mscan -n :)
89 mseq -C '$' 2>/dev/null
91 78) # N go to next unseen message
92 nu=$(magrep -v -m1 :S .:) && mseq -C "$nu"
95 url="$(mhdr -h X-Rssgo-Email)"
96 if [ $? -eq 0 -a -n "$url" ]; then
101 mseq -C "$(mseq .+1: | sed -n '/^[^ <]/{p;q;}')"
108 82) # R toggle raw mode
109 MLESS_RAW=$((1-$MLESS_RAW))
111 72) # H read with w3m
112 #MLESS_HTML=$((1-$MLESS_HTML))
113 mshow -Nh '' | w3m -T text/html -
116 mseq -C '.^' 2>/dev/null