Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Reiner Steib <4.uce.03.r.s@nurfuerspam.de>
Cc: Frank Haun <pille3003@fhaun.de>
Subject: Re: Change behaviour %k in gnus-summary-line-format?
Date: Wed, 08 Oct 2003 17:49:12 +0200	[thread overview]
Message-ID: <v9n0cb91c7.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <hddy8vww3jq.fsf@bacchus.pvv.ntnu.no>

On Wed, Oct 08 2003, Svend Tollak Munkejord wrote:

[...]
> the size of the message is displayed due to the %k. If it is in the range
> of 100k, I see "0.1M". 
>
> Would it be possible to tell Gnus to display, say, "103k" instead,
> 1) making it easier to read, and 2) increasing the number of
> significant digits by two?

(defsubst gnus-summary-line-message-size (head)
  "Return pretty-printed version of message size.
This function is intended to be used in
`gnus-summary-line-format-alist'."
  (let ((c (or (mail-header-chars head) -1)))
    (cond ((< c 0) "n/a") ;; chars not available
	  ((< c (* 1000))       (format "%db" c))
	  ((< c (* 1000 10))    (format "%1.1fk" (/ c 1024.0)))
	  ((< c (* 1000 1000))  (format "%dk" (/ c 1024.0)))
	  ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
	  (t (format "%dM" (/ c (* 1024.0 1024)))))))

This will print the numbers as "941b", "1.1k", " 86k", "102k", "472k",
"1.1M".  It seems that users have different preferences here: 100k or
0.1M?  900k or 0.9M?  Some people prefer the former
<news:8665yqqqlp.fsf@pille.fhaun.de>, some the latter
<news:r8hevize.fsf@hschmi22.userfqdn.rz-online.de>.

Is it useful to add another format specifier (say "K") or should we
leave it as an exercise for the user?

,----[ (info "(gnus)Summary Buffer Lines") ]
| `u'
|      User defined specifier.  The next character in the format string
|      should be a letter.  Gnus will call the function
|      `gnus-user-format-function-X', where X is the letter following
|      `%u'.  The function will be passed the current header as argument.
|      The function should return a string, which will be inserted into
|      the summary just like information from any other summary specifier.
`----

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo--- PGP key available via WWW   http://rsteib.home.pages.de/


  reply	other threads:[~2003-10-08 15:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-08  8:12 Svend Tollak Munkejord
2003-10-08 15:49 ` Reiner Steib [this message]
2003-10-08 16:49   ` Svend Tollak Munkejord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9n0cb91c7.fsf@marauder.physik.uni-ulm.de \
    --to=4.uce.03.r.s@nurfuerspam.de \
    --cc=pille3003@fhaun.de \
    --cc=reiner.steib@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).