From eafa9411ec4d7d53e9a8985459921219396de8ce Mon Sep 17 00:00:00 2001 From: "Steffen (Daode) Nurpmeso" Date: Mon, 20 Feb 2017 14:34:45 +0100 Subject: [PATCH] (BWDIC!) Defaults for *datefield{-markout-older}* (Debian #855582; r.ductor).. He writes |As a complete s-nail/mailx/mail newby I was really scaried by the headers \ |my firs h showed, |the time ordering and year of the messages was compleately unclear. |I took me one hour of googling and a lot of patience to dive in the \ And i will write, among others, I see, sorry for that! The manual of v14.8 misses the link to *datefield*, but v14.9 already includes it, so you will have a direct reference chain from "On reading mail, and interactive mode" over *headline* to *datefield*, which i think is ok: it will be hyperlinked if the output format supports it, so you could get there really fast. The global /etc/mail.rc, or /etc/s-nail.rc i think it is on Debian, includes a commented-out example for *datefield* and *datefield-markout-older*, already in v14.8, but now that i look again there is no link to *headline*, which i will change in a minute! But while doing so i realized that this is really a no-go behaviour, noone at all is interested in the date that the From_ line contains, and i also never ever used that one. So simply drop the entire nail.rc stuff, and assign default values which also fit into the default field width that the default *headline* reserves for date and time (with year). --- cmd_headers.c | 6 +++--- nail.1 | 61 +++++++++++++++++++++++++++++++++-------------------------- nail.h | 4 ++-- nail.rc | 3 --- 4 files changed, 39 insertions(+), 35 deletions(-) diff --git a/cmd_headers.c b/cmd_headers.c index d3d8694e..0925de9c 100644 --- a/cmd_headers.c +++ b/cmd_headers.c @@ -113,8 +113,8 @@ _print_head(size_t yetprinted, size_t msgno, FILE *f, bool_t threaded) jattrok: if ((fmt = ok_vlook(headline)) == NULL) { fmt = ((ok_blook(bsdcompat) || ok_blook(bsdheadline)) - ? "%>%a%m %-20f %16d %3l/%-5o %i%-S" - : "%>%a%m %-18f %16d %4l/%-5o %i%-s"); + ? "%>%a%m %-20f %16d %4l/%-5o %i%-S" + : "%>%a%m %-18f %-16d %4l/%-5o %i%-s"); } __hprf(yetprinted, fmt, msgno, f, threaded, attrlist); @@ -374,7 +374,7 @@ jputcb: n = 16; if (UICMP(32, n_ABS(n), >, wleft)) n = (n < 0) ? -wleft : wleft; - n = fprintf(f, "%*.*s", n, n, date); + n = fprintf(f, "%*.*s", n, n_ABS(n), date); wleft = (n >= 0) ? wleft - n : 0; break; case 'e': diff --git a/nail.1 b/nail.1 index a4efc4d5..8a9e8e71 100644 --- a/nail.1 +++ b/nail.1 @@ -7157,38 +7157,41 @@ nor prevented. . .Mx .It Va datefield -In the summary of -.Ic headers -the message date, if any is to be displayed according to the format of -.Va headline , -is by default taken from the -.Ql From_ -line of the message. -If this variable is set the date as given in the -.Ql Date: -header field is used instead, converted to local time. -To control the display format of the date assign a valid +Controls the appearance of the +.Ql %d +date and time format specification of the +.Va headline +variable, that is used, for example, when viewing the summary of +.Ic headers . +If unset, then the local receiving date is used and displayed +unformatted, otherwise the message sending +.Ql Date: . +It is possible to assign a .Xr strftime 3 -format string. -(Note that the +format string and control formatting, but embedding newlines via the .Ql %n -format should not be used, because \*(UA does not take embedded newlines -into account when calculating how many lines fit onto the screen.) -Also see +format is not supported, and will result in display errors. +The default is +.Ql %Y-%m-%d %H:%M , +and also see .Va datefield-markout-older . . .Mx .It Va datefield-markout-older -This variable, when set in addition to -.Va datefield , -is used to display -.Dq older -messages (concept is rather comparable to the +Only used in conjunction with +.Va datefield . +Can be used to create a visible distinction of messages dated more than +a day in the future, or older than six months, a concept comparable to the .Fl \&\&l option of the POSIX utility -.Xr ls 1 ) . -The content interpretation is identical to -.Va \&\&datefield . +.Xr ls 1 . +If set to the empty string, then the plain month, day and year of the +.Ql Date: +will be displayed, but a +.Xr strftime 3 +format string to control formatting can be assigned. +The default is +.Ql %Y-%m-%d . . .Mx .It Va debug @@ -7664,11 +7667,15 @@ Message attribute character (status flag); the actual content can be adjusted by setting .Va attrlist . .It Ql %d -The date when the message was received, or the date found in the +The date found in the .Ql From: -header when the +header of the message when .Va datefield -variable is set (optionally to a date display format string). +is set (the default), otherwise the date when the message was received. +Formatting can be controlled by assigning a +.Xr strftime 3 +format string to +.Va datefield . .It Ql %e The indenting level in threaded mode. .It Ql %f diff --git a/nail.h b/nail.h index a66a92c6..762dc505 100644 --- a/nail.h +++ b/nail.h @@ -1607,8 +1607,8 @@ ok_b_autothread, ok_v_compose_subject, /* {rdonly=1} */ ok_v_DEAD, /* {notempty=1,env=1,defval=VAL_DEAD} */ - ok_v_datefield, - ok_v_datefield_markout_older, + ok_v_datefield, /* {i3val="%Y-%m-%d %H:%M"} */ + ok_v_datefield_markout_older, /* {i3val="%Y-%m-%d"} */ ok_b_debug, /* {vip=1} */ ok_b_disposition_notification_send, ok_b_dot, diff --git a/nail.rc b/nail.rc index 91d2b777..d038f0c4 100644 --- a/nail.rc +++ b/nail.rc @@ -65,9 +65,6 @@ set bsdannounce # the screen. (Set crt=0 to always page; value treated as number of lines) set crt -# Define date display in header summary -#set datefield="%R %m-%d" datefield-markout-older=" %g-%m-%d" - # When composing messages a line consisting of `.' finalizes a message #set dot -- 2.11.4.GIT