From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/69349 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.gnus.general Subject: Re: rounding down totals Date: Mon, 18 Jan 2010 11:30:34 -0600 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87k4vfmibp.fsf@lifelogs.com> References: <87fx8jmnan.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1263835951 18903 80.91.229.12 (18 Jan 2010 17:32:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 18 Jan 2010 17:32:31 +0000 (UTC) To: Original-X-From: ding-owner+M17753@lists.math.uh.edu Mon Jan 18 18:32:24 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1NWvSh-0005GL-Ih for ding-account@gmane.org; Mon, 18 Jan 2010 18:32:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1NWvRn-0005pQ-G5; Mon, 18 Jan 2010 11:31:27 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1NWvRj-0005or-85 for ding@lists.math.uh.edu; Mon, 18 Jan 2010 11:31:23 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.69) (envelope-from ) id 1NWvRg-0004bk-MI for ding@lists.math.uh.edu; Mon, 18 Jan 2010 11:31:22 -0600 Original-Received: from chirelay1o.jumptrading.com ([38.98.147.153] helo=chirelay1.jumptrading.com) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1NWvRX-0003fi-00 for ; Mon, 18 Jan 2010 18:31:11 +0100 Original-Received: from chirelay1.jumptrading.com (unknown [127.0.0.1]) by chirelay1.jumptrading.com (Symantec Mail Security) with ESMTP id 71430320003 for ; Mon, 18 Jan 2010 11:30:21 -0600 (CST) X-AuditID: 26629395-a5acabb000004311-fb-4b549aad4af1 Original-Received: from chiexchange02.w2k.jumptrading.com (unknown [38.98.147.140]) by chirelay1.jumptrading.com (Symantec Mail Security) with ESMTP id 45DAA2DC108 for ; Mon, 18 Jan 2010 11:30:21 -0600 (CST) Original-Received: from internalsmtp.w2k.jumptrading.com (10.2.4.29) by chiexchange02.w2k.jumptrading.com (10.2.4.71) with Microsoft SMTP Server id 8.1.291.1; Mon, 18 Jan 2010 11:30:36 -0600 Original-Received: from tzlatanov-ubuntu-desktop.jumptrading.com ([10.2.13.58]) by internalsmtp.w2k.jumptrading.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 18 Jan 2010 11:30:35 -0600 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" In-Reply-To: <87fx8jmnan.fsf@lifelogs.com> (Ted Zlatanov's message of "Thu, 12 Nov 2009 15:43:44 -0600") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.90 (gnu/linux) X-OriginalArrivalTime: 18 Jan 2010 17:30:35.0963 (UTC) FILETIME=[F1D060B0:01CA9863] X-Brightmail-Tracker: AAAAAA== X-Spam-Score: -2.3 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:69349 Archived-At: On Thu, 12 Nov 2009 15:43:44 -0600 Ted Zlatanov wrote:=20 TZ> In Gnus, I'd like to display the total number of messages less TZ> precisely, rounding down to the nearest 10^3 power. Basically: TZ> 1 =3D> 1 TZ> 100 =3D> 100 TZ> 1000 =3D> 1K TZ> 5001 =3D> 5K TZ> I may get fancier with the rounding (e.g. 10+ for 12 and 100+ for 190), TZ> but can anyone tell me if there is an easy way to plug this into the TZ> formats, or do I have to write a bunch of user functions? I came up with this. It's extremely customized--you will probably not like my choices at all, but I was trying to make them visually memorable and somewhat meaningful. The look comes out like this: [ Gnus =E2=99=80=E2=99=80=E2=99=80=E2=99=80=E2=99=80=E2=99=80=E2=99=80+ ]=20 [ mine =E2=99=82+ ]=20 =D2=97=D2=97=D2=97=D2=97=D2=97=D2=97/=D2=97=D2=97=D2=97=D2=97=D2= =97=D2=97 : mail=20 * / : dev=20 /=D2=97=D2=97=D2=97 : xy=20 * / : zyx=20 * / : hr=20 =D0=B6=D0=B6/=D0=B6=D0=B6 : xyz=20 [ main =E2=99=80=E2=99=80=E2=99=80+ ]=20 =E2=99=80+/=E2=99=80=E2=99=80+ : INBOX.mail=20 ... I hope this is useful to someone. In case you're wondering why not just show the counts, my goal was to avoid numbers in the display. Visually they are distracting IMO, when you really want a graphical overview of the groups (the distinction is similar to showing a table of numbers vs. showing a graph of the numbers). I'll see if I can play with actual graphics instead of Unicode symbols, something like sparklines[1] but I need to find out what Emacs can do in that area. Ted [1] http://en.wikipedia.org/wiki/Sparkline (setq gnus-topic-line-format "%i[ %u&topic-line; ] %v\n" gnus-group-line-format "%M%S%p%P %21uX:%B%(%g%)%l %O\n") (defun gnus-user-format-function-X (group) "Return \"unseen/unread\". For use in the group specifier." (let ((unread (tzz-summarize-number (string-to-number gnus-tmp-number-of-= unread))) (unseen (tzz-summarize-number (gnus-number-of-unseen-articles-in-gr= oup gnus-tmp-group)))) (if (not (or (string-equal unseen "0"))) (format "%010s/%-010s" unseen unread) unread))) ;; this corresponds to a topic line format of "%n %A" (defun gnus-user-format-function-topic-line (dummy) (let* ((topic-face (if (zerop total-number-of-articles) 'fl-comment-face 'fl-function-name-face))) (propertize (format "%s %s" name (tzz-summarize-number total-number-of-articles)) 'face topic-face))) (defun tzz-summarize-number (n) (cond ((null n) "?") ((< n 3) (make-string n ?=D0=B6)) ((< n 7) (make-string n ?=D2=97)) ((< n 10) (make-string n ?=D2=96)) ((< n 50) (concat (make-string (/ n 10) ?=E2=99=82) "+")) ((< n 500) (concat (make-string (/ n 50) ?=E2=99=80) "+")) ((< n 1000) (concat (make-string (/ n 100) ?C) "+")) (t "M+")))