[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: message lines



Jens-Ulrik Petersen <jens-ulrik.petersen@nokia.com> writes:

> How hard is it to get nnimap to display the total message size
> (including that of attachements) in the summary buffer?

Yes, I wanted that, too, so here's what I did.  Probably this is just
a crock, but it does seem to work...

;; Use %c rather than %L because nnimap doesn't inlude the line
;; count for attachments in the line count.
(require 'gnus-sum)
(defsubst kai-gnus-summary-line-message-size (header)
  (let ((c (or (mail-header-chars header) 0)))
    (cond ((< c 1024) (format "%db" c))
          ((< c (* 1024 1024)) (format "%dk" (/ c 1024)))
          (t (format "%dM" (/ c (* 1024 1024)))))))
(add-to-list 'gnus-summary-line-format-alist
             '(?k (kai-gnus-summary-line-message-size gnus-tmp-header) ?s))
(setq gnus-summary-line-format "%U%R%z%I%(%[%d,%4k: %-15,15f%]%) %s\n")

If you find a better way to format the size, let me know.  It is
somewhat strange that a message with 1010 bytes will display as
"1010b" whereas a message with 1030 bytes will display as "1k".

kai
-- 
Life is hard and then you die.