[Nmh-workers] SPAM??? [was: [exmh-users] Email access while traveling?]
It looks like someone harvested email addresses from the list and I'm getting a LOT of spam containing my original subject line. Anyone else see this too? Sigh -- Kevin ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
[Nmh-workers] colorized/highlighted scan output?
Hi, I tried adding some raw ANSI escape sequences to a scan format to colorize the cur and unseen messages, and they sort of work. I get the desired effects, but scan loses track of how many characters are actually displayed so there are some annoyances. They should be easy to fix. But before I dig into that, does anyone have another way to colorize or highlight the output from scan? David ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] SPAM??? [was: [exmh-users] Email access whiletraveling?]
Kevin wrote: > It looks like someone harvested email addresses from the list and I'm > getting a LOT of spam containing my original subject line. Anyone > else see this too? I haven't seen this. I'm not on exmh-users. David ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
david wrote: > Hi, > > I tried adding some raw ANSI escape sequences to a scan > format to colorize the cur and unseen messages, and they > sort of work. I get the desired effects, but scan loses > track of how many characters are actually displayed so there > are some annoyances. They should be easy to fix. > > But before I dig into that, does anyone have another way to > colorize or highlight the output from scan? i think my usual inclination for colorization is to post-process with sed. i haven't done it with scan output, but i do it with a couple of different mail perusing scripts i've written. leaving out the details, something like this: color_init() { RED="$(printf \\033[1\;31m)" GREEN="$(printf \\033[1\;32m)" YELLOW="$(printf \\033[1\;33m)" BLUE="$(printf \\033[1\;34m)" PURPLE="$(printf \\033[1\;35m)" CYAN="$(printf \\033[1\;36m)" BOLD="$(printf \\033[1m)" NORMAL="$(printf \\033[m)" ESC="$(printf \\033)" } # make the Subject: and From: text stand out in red and blue colorize() { sed \ -e 's/^\(Subject: *\)\(.*\)/\1'"$RED"'\2'"$NORMAL"'/' \ -e 's/^\(From: *\)\(.*\)/\1'"$BLUE"'\2'"$NORMAL"'/' } mhshow $msg | colorize i guess you'd have to use a scan format which tagged the line, and then sed might have to untag them as well as colorize them. paul =- paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 44.2 degrees) ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
>I tried adding some raw ANSI escape sequences to a scan >format to colorize the cur and unseen messages, and they >sort of work. I get the desired effects, but scan loses >track of how many characters are actually displayed so there >are some annoyances. They should be easy to fix. I don't have a better way to colorize things like cur and unseen ... but this touches on something I've been meaning to work on. Right now fmt_scan() takes a parameter that is "width", which is used to limit how many characters it will output. The problem is that's also used to mean the buffer size, and of course nowadays one column doesn't always equal one byte. I run into this with UTF-8 output in scan; the columns line up properly, but it doesn't output a whole line. My thinking was to add an extra parameter to fmt_scan() that meant the buffer size available and limit the output based on both the number of characters and the total buffer size. This is easy enough to do, but I realize that it has bearing on your problem because it's a similar issue; you want to output some bytes in scan that won't take up any columns, so I'm wondering if there is some overlap to our problems here. My issue is straightforward and doesn't require any user-visible changes, but I am thinking your issue might. I am wondering if you've thought about how you'd make this work; maybe a format escape that says, "Don't count these characters against the width total?" Or something else? --Ken ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
Ken wrote: > My thinking was to add an extra parameter to fmt_scan() that meant > the buffer size available and limit the output based on both the > number of characters and the total buffer size. Yup. > My issue is straightforward and doesn't require any user-visible > changes, but I am thinking your issue might. I am wondering if > you've thought about how you'd make this work; maybe a format escape > that says, "Don't count these characters against the width total?" > Or something else? I was thinking of looking for ANSI sequences and not counting them. But I don't know if that could get into trouble with multibyte characters. mbtowc() is too much of a mystery to me. That format escape would avoid the issue. David ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
Paul wrote: > i think my usual inclination for colorization is to > post-process with sed. i haven't done it with scan > output, but i do it with a couple of different mail > perusing scripts i've written. After trying it for a bit, I want it built into nmh. I do too many different things with scan to try to post-process it. David ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
David Levine writes: > Ken wrote: >> My issue is straightforward and doesn't require any user-visible >> changes, but I am thinking your issue might. I am wondering if >> you've thought about how you'd make this work; maybe a format escape >> that says, "Don't count these characters against the width total?" >> Or something else? > I was thinking of looking for ANSI sequences and not counting > them. But I don't know if that could get into trouble with > multibyte characters. mbtowc() is too much of a mystery to me. > That format escape would avoid the issue. +1 for a "don't count this" format escape. I don't think scan should be assuming anything about what the terminal might take to be an escape sequence. They're not that well standardized. regards, tom lane ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
>I was thinking of looking for ANSI sequences and not counting >them. But I don't know if that could get into trouble with >multibyte characters. mbtowc() is too much of a mystery to me. Well, this is where things get "funky". In the particular case of UTF-8, the only magical bytes are ones with the high bit set. For bytes < 128, they are handled "normally". So assuming you're using the "normal" ANSI escape sequences (and you're not using 0x9b as a CSI), the multibyte routines will ignore them. If you care, what we do in fmt_scan with the multibyte routines is this: - Use mbtowc to convert a possible multibyte character (example: anything in UTF-8 U+0080 or greater) into a "wide" character. - mbtowc() tells us the number of bytes that character consumed. For ASCII, it's always 1. For UTF-8, sometimes it's > 1. If we don't have enough room in the buffer for a complete character, we stop. - We use wcwidth() to see how many columns that character consumes, and use that to make sure we don't overrun our field width. - We then copy the bytes over for that character (that we got from mbtowc()). But it occurs to me that we shouldn't actually do any of this for a "don't count this" format escape, because that stuff should live outside of the normal string handling routines in fmt_scan(). Also, I'm with Tom that I'm not so crazy about putting knowledge of ANSI escape sequences directly into fmt_scan(), because who knows if your terminal supports them? David, do you want to implement this? --Ken ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
> > That format escape would avoid the issue. > > +1 for a "don't count this" format escape. I don't think scan should be > assuming anything about what the terminal might take to be an escape > sequence. They're not that well standardized. Specifically supporting the terminal types xterm and xterm-256color seems like a logical place to start? steve -- ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
Ken wrote: > But it occurs to me that we shouldn't actually do any of this for a > "don't count this" format escape, because that stuff should live > outside of the normal string handling routines in fmt_scan(). Also, > I'm with Tom that I'm not so crazy about putting knowledge of ANSI > escape sequences directly into fmt_scan(), because who knows if your > terminal supports them? Agreed. > David, do you want to implement this? Will do. Any suggestions on what to call the escape function? "esc" was might first thought but it might be confusing to talk about/describe in the man page. "fmtesc"? "invisible"? David ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
>Will do. Any suggestions on what to call the escape function? It sounds like a zero-width operator, though that's rather long. What about "hide"? ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
david wrote: > Ken wrote: > > > But it occurs to me that we shouldn't actually do any of this for a > > "don't count this" format escape, because that stuff should live > > outside of the normal string handling routines in fmt_scan(). Also, > > I'm with Tom that I'm not so crazy about putting knowledge of ANSI > > escape sequences directly into fmt_scan(), because who knows if your > > terminal supports them? > > Agreed. > > > David, do you want to implement this? > > Will do. Any suggestions on what to call the escape function? > "esc" was might first thought but it might be confusing to > talk about/describe in the man page. "fmtesc"? "invisible"? the 1980's just called. they want their termcap file back. shouldn't this be done with more generic controls, that map to (uncounted) terminfo/ncurses/whatever's-used-now strings? i.e., controls for specifically changing red/blue/bold/etc? feels a little late to be embedding specific vt100 CSI codes into scan formats. paul > > David > > ___ > Nmh-workers mailing list > Nmh-workers@nongnu.org > https://lists.nongnu.org/mailman/listinfo/nmh-workers =- paul fox, p...@foxharp.boston.ma.us (arlington, ma, where it's 43.2 degrees) ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
>Will do. Any suggestions on what to call the escape function? >"esc" was might first thought but it might be confusing to >talk about/describe in the man page. "fmtesc"? "invisible"? Jerrad points out it's a zero-width operator ... maybe "zputstr"? --Ken ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
>shouldn't this be done with more generic controls, that map to >(uncounted) terminfo/ncurses/whatever's-used-now strings? i.e., >controls for specifically changing red/blue/bold/etc? feels a little >late to be embedding specific vt100 CSI codes into scan formats. I'm sympathetic to this viewpoint ... too bad there wasn't someone who was crazy enough to write a curses-based nmh front-end to let us know what he did :-) --Ken ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers
Re: [Nmh-workers] colorized/highlighted scan output?
> >shouldn't this be done with more generic controls, that map to > >(uncounted) terminfo/ncurses/whatever's-used-now strings? i.e., > >controls for specifically changing red/blue/bold/etc? feels a little > >late to be embedding specific vt100 CSI codes into scan formats. > > I'm sympathetic to this viewpoint ... too bad there wasn't someone who > was crazy enough to write a curses-based nmh front-end to let us know > what he did :-) Who you callin' crazy? I emailed this directly to David... might be helpful to crib from... http://www.hep.wisc.edu/~rader/mh-v/mh-v.1.0/xtc :) steve -- ___ Nmh-workers mailing list Nmh-workers@nongnu.org https://lists.nongnu.org/mailman/listinfo/nmh-workers